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

Re: Make ref resolution saner

From
Linus Torvalds <torvalds@osdl.org>
Date
Sep 12, 2006, 14:41 UTC
Message-ID
<Pine.LNX.4.64.0609120739310.27779@g5.osdl.org>
In-Reply-To
<20060912053616.GA6706@coredump.intra.peff.net>
On Tue, 12 Sep 2006, Jeff King wrote:
> 
> I assume your patch is against master;
Yeah. Well, master plus my previous patches.
> it looks like there's exactly one call to resolve_ref that's in next but 
> not master. One-liner fix below.

Not quite enough. It's the same thing: wt-status.c plays games with the return value (which _used_ to be a path) in order to turn it back into a ref. But now that it's all about refs, the games are unnecessary:

Show 13 quoted lines
> diff --git a/wt-status.c b/wt-status.c
> index ec2c728..e2f49c7 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -41,7 +41,7 @@ void wt_status_prepare(struct wt_status 
>  
>  	s->is_initial = get_sha1("HEAD", sha1) ? 1 : 0;
>  
> -	head = resolve_ref(git_path("HEAD"), sha1, 0);
> +	head = resolve_ref("HEAD", sha1, 0);
>  	s->branch = head ?
>  		    strdup(head + strlen(get_git_dir()) + 1) :
>  		    NULL;

So that "strdup(head + strlen(get_git_dir()) + 1)" should now be just "strdup(head)".

		Linus
Previous: Jeff KingNext: Junio C Hamano
Message 10 of 21 in “Allow multiple "git_path()" uses”
  1. Linus TorvaldsSep 11, 2006
  2. Start handling references internally as a sorted in-memory listLinus Torvalds, Sep 11, 2006
  3. Linus TorvaldsSep 11, 2006
  4. Junio C HamanoSep 11, 2006
  5. Linus TorvaldsSep 12, 2006
  6. Chris WedgwoodSep 12, 2006
  7. Add support for negative refsLinus Torvalds, Sep 12, 2006
  8. Make ref resolution sanerLinus Torvalds, Sep 12, 2006
  9. Jeff KingSep 12, 2006
  10. Linus TorvaldsSep 12, 2006
  11. [RFC] git-pack-refs --pruneJunio C Hamano, Sep 18, 2006
  12. Linus TorvaldsSep 18, 2006
  13. Junio C HamanoSep 18, 2006
  14. Junio C HamanoSep 21, 2006
  15. 1/5 symbolit-ref: fix resolve_ref conversion.Junio C Hamano, Sep 21, 2006
  16. 2/5 Add callback data to for_each_ref() family.Junio C Hamano, Sep 21, 2006
  17. 3/5 Tell between packed, unpacked and symbolic refs.Junio C Hamano, Sep 21, 2006
  18. 4/5 pack-refs: do not pack symbolic refs.Junio C Hamano, Sep 21, 2006
  19. 5/5 git-pack-refs --pruneJunio C Hamano, Sep 21, 2006
  20. Linus TorvaldsSep 21, 2006
  21. Junio C HamanoSep 22, 2006

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.