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

Re: [PATCH] ref-filter: treat CRLF as same as LF in find_subpos

From
Junio C Hamano <gitster@pobox.com>
Date
May 23, 2017, 02:01 UTC
Message-ID
<xmqq37bwnxg4.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170522201212.uuas26n6npdebsxg@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> I suspect that's more work because we'd need to refactor pretty.c a bit
> to make the right functionality available. But the end result would be
> much more maintainable.

I actually think the entire codeflow of "find positions and length of threeparts" using find_subpos() and then "copy the length bytes starting position for C_{SUB,BODY,SIG,LINES,...}" must be rethought, if the behavior of pretty.c::pretty_print_commit() is to be matched. With the current code, %(contents:body) and other atoms that are handled in ref-filter.c::grab_sub_body_contents() keep trailing whitespaces on their lines with the current code that copies length bytes starting the position using xmemdupz(). There need to be some code that loses these trailing whiltespaces in the copied result.

While I do not claim that refactoring and reusing code from pretty.c is the only viable way forward, it is clear to me that a patch that updates find_subpos() and changes nothing else falls short X-<.

Previous: Junio C HamanoNext: Junio C Hamano
Message 13 of 21 in “[Bug] git branch -v has problems with carriage returns”
  1. Animi VulpisMay 16, 2017
  2. Atousa DupratMay 19, 2017
  3. Animi VulpisMay 19, 2017
  4. Johannes SixtMay 20, 2017
  5. Atousa DupratMay 31, 2017
  6. Stefan BellerMay 31, 2017
  7. Junio C HamanoJun 1, 2017
  8. ref-filter: treat CRLF as same as LF in find_subposDOAN Tran Cong Danh, May 21, 2017
  9. Junio C HamanoMay 22, 2017
  10. DOAN Tran Cong DanhMay 22, 2017
  11. Jeff KingMay 22, 2017
  12. Junio C HamanoMay 23, 2017
  13. Junio C HamanoMay 23, 2017
  14. Junio C HamanoMay 23, 2017
  15. ref-filter: treat CRLF as same as LF in find_subposDOAN Tran Cong Danh, May 21, 2017
  16. ref-filter: trim end whitespace in subjectDOAN Tran Cong Danh, May 22, 2017
  17. ref-filter: trim end whitespace in subjectDOAN Tran Cong Danh, May 22, 2017
  18. Johannes SixtMay 22, 2017
  19. Jeff KingMay 22, 2017
  20. Johannes SixtMay 22, 2017
  21. Atousa DupratMay 19, 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.