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

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

From
Tao Qingyun <taoqy@ls-a.me>
Date
Oct 17, 2018, 12:58 UTC
Message-ID
<20181017125818.1872-1-taoqy@ls-a.me>
In-Reply-To
<20181017083906.GC31932@sigill.intra.peff.net>
Show 26 quoted lines
> > branch_get sometimes returns current_branch, which can be NULL (e.g., if
> > you're on a detached HEAD). Try:
> > 
> >   $ git branch HEAD
> >   fatal: no such branch 'HEAD'
> > 
> >   $ git branch ''
> >   fatal: no such branch ''
> > 
> > However, it seems weird that we'd check those cases here (and provide
> > such lousy messages). And indeed, dropping that and letting us
> > eventually hit create_branch() gives a much better message:
> > 
> >   $ git branch HEAD
> >   fatal: 'HEAD' is not a valid branch name.
> > 
> >   $ git branch ''
> >   fatal: '' is not a valid branch name.
> 
> This explanation is perfect, of course. ;)
> 
> I still wondered if you had another motivation hinted at in your
> original mail, though (some weirdness with running branch_get early).
> It's OK if there isn't one, but I just want to make sure we capture all
> of the details.
> 
Yes, this explanation is perfect. ;)
> Other than that question, the patch looks good to me.
> 
> -Peff
Previous: Jeff KingNext: Jeff King
Message 7 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.