From: Junio C Hamano Date: Wed, 12 Sep 2012 21:21:58 +0000 (-0700) Subject: Merge branch 'nd/maint-remote-remove' X-Git-Tag: v1.8.0-rc0~68 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/90585604a72aaf56158069023dbcc6a61c6d7d50?ds=inline;hp=-c Merge branch 'nd/maint-remote-remove' * nd/maint-remote-remove: remote: prefer subcommand name 'remove' to 'rm' --- 90585604a72aaf56158069023dbcc6a61c6d7d50 diff --combined builtin/remote.c index 8a670d82a7,357d59d667..a5a4b23231 --- a/builtin/remote.c +++ b/builtin/remote.c @@@ -8,66 -8,66 +8,66 @@@ #include "refs.h" static const char * const builtin_remote_usage[] = { - "git remote [-v | --verbose]", - "git remote add [-t ] [-m ] [-f] [--tags|--no-tags] [--mirror=] ", - "git remote rename ", - "git remote remove ", - "git remote set-head (-a | -d | )", - "git remote [-v | --verbose] show [-n] ", - "git remote prune [-n | --dry-run] ", - "git remote [-v | --verbose] update [-p | --prune] [( | )...]", - "git remote set-branches [--add] ...", - "git remote set-url [--push] []", - "git remote set-url --add ", - "git remote set-url --delete ", + N_("git remote [-v | --verbose]"), + N_("git remote add [-t ] [-m ] [-f] [--tags|--no-tags] [--mirror=] "), + N_("git remote rename "), - N_("git remote rm "), ++ N_("git remote remove "), + N_("git remote set-head (-a | -d | )"), + N_("git remote [-v | --verbose] show [-n] "), + N_("git remote prune [-n | --dry-run] "), + N_("git remote [-v | --verbose] update [-p | --prune] [( | )...]"), + N_("git remote set-branches [--add] ..."), + N_("git remote set-url [--push] []"), + N_("git remote set-url --add "), + N_("git remote set-url --delete "), NULL }; static const char * const builtin_remote_add_usage[] = { - "git remote add [] ", + N_("git remote add [] "), NULL }; static const char * const builtin_remote_rename_usage[] = { - "git remote rename ", + N_("git remote rename "), NULL }; static const char * const builtin_remote_rm_usage[] = { - N_("git remote rm "), - "git remote remove ", ++ N_("git remote remove "), NULL }; static const char * const builtin_remote_sethead_usage[] = { - "git remote set-head (-a | -d | ])", + N_("git remote set-head (-a | -d | ])"), NULL }; static const char * const builtin_remote_setbranches_usage[] = { - "git remote set-branches ...", - "git remote set-branches --add ...", + N_("git remote set-branches ..."), + N_("git remote set-branches --add ..."), NULL }; static const char * const builtin_remote_show_usage[] = { - "git remote show [] ", + N_("git remote show [] "), NULL }; static const char * const builtin_remote_prune_usage[] = { - "git remote prune [] ", + N_("git remote prune [] "), NULL }; static const char * const builtin_remote_update_usage[] = { - "git remote update [] [ | ]...", + N_("git remote update [] [ | ]..."), NULL }; static const char * const builtin_remote_seturl_usage[] = { - "git remote set-url [--push] []", - "git remote set-url --add ", - "git remote set-url --delete ", + N_("git remote set-url [--push] []"), + N_("git remote set-url --add "), + N_("git remote set-url --delete "), NULL }; @@@ -160,17 -160,17 +160,17 @@@ static int add(int argc, const char **a int i; struct option options[] = { - OPT_BOOLEAN('f', "fetch", &fetch, "fetch the remote branches"), + OPT_BOOLEAN('f', "fetch", &fetch, N_("fetch the remote branches")), OPT_SET_INT(0, "tags", &fetch_tags, - "import all tags and associated objects when fetching", + N_("import all tags and associated objects when fetching"), TAGS_SET), OPT_SET_INT(0, NULL, &fetch_tags, - "or do not fetch any tag at all (--no-tags)", TAGS_UNSET), - OPT_STRING_LIST('t', "track", &track, "branch", - "branch(es) to track"), - OPT_STRING('m', "master", &master, "branch", "master branch"), - { OPTION_CALLBACK, 0, "mirror", &mirror, "push|fetch", - "set up remote as a mirror to push to or fetch from", + N_("or do not fetch any tag at all (--no-tags)"), TAGS_UNSET), + OPT_STRING_LIST('t', "track", &track, N_("branch"), + N_("branch(es) to track")), + OPT_STRING('m', "master", &master, N_("branch"), N_("master branch")), + { OPTION_CALLBACK, 0, "mirror", &mirror, N_("push|fetch"), + N_("set up remote as a mirror to push to or fetch from"), PARSE_OPT_OPTARG, parse_mirror_opt }, OPT_END() }; @@@ -1088,7 -1088,7 +1088,7 @@@ static int show(int argc, const char ** { int no_query = 0, result = 0, query_flag = 0; struct option options[] = { - OPT_BOOLEAN('n', NULL, &no_query, "do not query remotes"), + OPT_BOOLEAN('n', NULL, &no_query, N_("do not query remotes")), OPT_END() }; struct ref_states states; @@@ -1196,9 -1196,9 +1196,9 @@@ static int set_head(int argc, const cha struct option options[] = { OPT_BOOLEAN('a', "auto", &opt_a, - "set refs/remotes//HEAD according to remote"), + N_("set refs/remotes//HEAD according to remote")), OPT_BOOLEAN('d', "delete", &opt_d, - "delete refs/remotes//HEAD"), + N_("delete refs/remotes//HEAD")), OPT_END() }; argc = parse_options(argc, argv, NULL, options, builtin_remote_sethead_usage, @@@ -1250,7 -1250,7 +1250,7 @@@ static int prune(int argc, const char * { int dry_run = 0, result = 0; struct option options[] = { - OPT__DRY_RUN(&dry_run, "dry run"), + OPT__DRY_RUN(&dry_run, N_("dry run")), OPT_END() }; @@@ -1318,7 -1318,7 +1318,7 @@@ static int update(int argc, const char int i, prune = 0; struct option options[] = { OPT_BOOLEAN('p', "prune", &prune, - "prune remotes after fetching"), + N_("prune remotes after fetching")), OPT_END() }; const char **fetch_argv; @@@ -1404,7 -1404,7 +1404,7 @@@ static int set_branches(int argc, cons { int add_mode = 0; struct option options[] = { - OPT_BOOLEAN('\0', "add", &add_mode, "add branch"), + OPT_BOOLEAN('\0', "add", &add_mode, N_("add branch")), OPT_END() }; @@@ -1433,11 -1433,11 +1433,11 @@@ static int set_url(int argc, const cha struct strbuf name_buf = STRBUF_INIT; struct option options[] = { OPT_BOOLEAN('\0', "push", &push_mode, - "manipulate push URLs"), + N_("manipulate push URLs")), OPT_BOOLEAN('\0', "add", &add_mode, - "add URL"), + N_("add URL")), OPT_BOOLEAN('\0', "delete", &delete_mode, - "delete URLs"), + N_("delete URLs")), OPT_END() }; argc = parse_options(argc, argv, NULL, options, builtin_remote_seturl_usage, @@@ -1566,7 -1566,7 +1566,7 @@@ static int show_all(void int cmd_remote(int argc, const char **argv, const char *prefix) { struct option options[] = { - OPT__VERBOSE(&verbose, "be verbose; must be placed before a subcommand"), + OPT__VERBOSE(&verbose, N_("be verbose; must be placed before a subcommand")), OPT_END() }; int result; @@@ -1580,7 -1580,7 +1580,7 @@@ result = add(argc, argv); else if (!strcmp(argv[0], "rename")) result = mv(argc, argv); - else if (!strcmp(argv[0], "rm")) + else if (!strcmp(argv[0], "rm") || !strcmp(argv[0], "remove")) result = rm(argc, argv); else if (!strcmp(argv[0], "set-head")) result = set_head(argc, argv); diff --combined contrib/completion/git-completion.bash index 222b804ce4,ee4c0a07ae..0492db924b --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@@ -1071,7 -1071,7 +1071,7 @@@ _git_diff ( } __git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff - tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3 + tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3 codecompare " _git_difftool () @@@ -2032,7 -2032,7 +2032,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" @@@ -2040,7 -2040,7 +2040,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/t5505-remote.sh index 88a21ff0bf,c03ffdde10..ccc55ebf4b --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@@ -52,7 -52,7 +52,7 @@@ test_expect_success setup ' -test_expect_success 'remote information for the origin' ' +test_expect_success C_LOCALE_OUTPUT 'remote information for the origin' ' ( cd test && tokens_match origin "$(git remote)" && @@@ -66,6 -66,8 +66,6 @@@ test_expect_success 'add another remote cd test && git remote add -f second ../two && tokens_match "origin second" "$(git remote)" && - check_remote_track origin master side && - check_remote_track second master side another && check_tracking_branch second master side another && git for-each-ref "--format=%(refname)" refs/remotes | sed -e "/^refs\/remotes\/origin\//d" \ @@@ -75,14 -77,6 +75,14 @@@ ) ' +test_expect_success C_LOCALE_OUTPUT 'check remote tracking' ' +( + cd test && + check_remote_track origin master side && + check_remote_track second master side another +) +' + test_expect_success 'remote forces tracking branches' ' ( cd test && @@@ -101,7 -95,7 +101,7 @@@ test_expect_success 'remove remote' ) ' -test_expect_success 'remove remote' ' +test_expect_success C_LOCALE_OUTPUT 'remove remote' ' ( cd test && tokens_match origin "$(git remote)" && @@@ -131,14 -125,14 +131,14 @@@ EO } && git tag footag && git config --add remote.oops.fetch "+refs/*:refs/*" && - git remote rm oops 2>actual1 && + git remote remove oops 2>actual1 && git branch foobranch && git config --add remote.oops.fetch "+refs/*:refs/*" && git remote rm oops 2>actual2 && git branch -d foobranch && git tag -d footag && - test_cmp expect1 actual1 && - test_cmp expect2 actual2 + test_i18ncmp expect1 actual1 && + test_i18ncmp expect2 actual2 ) ' @@@ -198,7 -192,7 +198,7 @@@ test_expect_success 'show' git config --add remote.two.push refs/heads/master:refs/heads/another && git remote show origin two > output && git branch -d rebase octopus && - test_cmp expect output) + test_i18ncmp expect output) ' cat > test/expect << EOF @@@ -223,7 -217,7 +223,7 @@@ test_expect_success 'show -n' cd test && git remote show -n origin > output && mv ../one.unreachable ../one && - test_cmp expect output) + test_i18ncmp expect output) ' test_expect_success 'prune' ' @@@ -261,7 -255,7 +261,7 @@@ EO test_expect_success 'set-head --auto fails w/multiple HEADs' ' (cd test && test_must_fail git remote set-head --auto two >output 2>&1 && - test_cmp expect output) + test_i18ncmp expect output) ' cat >test/expect < .git/remotes/origin && git remote rename origin origin && @@@ -711,7 -705,7 +711,7 @@@ test_expect_success 'remote prune to ca cd seven && git remote prune origin ) >err 2>&1 && - grep "has become dangling" err && + test_i18ngrep "has become dangling" err && : And the dangling symref will not cause other annoying errors && ( 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 &&