Re: [PATCH 2/3] branch: suggest how to undo a --set-upstream when given one branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Nieder <jrnieder@xxxxxxxxx> writes:

> Message should go on stderr and be guarded with an advice option (see
> advice.c).
>
> Like this:
>
> 	const char *arg;
>
> 	...
> 	if (argc != 1 || !advice_old_fashioned_set_upstream)
> 		return 0; /* ok. */
>
> 	arg = argv[0];
> 	advise("If you wanted to make '%s' track '%s', do this:",
> 							head, arg);
> 	if (branch_existed)
> 		advise(" $ git branch --set-upstream-to='%s' '%s'",
> 			old_upstream, arg);
> 	else
> 		advise(" $ git branch -d '%s'", arg);
> 	advise(" $ git branch --set-upstream-to='%s'", arg);
>
> If an argument contains single-quotes, the quoting will be wrong, but
> that's probably not worth worrying about.

In principle, I would agree that this is a kind of thing that falls
into the "advice" categiry, but with the fact that we plan to
deprecate "--set-upstream", combined with the fact that [PATCH 1/3]
introduced the new option --set-upstream-to together with a short
and sweet -u synonym already at this point in the series, I think it
is better to leave them emitted unconditionally to the standard
error stream, in order to train users away from using the old option
that has its arguments wrong (the option does not take an argument
it should, and makes the command line to look as if it takes two
branch arguments in the wrong order).

Actually, we should probably add the deprecation warning in this
commit.


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]