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

Re: [PATCH] branch: give better message when no names specified for rename

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 1, 2013, 02:51 UTC
Message-ID
<7vfvzbm08m.fsf@alter.siamese.dyndns.org>
In-Reply-To
<00E97900-F00D-455F-A3EB-52D0A3CF5CF6@JonathonMah.com>
Jonathon Mah <me@JonathonMah.com> writes:
Show 29 quoted lines
> Signed-off-by: Jonathon Mah <me@JonathonMah.com>
> ---
>
> The previous message was incorrect when not enough arguments were
> specified:
>     
>     $ git branch -m 
>     fatal: too many branches for a rename operation
>
> I changed to "branch name required" instead of "new branch name required" in the hope that existing translations can be used.
>
>  builtin/branch.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/branch.c b/builtin/branch.c
> index 00d17d2..580107f 100644
> --- a/builtin/branch.c
> +++ b/builtin/branch.c
> @@ -880,7 +880,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
>  		if (edit_branch_description(branch_name))
>  			return 1;
>  	} else if (rename) {
> -		if (argc == 1)
> +		if (!argc)
> +			die(_("branch name required"));
> +		else if (argc == 1)
>  			rename_branch(head, argv[0], rename > 1);
>  		else if (argc == 2)
>  			rename_branch(argv[0], argv[1], rename > 1);
Obviously a good thing to do; thanks.
Previous: Duy NguyenNext: Junio C Hamano
Message 3 of 4 in “branch: give better message when no names specified for rename”
  1. branch: give better message when no names specified for renameJonathon Mah, Mar 31, 2013
  2. Duy NguyenMar 31, 2013
  3. Junio C HamanoApr 1, 2013
  4. Junio C HamanoApr 1, 2013

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.