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

[PATCH 2/6] test-match-trees: convert to use struct object_id

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Apr 17, 2016, 23:10 UTC
Message-ID
<1460934641-435791-3-git-send-email-sandals@crustytoothpaste.net>
In-Reply-To
<1460934641-435791-1-git-send-email-sandals@crustytoothpaste.net>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 test-match-trees.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/test-match-trees.c b/test-match-trees.c
index 4dad7095..41aff841 100644
--- a/test-match-trees.c
+++ b/test-match-trees.c
@@ -3,24 +3,24 @@
 
 int main(int ac, char **av)
 {
-	unsigned char hash1[20], hash2[20], shifted[20];
+	struct object_id hash1, hash2, shifted;
 	struct tree *one, *two;
 
 	setup_git_directory();
 
-	if (get_sha1(av[1], hash1))
+	if (get_oid(av[1], &hash1))
 		die("cannot parse %s as an object name", av[1]);
-	if (get_sha1(av[2], hash2))
+	if (get_oid(av[2], &hash2))
 		die("cannot parse %s as an object name", av[2]);
-	one = parse_tree_indirect(hash1);
+	one = parse_tree_indirect(hash1.hash);
 	if (!one)
 		die("not a tree-ish %s", av[1]);
-	two = parse_tree_indirect(hash2);
+	two = parse_tree_indirect(hash2.hash);
 	if (!two)
 		die("not a tree-ish %s", av[2]);
 
-	shift_tree(one->object.oid.hash, two->object.oid.hash, shifted, -1);
-	printf("shifted: %s\n", sha1_to_hex(shifted));
+	shift_tree(one->object.oid.hash, two->object.oid.hash, shifted.hash, -1);
+	printf("shifted: %s\n", oid_to_hex(&shifted));
 
 	exit(0);
 }
-- 
2.8.0.rc3.226.g39d4020
Previous: brian m. carlsonNext: brian m. carlson
Message 3 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.