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

[PATCH v2 06/10] bulk-checkin.c: convert to use struct object_id

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Mar 13, 2015, 23:39 UTC
Message-ID
<1426289976-568060-7-git-send-email-sandals@crustytoothpaste.net>
In-Reply-To
<1426289976-568060-1-git-send-email-sandals@crustytoothpaste.net>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 bulk-checkin.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/bulk-checkin.c b/bulk-checkin.c
index 0c4b8a7..c80e503 100644
--- a/bulk-checkin.c
+++ b/bulk-checkin.c
@@ -24,7 +24,7 @@ static struct bulk_checkin_state {
 
 static void finish_bulk_checkin(struct bulk_checkin_state *state)
 {
-	unsigned char sha1[20];
+	struct object_id oid;
 	struct strbuf packname = STRBUF_INIT;
 	int i;
 
@@ -36,11 +36,11 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)
 		unlink(state->pack_tmp_name);
 		goto clear_exit;
 	} else if (state->nr_written == 1) {
-		sha1close(state->f, sha1, CSUM_FSYNC);
+		sha1close(state->f, oid.hash, CSUM_FSYNC);
 	} else {
-		int fd = sha1close(state->f, sha1, 0);
-		fixup_pack_header_footer(fd, sha1, state->pack_tmp_name,
-					 state->nr_written, sha1,
+		int fd = sha1close(state->f, oid.hash, 0);
+		fixup_pack_header_footer(fd, oid.hash, state->pack_tmp_name,
+					 state->nr_written, oid.hash,
 					 state->offset);
 		close(fd);
 	}
@@ -48,7 +48,7 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)
 	strbuf_addf(&packname, "%s/pack/pack-", get_object_directory());
 	finish_tmp_packfile(&packname, state->pack_tmp_name,
 			    state->written, state->nr_written,
-			    &state->pack_idx_opts, sha1);
+			    &state->pack_idx_opts, oid.hash);
 	for (i = 0; i < state->nr_written; i++)
 		free(state->written[i]);
 
-- 
2.2.1.209.g41e5f3a
Previous: brian m. carlsonNext: brian m. carlson
Message 7 of 12 in “Use a structure for object IDs.”
  1. 00/10 Use a structure for object IDs.brian m. carlson, Mar 13, 2015
  2. 01/10 Define a structure for object IDs.brian m. carlson, Mar 13, 2015
  3. 02/10 Define utility functions for object IDs.brian m. carlson, Mar 13, 2015
  4. 03/10 bisect.c: convert leaf functions to use struct object_idbrian m. carlson, Mar 13, 2015
  5. 04/10 archive.c: convert to use struct object_idbrian m. carlson, Mar 13, 2015
  6. 05/10 zip: use GIT_SHA1_HEXSZ for trailersbrian m. carlson, Mar 13, 2015
  7. 06/10 bulk-checkin.c: convert to use struct object_idbrian m. carlson, Mar 13, 2015
  8. 07/10 diff: convert struct combine_diff_path to object_idbrian m. carlson, Mar 13, 2015
  9. 08/10 commit: convert parts to struct object_idbrian m. carlson, Mar 13, 2015
  10. 09/10 patch-id: convert to use struct object_idbrian m. carlson, Mar 13, 2015
  11. 10/10 apply: convert threeway_stage to object_idbrian m. carlson, Mar 13, 2015
  12. brian m. carlsonMar 14, 2015

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.