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

Re: [PATCH 1/1] checkout: add simple check for 'git checkout -b'

From
Pratyush Yadav <me@yadavpratyush.com>
Date
Aug 29, 2019, 20:30 UTC
Message-ID
<20190829203037.vzxuaxpsghbdc6vl@yadavpratyush.com>
In-Reply-To
<206819d0-8066-e8e8-8967-8a1db05eea26@gmail.com>
On 29/08/19 04:07PM, Derrick Stolee wrote:
Show 17 quoted lines
> On 8/29/2019 2:54 PM, Phillip Wood wrote:
> > Hi Stolee
> > 
> > On 29/08/2019 18:01, Derrick Stolee via GitGitGadget wrote:
> >> +   
> >> +    if (argc == 3 && !strcmp(argv[1], "-b")) {
> >> +        /*
> >> +         * User ran 'git checkout -b <branch>' and expects
> > 
> > What if the user ran 'git checkout -b<branch>'? Then argc == 2.
> 
> Good catch. I'm tempted to say "don't do that" to keep this
> simple. They won't have incorrect results, just slower than
> the "with space" option.
> 
> However, if there is enough interest in correcting the "-b<branch>"
> case, then I can make another attempt at this.
 
You can probably do this with:
  !strncmp(argv[1], "-b", 2)
The difference is so little, might as well do it IMO.
-- 
Regards,
Pratyush Yadav
Previous: Derrick StoleeNext: Pratyush Yadav
Message 6 of 11 in “checkout: add simple check for 'git checkout -b'”
  1. 0/1 checkout: add simple check for 'git checkout -b'Derrick Stolee via GitGitGadget, Aug 29, 2019
  2. 1/1 checkout: add simple check for 'git checkout -b'Derrick Stolee via GitGitGadget, Aug 29, 2019
  3. Elijah NewrenAug 29, 2019
  4. Phillip WoodAug 29, 2019
  5. Derrick StoleeAug 29, 2019
  6. Pratyush YadavAug 29, 2019
  7. Pratyush YadavAug 29, 2019
  8. Elijah NewrenAug 30, 2019
  9. Taylor BlauAug 30, 2019
  10. Derrick StoleeAug 30, 2019
  11. Junio C HamanoAug 30, 2019

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.