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

Re: [PATCH 2/2] pack-refs: add fully-peeled trait

From
Jeff King <peff@peff.net>
Date
Mar 17, 2013, 05:55 UTC
Message-ID
<20130317055520.GC16070@sigill.intra.peff.net>
In-Reply-To
<7vvc8qshgm.fsf@alter.siamese.dyndns.org>
On Sat, Mar 16, 2013 at 10:50:17PM -0700, Junio C Hamano wrote:
Show 26 quoted lines
> I however wonder if the above implies it may make sense to add this
> on top?  Perhaps it is not worth it, because it makes a difference
> only to a repository with annotated tags outside refs/tags hierarchy
> and still has the packed-refs file that was created with an older
> version of Git, so we can just tell "repack with new Git" to users
> with such a repository.
> 
>  refs.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/refs.c b/refs.c
> index 7f84efd..afc4dde 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -847,8 +847,10 @@ static void read_packed_refs(FILE *f, struct ref_dir *dir)
>  		    refline[0] == '^' &&
>  		    strlen(refline) == 42 &&
>  		    refline[41] == '\n' &&
> -		    !get_sha1_hex(refline + 1, sha1))
> +		    !get_sha1_hex(refline + 1, sha1)) {
>  			hashcpy(last->u.value.peeled, sha1);
> +			last->flag |= REF_KNOWS_PEELED;
> +		}
>  	}
>  }
>  

Almost. The older version of Git would not have written those peel lines in the first place. So yes, if we saw such a file, we could assume the peel lines are valid. But nobody has ever generated that (with the except of git between my two patches).

I do think it may be worth doing, though, just because it makes the handling of the flag more obvious; somebody reading it later would wonder "hey, shouldn't we be setting REF_KNOWS_PEELED here?", and it is simple and harmless to just do it, rather than confusing a later reader.

I'll re-roll in a second to incorporate the comments from Michael.
-Peff
Previous: Junio C HamanoNext: Jeff King
Message 9 of 19 in “peel-ref optimization fixes”
  1. 0/2 peel-ref optimization fixesJeff King, Mar 16, 2013
  2. 1/2 pack-refs: write peeled entry for non-tagsJeff King, Mar 16, 2013
  3. Michael HaggertyMar 16, 2013
  4. Jeff KingMar 17, 2013
  5. 2/2 pack-refs: add fully-peeled traitJeff King, Mar 16, 2013
  6. Michael HaggertyMar 16, 2013
  7. Jeff KingMar 17, 2013
  8. Junio C HamanoMar 17, 2013
  9. Jeff KingMar 17, 2013
  10. 0/4 peel-ref optimization fixesJeff King, Mar 17, 2013
  11. 1/4 avoid segfaults on parse_object failureJeff King, Mar 17, 2013
  12. 2/4 use parse_object_or_die instead of die("bad object")Jeff King, Mar 17, 2013
  13. 3/4 pack-refs: write peeled entry for non-tagsJeff King, Mar 17, 2013
  14. 4/4 pack-refs: add fully-peeled traitJeff King, Mar 17, 2013
  15. Junio C HamanoMar 17, 2013
  16. 4/4 pack-refs: add fully-peeled traitJeff King, Mar 18, 2013
  17. Junio C HamanoMar 18, 2013
  18. Michael HaggertyMar 18, 2013
  19. Junio C HamanoMar 18, 2013

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.