Skip to content

Commit

Permalink
Merge pull request #85 from BoniLindsley/fix-84-letter-case-of-user-repo
Browse files Browse the repository at this point in the history
Lower case command arguments user and repo
  • Loading branch information
dspinellis authored Aug 17, 2020
2 parents aac4c98 + 8417787 commit c0e9f80
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions lib/git-issue/import-export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ USAGE_export_EOF
exit 2
}

convert_to_lower_case()
{
echo "$1" | tr '[:upper:]' '[:lower:]'
}

# importsget: Return all mentions of SHA given in imports

importsget()
Expand Down Expand Up @@ -202,8 +207,8 @@ create_issue()
path=$(issue_path_part "$1") || exit
isha=$(issue_sha "$path")
provider="$2"
user="$3"
repo="$4"
user="$(convert_to_lower_case $3)"
repo="$(convert_to_lower_case $4)"

if [ "$provider" = gitlab ] ; then
# if the repo belongs to a group, repo will be in the format groupname/reponame
Expand Down Expand Up @@ -810,8 +815,8 @@ export_issues()
test -n "$2" -a -n "$3" || usage_export
test "$1" = github -o "$1" = gitlab || usage_export
provider=$1
user="$2"
repo="$3"
user="$(convert_to_lower_case $2)"
repo="$(convert_to_lower_case $3)"

cdissues
test -d "imports/$provider/$user/$repo" || error "No local issues found for this repository."
Expand Down Expand Up @@ -886,8 +891,8 @@ sub_import()
test "$1" = github -o "$1" = gitlab -a -n "$2" -a -n "$3" || usage_import
provider="$1"
# convert to lowercase to avoid duplicates
user="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
repo="$(echo "$3" | tr '[:upper:]' '[:lower:]')"
user="$(convert_to_lower_case $2)"
repo="$(convert_to_lower_case $3)"

cdissues

Expand Down Expand Up @@ -959,8 +964,8 @@ sub_exportall()
test "$1" = github -o "$1" = gitlab || usage_exportall
test -n "$2" -a -n "$3" || usage_exportall
provider="$1"
user="$2"
repo="$3"
user="$(convert_to_lower_case $2)"
repo="$(convert_to_lower_case $3)"

# Create list of relevant shas sorted by date
shas=$(sub_list -l %i -o %c "$all"| sed '/^$/d' | tr '\n' ' ')
Expand Down

0 comments on commit c0e9f80

Please sign in to comment.