From: Junio C Hamano Date: Thu, 20 Sep 2012 22:53:31 +0000 (-0700) Subject: Merge branch 'nd/maint-remote-remove' into maint X-Git-Tag: v1.7.12.2~15 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f9c2d2b14e81d48d3d04f3bb01b1579ee359edb4?ds=inline;hp=-c Merge branch 'nd/maint-remote-remove' into maint * nd/maint-remote-remove: remote: prefer subcommand name 'remove' to 'rm' --- f9c2d2b14e81d48d3d04f3bb01b1579ee359edb4 diff --combined contrib/completion/git-completion.bash index 5a5b5a0b3c,ee4c0a07ae..3b98290349 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@@ -225,13 -225,6 +225,13 @@@ _get_comp_words_by_ref ( fi fi +# Quotes the argument for shell reuse +__git_quote() +{ + local quoted=${1//\'/\'\\\'\'} + printf "'%s'" "$quoted" +} + # Generates completion reply with compgen, appending a space to possible # completion words, if necessary. # It accepts 1 to 4 arguments: @@@ -268,7 -261,7 +268,7 @@@ __gitcomp ( __gitcomp_nl () { local IFS=$'\n' - COMPREPLY=($(compgen -P "${2-}" -S "${4- }" -W "$1" -- "${3-$cur}")) + COMPREPLY=($(compgen -P "${2-}" -S "${4- }" -W "$(__git_quote "$1")" -- "${3-$cur}")) } __git_heads () @@@ -1021,8 -1014,7 +1021,8 @@@ _git_commit ( --*) __gitcomp " --all --author= --signoff --verify --no-verify - --edit --amend --include --only --interactive + --edit --no-edit + --amend --include --only --interactive --dry-run --reuse-message= --reedit-message= --reset-author --file= --message= --template= --cleanup= --untracked-files --untracked-files= @@@ -2040,7 -2032,7 +2040,7 @@@ _git_config ( _git_remote () { - local subcommands="add rename rm set-head set-branches set-url show prune update" + local subcommands="add rename remove set-head set-branches set-url show prune update" local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then __gitcomp "$subcommands" @@@ -2048,7 -2040,7 +2048,7 @@@ fi case "$subcommand" in - rename|rm|set-url|show|prune) + rename|remove|set-url|show|prune) __gitcomp_nl "$(__git_remotes)" ;; set-head|set-branches) diff --combined t/t5540-http-push.sh index f141f2d1da,7c14bc4811..01d0d95b4d --- a/t/t5540-http-push.sh +++ b/t/t5540-http-push.sh @@@ -46,7 -46,15 +46,7 @@@ test_expect_success 'create password-pr "$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/test_repo.git" ' -test_expect_success 'setup askpass helper' ' - cat >askpass <<-\EOF && - #!/bin/sh - echo user@host - EOF - chmod +x askpass && - GIT_ASKPASS="$PWD/askpass" && - export GIT_ASKPASS -' +setup_askpass_helper test_expect_success 'clone remote repository' ' cd "$ROOT_PATH" && @@@ -109,7 -117,7 +109,7 @@@ test_expect_success 'http-push fetches # By reset, we force git to retrieve the packed object (cd "$ROOT_PATH"/test_repo_clone_packed && git reset --hard HEAD^ && - git remote rm origin && + git remote remove origin && git reflog expire --expire=0 --all && git prune && git push -f -v $HTTPD_URL/dumb/test_repo_packed.git master) @@@ -154,7 -162,6 +154,7 @@@ test_http_push_nonff "$HTTPD_DOCUMENT_R test_expect_success 'push to password-protected repository (user in URL)' ' test_commit pw-user && + set_askpass user@host && git push "$HTTPD_URL_USER/auth/dumb/test_repo.git" HEAD && git rev-parse --verify HEAD >expect && git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/test_repo.git" \ @@@ -162,15 -169,9 +162,15 @@@ test_cmp expect actual ' +test_expect_failure 'user was prompted only once for password' ' + expect_askpass pass user@host +' + test_expect_failure 'push to password-protected repository (no user in URL)' ' test_commit pw-nouser && + set_askpass user@host && git push "$HTTPD_URL/auth/dumb/test_repo.git" HEAD && + expect_askpass both user@host git rev-parse --verify HEAD >expect && git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/test_repo.git" \ rev-parse --verify HEAD >actual &&