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

[PATCH v2 00/11] Consolidate ref parsing code

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Oct 15, 2014, 15:06 UTC
Message-ID
<1413385583-4872-1-git-send-email-mhagger@alum.mit.edu>

This is a rif on Duy's oldish patch series [1]. I started reviewing his patch series, but found that some of his patches did multiple things, making it harder to review. I started pulling it apart into smaller changes to aid my review, and I guess I got carried away :-/

As far as I know, Duy isn't actively working on this, so I hope my reroll is not unwelcome.

As far as I can tell, Duy's patch series was correct aside from a couple of minor cosmetic blemishes [2]. So if you want to accept Duy's original patch series, I hereby endorse it.

This version does the following things beyond Duy's original:
* Split commits up into smaller pieces.
* Get rid of the MAXREFLEN limitation.
* Rename the parse_ref() parameter from "ref" to "refname".
* Inline resolve_gitlink_packed_ref() and handle_missing_loose_ref().
* Invert the "if" statement for dealing with symbolic references in
  parse_ref() to make the logic flow more linear.
* Change a couple of "while" loops to "do..while".
* Change resolve_refdup() to return strbuf_detach(&buf, NULL) instead
  of buf.buf directly (as suggested by Eric Sunshine).

I retained Duy as author on commits that are derived straightforwardly from his. I hope I haven't broken any of them. I am calling this patch series v2 because I propose it as a successor to Duy's version.

[1] http://thread.gmane.org/gmane.comp.version-control.git/254203/focus=254203
[2] Aside from the couple of things pointed out on the mailing list,
    * The parse_ref() parameter should be named "refname" instead of
      "ref", for consistency with other refs code.
    * The local variable "ref = result->buf" in resolve_ref() just
      obscures things and should be inlined.
Michael Haggerty (5):
  resolve_ref_unsafe(): reverse the logic of the symref conditional
  handle_missing_loose_ref(): inline function
  resolve_gitlink_ref_recursive(): drop arbitrary refname length limit
  resove_gitlink_packed_ref(): inline function
  resolve_gitlink_ref(): remove redundant test
Nguyễn Thái Ngọc Duy (6):
  strbuf_read_file(): preserve errno on failure
  handle_missing_loose_ref(): return an int
  resolve_ref_unsafe(): use skip_prefix() to skip over "ref:"
  refs.c: refactor resolve_ref_unsafe() to use strbuf internally
  refs.c: move ref parsing code out of resolve_ref()
  refs.c: rewrite resolve_gitlink_ref() to use parse_ref()
 cache.h  |  12 +++
 refs.c   | 371 +++++++++++++++++++++++++++++++--------------------------------
 strbuf.c |   7 +-
 3 files changed, 200 insertions(+), 190 deletions(-)
-- 
2.1.1
Next: Michael Haggerty
Message 1 of 16 in “Consolidate ref parsing code”
  1. 00/11 Consolidate ref parsing codeMichael Haggerty, Oct 15, 2014
  2. 01/11 strbuf_read_file(): preserve errno on failureMichael Haggerty, Oct 15, 2014
  3. 02/11 handle_missing_loose_ref(): return an intMichael Haggerty, Oct 15, 2014
  4. 03/11 resolve_ref_unsafe(): reverse the logic of the symref conditionalMichael Haggerty, Oct 15, 2014
  5. 04/11 resolve_ref_unsafe(): use skip_prefix() to skip over "ref:"Michael Haggerty, Oct 15, 2014
  6. 05/11 refs.c: refactor resolve_ref_unsafe() to use strbuf internallyMichael Haggerty, Oct 15, 2014
  7. 06/11 refs.c: move ref parsing code out of resolve_ref()Michael Haggerty, Oct 15, 2014
  8. 07/11 handle_missing_loose_ref(): inline functionMichael Haggerty, Oct 15, 2014
  9. 08/11 resolve_gitlink_ref_recursive(): drop arbitrary refname length limitMichael Haggerty, Oct 15, 2014
  10. 09/11 refs.c: rewrite resolve_gitlink_ref() to use parse_ref()Michael Haggerty, Oct 15, 2014
  11. 10/11 resove_gitlink_packed_ref(): inline functionMichael Haggerty, Oct 15, 2014
  12. 11/11 resolve_gitlink_ref(): remove redundant testMichael Haggerty, Oct 15, 2014
  13. Junio C HamanoOct 16, 2014
  14. Junio C HamanoOct 16, 2014
  15. Michael HaggertyOct 16, 2014
  16. Duy NguyenOct 16, 2014

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.