Merge branch 'doc-style/for-next' of git://repo.or.cz/git/trast
[gitweb.git] / builtin-branch.c
index d2a35fe00d97bd95dc7a18740599e1165ecf46f1..a28a13986d11ebfecd11a206d1b7a1fb626865db 100644 (file)
@@ -608,6 +608,8 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                OPT__VERBOSE(&verbose),
                OPT_SET_INT('t', "track",  &track, "set up tracking mode (see git-pull(1))",
                        BRANCH_TRACK_EXPLICIT),
+               OPT_SET_INT( 0, "set-upstream",  &track, "change upstream info",
+                       BRANCH_TRACK_OVERRIDE),
                OPT_BOOLEAN( 0 , "color",  &branch_use_color, "use colored output"),
                OPT_SET_INT('r', NULL,     &kinds, "act on remote-tracking branches",
                        REF_REMOTE_BRANCH),
@@ -682,10 +684,12 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                rename_branch(head, argv[0], rename > 1);
        else if (rename && (argc == 2))
                rename_branch(argv[0], argv[1], rename > 1);
-       else if (argc <= 2)
+       else if (argc <= 2) {
+               if (kinds != REF_LOCAL_BRANCH)
+                       die("-a and -r options to 'git branch' do not make sense with a branch name");
                create_branch(head, argv[0], (argc == 2) ? argv[1] : head,
                              force_create, reflog, track);
-       else
+       else
                usage_with_options(builtin_branch_usage, options);
 
        return 0;