Re: [PATCH] commit-tree: add missing --gpg-sign flag
- From
Brandon Richardson <brandon1024.br@gmail.com>
- Date
- Jan 18, 2019, 15:06 UTC
- Message-ID
- <CAETBDP7BcENA3Cjbj6y_5L3WGHx1wmMwkagx_CuRr5gAz9wYVA@mail.gmail.com>
- In-Reply-To
- <CAN0heSrE3mOnjyrzw76Gp6wBuq62wgM6jBV1u+vn3b6ySm0EDQ@mail.gmail.com>
Hi Martin,
Thanks again for your comments and patience, I appreciate it :-)
Show 6 quoted lines
> > - if (skip_prefix(arg, "-S", &sign_commit))
> > + if(!strcmp(arg, "--gpg-sign")) {
> > + skip_prefix(arg, "--gpg-sign", &sign_commit);
>
> I personally find this a bit convoluted, compared to just assigning "".
> Maybe there are reasons for doing it this way that I don't see?You're right, it is a bit convoluted. The reason I opted to do it this way is because I wanted to reuse part of "arg" by simply advancing the pointer, but this is silly and wastes cycles, and after thinking about it a bit more I realized how silly it was.
Show 5 quoted lines
> All of the commands above are suffixed with "&&" which means that the > shell only keeps executing as long as the commands succeed. If any of > those 20-30 commands fails, the shell will jump out of the &&-chain and > land ... at this line you're adding. If that one succeeds, the test will > be reported as succeeding. So please add a "&&" to the "10" line.
Woops, I can't believe I missed that.
Show 13 quoted lines
> All of that said ... if I add the missing "&&" and run your test on the > *old* implementation, it still succeeds. The reason is that I grepped > for the "best" place to put this, and directed you to a part of the test > suite where it might be a bit too easy to copy existing code and end > up with something non-ideal. Sorry about that. :-( > > What happens is that git commit-tree reports "fatal: Not a valid object > name --gpg-sign", then we go on to happily execute `git tag > eleventh-signed` where we've just substituted the empty string produced > by git commit-tree. The verifications will succeed, because there's > already a signature there... (BTW, the verifications happen further > down, so you'll want to add "eleventh-signed" to the list of tags > there.)
No need to apologize, I jumped the gun. I'm going to look into putting together a more robust test for this change.
Brandon