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

Re: [RFC/PATCHv8 00/10] git notes

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 19, 2010, 18:10 UTC
Message-ID
<7vk4ve9dad.fsf@alter.siamese.dyndns.org>
In-Reply-To
<81b0412b1001190754m37ed01b0nd93b318d77d88a75@mail.gmail.com>
Alex Riesen <raa.lkml@gmail.com> writes:
Show 13 quoted lines
> On Fri, Nov 20, 2009 at 11:46, Junio C Hamano <gitster@pobox.com> wrote:
>> @@ -716,7 +719,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
>>                if (!strcmp(arg, "-"))
>>                        arg = "@{-1}";
>>
>> -               if (get_sha1(arg, rev)) {
>> +               if (get_sha1_mb(arg, rev)) {
>>                        if (has_dash_dash)          /* case (1) */
>>                                die("invalid reference: %s", arg);
>>                        if (!patch_mode &&
>
> This is a bit of a problem on Windows, as the arg (eventually containing
> something like "master..."), will be passed to resolve_ref below.
I don't see "resolve_ref below"; do you mean this part?
		/* we can't end up being in (2) anymore, eat the argument */
		argv++;
		argc--;
		new.name = arg;
		if ((new.commit = lookup_commit_reference_gently(rev, 1))) {
			setup_branch_path(&new);
			if (resolve_ref(new.path, rev, 1, NULL))
				new.commit = lookup_commit_reference(rev);
			else
				new.path = NULL;
			parse_commit(new.commit);
			source_tree = new.commit->tree;
		} else
			source_tree = parse_tree_indirect(rev);

It is primarily to tell "git checkout master" and "git checkout master^0" apart (the latter must detach HEAD). IOW, it is testing if you gave the "name" of the branch, or something that yields the commit object name that happens to be at the tip of the branch. So the call to resolve_ref() is very relevant.

> Now, Windows,
> being the piece of shit it is, will lie and tell that a file
> "refs/heads/master..."
> exists and be same as "refs/heads/master".

Meh; then windows users cannot use "git checkout A..." syntax (they can still use "git checkout A...HEAD", I presume).

This is not a problem specific to three-dots, but if you give the function "refs/heads/master.." it would also get "exists" back, no? You could teach resolve_ref() about windows (namely, the filesystem may lie about anything that ends with a series of dots).

> This breaks "checkout to merge base" on Windows and t2012 in particular.
> BTW, why should the arg be run through resolve_ref at all if
> get_sha1(_mb) has succeeded?
> Isn't the commit already resolved by lookup_commit_reference_gently?

l-c-r-g makes sure rev (that is raw object name SHA-1) points at a commit and doesn't have anything to do with the name.

Previous: Alex RiesenNext: Junio C Hamano
Message 22 of 26 in “[RFC/PATCHv8 00/10] git notes”
  1. Johan HerlandNov 20, 2009
  2. 01/10 Notes API: get_commit_notes() -> format_note() + remove the commit restrictionJohan Herland, Nov 20, 2009
  3. 02/10 Notes API: init_notes(): Initialize the notes tree from the given notes refJohan Herland, Nov 20, 2009
  4. 03/10 Notes API: add_note(): Add note objects to the internal notes tree structureJohan Herland, Nov 20, 2009
  5. 04/10 Notes API: get_note(): Return the note annotating the given objectJohan Herland, Nov 20, 2009
  6. 05/10 Notes API: for_each_note(): Traverse the entire notes tree with a callbackJohan Herland, Nov 20, 2009
  7. 06/10 Notes API: Allow multiple concurrent notes trees with new struct notes_treeJohan Herland, Nov 20, 2009
  8. 07/10 Refactor notes concatenation into a flexible interface for combining notesJohan Herland, Nov 20, 2009
  9. 08/10 fast-import: Proper notes tree manipulation using the notes APIJohan Herland, Nov 20, 2009
  10. Shawn O. PearceNov 26, 2009
  11. Johan HerlandNov 26, 2009
  12. Shawn O. PearceNov 26, 2009
  13. 09/10 Rename t9301 to t9350, to make room for more fast-import testsJohan Herland, Nov 20, 2009
  14. 10/10 Add more testcases to test fast-import of notesJohan Herland, Nov 20, 2009
  15. Junio C HamanoNov 20, 2009
  16. Johan HerlandNov 20, 2009
  17. Nanako ShiraishiNov 20, 2009
  18. Johannes SchindelinNov 20, 2009
  19. Junio C HamanoNov 20, 2009
  20. Junio C HamanoNov 20, 2009
  21. Alex RiesenJan 19, 2010
  22. Junio C HamanoJan 19, 2010
  23. Junio C HamanoJan 20, 2010
  24. Johannes SixtJan 20, 2010
  25. Junio C HamanoJan 20, 2010
  26. Alex RiesenJan 20, 2010

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.