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

Re: [PATCH 4/6] Convert struct name_entry to use struct object_id.

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 19, 2016, 23:02 UTC
Message-ID
<xmqqshyhxkw1.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1460934641-435791-5-git-send-email-sandals@crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 6 quoted lines
> @@ -314,7 +314,7 @@ static int threeway_callback(int n, unsigned long mask, unsigned long dirmask, s
>  	}
>  
>  	if (same_entry(entry+0, entry+1)) {
> -		if (entry[2].sha1 && !S_ISDIR(entry[2].mode)) {
> +		if (entry[2].oid->hash && !S_ISDIR(entry[2].mode)) {
Thanks for a warning in the cover letter.

"if (entry[2].oid && !S_ISDIR(entry[2].mode)" would be a faithful conversion, wouldn't it?

threeway-callback is called from the unpack-trees codepath and tree-walk.c::traverse_trees() is what prepared these entries.

An entry[] which is an N-element array represents the traversal state of walking N trees in parallel, and the callback function like this one gets an entry that has been tree-walk.c::entry_clear()ed (i.e. memset to full of '\0's) for a tree that lacks the corresponding path.

Try to do merge-tree of two trees, where there is a path that we did not change since common ancestor, while the other side removed it, and you would hit this if () statement, I would think.

Previous: brian m. carlsonNext: brian m. carlson
Message 6 of 10 in “object_id Part 3”
  1. 0/6 object_id Part 3brian m. carlson, Apr 17, 2016
  2. 1/6 Introduce a get_oid function.brian m. carlson, Apr 17, 2016
  3. 2/6 test-match-trees: convert to use struct object_idbrian m. carlson, Apr 17, 2016
  4. 3/6 match-trees: convert shift_tree and shift_tree_by to object_idbrian m. carlson, Apr 17, 2016
  5. 4/6 Convert struct name_entry to use struct object_id.brian m. carlson, Apr 17, 2016
  6. Junio C HamanoApr 19, 2016
  7. brian m. carlsonApr 19, 2016
  8. Junio C HamanoApr 20, 2016
  9. 5/6 tree-walk: convert tree_entry_extract to struct object_idbrian m. carlson, Apr 17, 2016
  10. 6/6 match-trees: convert several leaf functions to struct object_idbrian m. carlson, Apr 17, 2016

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.