git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3] branch: introduce --set-upstream-to

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 10, 2012, 17:26 UTC
Message-ID
<7vehojil2g.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1341939181-8962-2-git-send-email-cmn@elego.de>
Carlos Martín Nieto <cmn@elego.de> writes:
Show 31 quoted lines
> diff --git a/builtin/branch.c b/builtin/branch.c
> index 0e060f2..c886fc0 100644
> --- a/builtin/branch.c
> +++ b/builtin/branch.c
> @@ -713,6 +713,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
>  	int verbose = 0, abbrev = -1, detached = 0;
>  	int reflog = 0, edit_description = 0;
>  	int quiet = 0;
> +	const char *new_upstream = NULL;
>  	enum branch_track track;
>  	int kinds = REF_LOCAL_BRANCH;
>  	struct commit_list *with_commit = NULL;
> @@ -726,6 +727,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
>  			BRANCH_TRACK_EXPLICIT),
>  		OPT_SET_INT( 0, "set-upstream",  &track, "change upstream info",
>  			BRANCH_TRACK_OVERRIDE),
> +		OPT_STRING('u', "set-upstream-to", &new_upstream, "upstream", "change the upstream info"),
>  		OPT__COLOR(&branch_use_color, "use colored output"),
>  		OPT_SET_INT('r', "remotes",     &kinds, "act on remote-tracking branches",
>  			REF_REMOTE_BRANCH),
> @@ -794,10 +796,10 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
>  	argc = parse_options(argc, argv, prefix, options, builtin_branch_usage,
>  			     0);
>  
> -	if (!delete && !rename && !edit_description && argc == 0)
> +	if (!delete && !rename && !edit_description && !new_upstream && argc == 0)
>  		list = 1;
>  
> -	if (!!delete + !!rename + !!force_create + !!list > 1)
> +	if (!!delete + !!rename + !!force_create + !!list + !!new_upstream > 1)
>  		usage_with_options(builtin_branch_usage, options);
It probably is an error to have track and new_upstream together.

The remainder of [Patch 1/3] looked entirely sensible, including the proposed log message (modulo missing sign-off).

Thanks.
Previous: Matthieu MoyNext: Jonathan Nieder
Message 4 of 29 in “A better way of handling upstream information in git-branch”
  1. 0/3 A better way of handling upstream information in git-branchCarlos Martín Nieto, Jul 10, 2012
  2. 1/3 branch: introduce --set-upstream-toCarlos Martín Nieto, Jul 10, 2012
  3. Matthieu MoyJul 10, 2012
  4. Junio C HamanoJul 10, 2012
  5. Jonathan NiederJul 10, 2012
  6. Junio C HamanoJul 10, 2012
  7. Jonathan NiederJul 10, 2012
  8. Junio C HamanoJul 10, 2012
  9. Jonathan NiederJul 10, 2012
  10. Junio C HamanoJul 10, 2012
  11. Jonathan NiederJul 10, 2012
  12. Junio C HamanoJul 11, 2012
  13. Jonathan NiederJul 11, 2012
  14. Miles BaderJul 12, 2012
  15. Junio C HamanoJul 12, 2012
  16. 2/3 branch: suggest how to undo a --set-upstream when given one branchCarlos Martín Nieto, Jul 10, 2012
  17. Matthieu MoyJul 10, 2012
  18. Carlos Martín NietoJul 11, 2012
  19. Junio C HamanoJul 10, 2012
  20. Carlos Martín NietoJul 11, 2012
  21. Jonathan NiederJul 10, 2012
  22. Junio C HamanoJul 10, 2012
  23. Jonathan NiederJul 10, 2012
  24. Carlos Martín NietoJul 11, 2012
  25. 3/3 branch: add --unset-upstream optionCarlos Martín Nieto, Jul 10, 2012
  26. Junio C HamanoJul 10, 2012
  27. Carlos Martín NietoJul 11, 2012
  28. Junio C HamanoJul 11, 2012
  29. Carlos Martín NietoJul 12, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.