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

Re: [PATCH] interpret-trailers: obey scissors lines

From
Jeff King <peff@peff.net>
Date
May 15, 2017, 03:33 UTC
Message-ID
<20170515033333.g25hdr4fgzuay536@sigill.intra.peff.net>
In-Reply-To
<xmqqpofax0af.fsf@gitster.mtv.corp.google.com>
On Mon, May 15, 2017 at 12:32:24PM +0900, Junio C Hamano wrote:
Show 46 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > On Mon, May 15, 2017 at 11:12:03AM +0900, Junio C Hamano wrote:
> >
> >> >> diff --git a/builtin/commit.c b/builtin/commit.c
> >> >> index 2de5f6cc6..2ce9c339d 100644
> >> >> --- a/builtin/commit.c
> >> >> +++ b/builtin/commit.c
> >> >> @@ -1735,7 +1735,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
> >> >>  
> >> >>  	if (verbose || /* Truncate the message just before the diff, if any. */
> >> >>  	    cleanup_mode == CLEANUP_SCISSORS)
> >> >> -		wt_status_truncate_message_at_cut_line(&sb);
> >> >> +		strbuf_setlen(&sb,
> >> >> +			      wt_status_last_nonscissors_index(sb.buf, sb.len));
> >> >
> >> > This hunk surprised me at first (that we would need to touch commit.c at
> >> > all), but the refactoring makes sense.
> >> 
> >> This still surprises me.  If the problem is in interpret-trailers,
> >> why do we even need to touch cmd_commit()?  If GIT_EDITOR returns us
> >
> > The behavior of cmd_commit() shouldn't be changed by the patch. But to
> > make the interface suitable for the new callsite (which doesn't have a
> > strbuf, but a ptr/len buffer), it needs to return the length rather than
> > shortening the strbuf. We could leave in place:
> >
> >   void wt_status_truncate_message_at_cut_line(struct strbuf *sb)
> >   {
> > 	strbuf_setlen(sb, wt_status_last_nonscissors_index(sb->buf, sb->len));
> >   }
> >
> > but it would only have this one caller.
> >
> > If I were doing the patch series, I'd probably have split that
> > refactoring into its own patch and discussed the reason separately. I
> > waffled on whether or not to ask Brian to do so (and obviously didn't in
> > the end).
> 
> I suspect that you would have just explained "since there is only
> one caller, let's open-code it" in the log message, without making
> this a two-patch series, and that would also have been perfectly
> understandable (and in this case probably preferrable).
> 
> So the patch text would be OK; it was surprising to have the change
> without being explained, that's all.

Yeah, I'd agree it could use a better explanation in the commit message. I was surprised to see it, too. Since both of us were surprised, that's probably a good indicator. :)

-Peff
Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 19 of 24 in “interpret-trailers + commit -v bugfix”
  1. 0/3 interpret-trailers + commit -v bugfixBrian Malehorn, May 12, 2017
  2. 2/3 commit.c: add is_scissors_lineBrian Malehorn, May 12, 2017
  3. Jeff KingMay 12, 2017
  4. Jeff KingMay 12, 2017
  5. Brian MalehornMay 14, 2017
  6. interpret-trailers: obey scissors linesBrian Malehorn, May 14, 2017
  7. Jeff KingMay 14, 2017
  8. Brian MalehornMay 14, 2017
  9. interpret-trailers: obey scissors linesBrian Malehorn, May 14, 2017
  10. Junio C HamanoMay 15, 2017
  11. Junio C HamanoMay 15, 2017
  12. Brian MalehornMay 16, 2017
  13. interpret-trailers: honor the cut lineBrian Malehorn, May 16, 2017
  14. Junio C HamanoMay 16, 2017
  15. Jeff KingMay 15, 2017
  16. Junio C HamanoMay 15, 2017
  17. Jeff KingMay 15, 2017
  18. Junio C HamanoMay 15, 2017
  19. Jeff KingMay 15, 2017
  20. Ævar Arnfjörð BjarmasonMay 14, 2017
  21. 1/3 mailinfo.c: is_scissors_line ends on newlineBrian Malehorn, May 12, 2017
  22. Jeff KingMay 12, 2017
  23. 3/3 commit.c: skip scissors when computing trailersBrian Malehorn, May 12, 2017
  24. Jeff KingMay 12, 2017

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.