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

Re: [PATCH] builtin/branch.c: remove useless branch_get

From
Jeff King <peff@peff.net>
Date
Oct 15, 2018, 17:17 UTC
Message-ID
<20181015171707.GB1301@sigill.intra.peff.net>
In-Reply-To
<20181015140839.4925-1-taoqy@ls-a.me>
On Mon, Oct 15, 2018 at 10:08:39PM +0800, Tao Qingyun wrote:
> Signed-off-by: Tao Qingyun <taoqy@ls-a.me>

The commit message should describe the "why" here. I gave some reasoning nearby in:

  https://public-inbox.org/git/20181015171417.GA1301@sigill.intra.peff.net/

From your initial message, it sounds like this might also be fixing a bug ("confusing that getting a branch before it has created"). Can you describe that (and ideally show the fix with a test)?

Show 13 quoted lines
> diff --git a/builtin/branch.c b/builtin/branch.c
> index c396c41533..2367703034 100644
> --- a/builtin/branch.c
> +++ b/builtin/branch.c
> @@ -809,11 +809,6 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
>  		git_config_set_multivar(buf.buf, NULL, NULL, 1);
>  		strbuf_release(&buf);
>  	} else if (argc > 0 && argc <= 2) {
> -		struct branch *branch = branch_get(argv[0]);
> -
> -		if (!branch)
> -			die(_("no such branch '%s'"), argv[0]);
> -

From what I can tell, the patch itself _is_ an improvement. I just think we need to explain why for the record.

-Peff
Previous: Tao QingyunNext: Tao Qingyun
Message 4 of 8 in “[Question] builtin/branch.c”
  1. Tao QingyunOct 13, 2018
  2. Ævar Arnfjörð BjarmasonOct 14, 2018
  3. builtin/branch.c: remove useless branch_getTao Qingyun, Oct 15, 2018
  4. Jeff KingOct 15, 2018
  5. builtin/branch.c: remove useless branch_getTao Qingyun, Oct 16, 2018
  6. Jeff KingOct 17, 2018
  7. Tao QingyunOct 17, 2018
  8. Jeff KingOct 15, 2018

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.