@@ -561,8 +561,8 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
561561 OPT__QUIET (& quiet , N_ ("suppress informational messages" )),
562562 OPT_SET_INT ('t' , "track" , & track , N_ ("set up tracking mode (see git-pull(1))" ),
563563 BRANCH_TRACK_EXPLICIT ),
564- OPT_SET_INT ( 0 , "set-upstream" , & track , N_ ("change upstream info " ),
565- BRANCH_TRACK_OVERRIDE ) ,
564+ { OPTION_SET_INT , 0 , "set-upstream" , & track , NULL , N_ ("do not use " ),
565+ PARSE_OPT_NOARG | PARSE_OPT_HIDDEN , NULL , BRANCH_TRACK_OVERRIDE } ,
566566 OPT_STRING ('u' , "set-upstream-to" , & new_upstream , N_ ("upstream" ), N_ ("change the upstream info" )),
567567 OPT_BOOL (0 , "unset-upstream" , & unset_upstream , N_ ("Unset the upstream info" )),
568568 OPT__COLOR (& branch_use_color , N_ ("use colored output" )),
@@ -759,8 +759,6 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
759759 strbuf_release (& buf );
760760 } else if (argc > 0 && argc <= 2 ) {
761761 struct branch * branch = branch_get (argv [0 ]);
762- int branch_existed = 0 , remote_tracking = 0 ;
763- struct strbuf buf = STRBUF_INIT ;
764762
765763 if (!strcmp (argv [0 ], "HEAD" ))
766764 die (_ ("it does not make sense to create 'HEAD' manually" ));
@@ -772,28 +770,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
772770 die (_ ("-a and -r options to 'git branch' do not make sense with a branch name" ));
773771
774772 if (track == BRANCH_TRACK_OVERRIDE )
775- fprintf (stderr , _ ("The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to\n" ));
776-
777- strbuf_addf (& buf , "refs/remotes/%s" , branch -> name );
778- remote_tracking = ref_exists (buf .buf );
779- strbuf_release (& buf );
773+ die (_ ("the '--set-upstream' option is no longer supported. Please use '--track' or '--set-upstream-to' instead." ));
780774
781- branch_existed = ref_exists (branch -> refname );
782775 create_branch (argv [0 ], (argc == 2 ) ? argv [1 ] : head ,
783776 force , reflog , 0 , quiet , track );
784777
785- /*
786- * We only show the instructions if the user gave us
787- * one branch which doesn't exist locally, but is the
788- * name of a remote-tracking branch.
789- */
790- if (argc == 1 && track == BRANCH_TRACK_OVERRIDE &&
791- !branch_existed && remote_tracking ) {
792- fprintf (stderr , _ ("\nIf you wanted to make '%s' track '%s', do this:\n\n" ), head , branch -> name );
793- fprintf (stderr , " git branch -d %s\n" , branch -> name );
794- fprintf (stderr , " git branch --set-upstream-to %s\n" , branch -> name );
795- }
796-
797778 } else
798779 usage_with_options (builtin_branch_usage , options );
799780
0 commit comments