Merge branch 'nd/maint-remote-remove'
authorJunio C Hamano <gitster@pobox.com>
Wed, 12 Sep 2012 21:21:58 +0000 (14:21 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Sep 2012 21:21:58 +0000 (14:21 -0700)
* nd/maint-remote-remove:
remote: prefer subcommand name 'remove' to 'rm'

1  2 
builtin/remote.c
contrib/completion/git-completion.bash
t/t5505-remote.sh
t/t5540-http-push.sh
diff --combined builtin/remote.c
index 8a670d82a74017d0f7b27a5b5b5232abf32d2816,357d59d66792308c4c4d767523767c6d078d7341..a5a4b232310a27c1d67dd6a1bce252cd62cfa52d
@@@ -8,66 -8,66 +8,66 @@@
  #include "refs.h"
  
  static const char * const builtin_remote_usage[] = {
 -      "git remote [-v | --verbose]",
 -      "git remote add [-t <branch>] [-m <master>] [-f] [--tags|--no-tags] [--mirror=<fetch|push>] <name> <url>",
 -      "git remote rename <old> <new>",
 -      "git remote remove <name>",
 -      "git remote set-head <name> (-a | -d | <branch>)",
 -      "git remote [-v | --verbose] show [-n] <name>",
 -      "git remote prune [-n | --dry-run] <name>",
 -      "git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]",
 -      "git remote set-branches [--add] <name> <branch>...",
 -      "git remote set-url [--push] <name> <newurl> [<oldurl>]",
 -      "git remote set-url --add <name> <newurl>",
 -      "git remote set-url --delete <name> <url>",
 +      N_("git remote [-v | --verbose]"),
 +      N_("git remote add [-t <branch>] [-m <master>] [-f] [--tags|--no-tags] [--mirror=<fetch|push>] <name> <url>"),
 +      N_("git remote rename <old> <new>"),
-       N_("git remote rm <name>"),
++      N_("git remote remove <name>"),
 +      N_("git remote set-head <name> (-a | -d | <branch>)"),
 +      N_("git remote [-v | --verbose] show [-n] <name>"),
 +      N_("git remote prune [-n | --dry-run] <name>"),
 +      N_("git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]"),
 +      N_("git remote set-branches [--add] <name> <branch>..."),
 +      N_("git remote set-url [--push] <name> <newurl> [<oldurl>]"),
 +      N_("git remote set-url --add <name> <newurl>"),
 +      N_("git remote set-url --delete <name> <url>"),
        NULL
  };
  
  static const char * const builtin_remote_add_usage[] = {
 -      "git remote add [<options>] <name> <url>",
 +      N_("git remote add [<options>] <name> <url>"),
        NULL
  };
  
  static const char * const builtin_remote_rename_usage[] = {
 -      "git remote rename <old> <new>",
 +      N_("git remote rename <old> <new>"),
        NULL
  };
  
  static const char * const builtin_remote_rm_usage[] = {
-       N_("git remote rm <name>"),
 -      "git remote remove <name>",
++      N_("git remote remove <name>"),
        NULL
  };
  
  static const char * const builtin_remote_sethead_usage[] = {
 -      "git remote set-head <name> (-a | -d | <branch>])",
 +      N_("git remote set-head <name> (-a | -d | <branch>])"),
        NULL
  };
  
  static const char * const builtin_remote_setbranches_usage[] = {
 -      "git remote set-branches <name> <branch>...",
 -      "git remote set-branches --add <name> <branch>...",
 +      N_("git remote set-branches <name> <branch>..."),
 +      N_("git remote set-branches --add <name> <branch>..."),
        NULL
  };
  
  static const char * const builtin_remote_show_usage[] = {
 -      "git remote show [<options>] <name>",
 +      N_("git remote show [<options>] <name>"),
        NULL
  };
  
  static const char * const builtin_remote_prune_usage[] = {
 -      "git remote prune [<options>] <name>",
 +      N_("git remote prune [<options>] <name>"),
        NULL
  };
  
  static const char * const builtin_remote_update_usage[] = {
 -      "git remote update [<options>] [<group> | <remote>]...",
 +      N_("git remote update [<options>] [<group> | <remote>]..."),
        NULL
  };
  
  static const char * const builtin_remote_seturl_usage[] = {
 -      "git remote set-url [--push] <name> <newurl> [<oldurl>]",
 -      "git remote set-url --add <name> <newurl>",
 -      "git remote set-url --delete <name> <url>",
 +      N_("git remote set-url [--push] <name> <newurl> [<oldurl>]"),
 +      N_("git remote set-url --add <name> <newurl>"),
 +      N_("git remote set-url --delete <name> <url>"),
        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/<name>/HEAD according to remote"),
 +                          N_("set refs/remotes/<name>/HEAD according to remote")),
                OPT_BOOLEAN('d', "delete", &opt_d,
 -                          "delete refs/remotes/<name>/HEAD"),
 +                          N_("delete refs/remotes/<name>/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;
                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);
index 222b804ce4d5314b7eaff73f51291cff3903662d,ee4c0a07aedb9c587879f7a7bbf1193a24cdd8a2..0492db924bb63b88a0e8d97cd29c60ae02fd8fcc
@@@ -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"
        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 88a21ff0bfbc166de47293c87b1ea930ba7732d7,c03ffdde1036f37d35db0d8147af20ffdd79bbb1..ccc55ebf4bf10d4782bf2ff32910ed6eeec040f6
@@@ -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" \
  )
  '
  
 +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 <<EOF
@@@ -291,7 -285,7 +291,7 @@@ test_expect_success 'prune --dry-run' 
         test_must_fail git rev-parse refs/remotes/origin/side &&
        (cd ../one &&
         git branch -m side side2) &&
 -       test_cmp expect output)
 +       test_i18ncmp expect output)
  '
  
  test_expect_success 'add --mirror && prune' '
@@@ -678,7 -672,7 +678,7 @@@ test_expect_success 'migrate a remote f
        git clone one five &&
        origin_url=$(pwd)/one &&
        (cd five &&
-        git remote rm origin &&
+        git remote remove origin &&
         mkdir -p .git/remotes &&
         cat ../remotes_origin > .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 f141f2d1da3ca8186ccc7a742bddd06f2e7f8970,7c14bc4811d53e3bd132bbbf7b72c8b97747ca69..01d0d95b4d6476f691f650cc413fa7156caee88b
@@@ -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" \
        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 &&