From: Pratyush Yadav Date: Thu, 29 Aug 2019 20:30:37 GMT Subject: Re: [PATCH 1/1] checkout: add simple check for 'git checkout -b' 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: > 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 ' and expects > > > > What if the user ran 'git checkout -b'? 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" > 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