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

[PATCH 3/8] git-repack --max-pack-size: make close optional in sha1close()

From
DHDana How <danahow@gmail.com>
Date
Apr 30, 2007, 23:20 UTC
Message-ID
<463679AE.7020106@gmail.com>

sha1close() flushes, writes checksum, and closes. The 2nd can be suppressed; make the last suppressible as well.

Signed-off-by: Dana L. How <danahow@gmail.com>
---
 csum-file.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/csum-file.c b/csum-file.c
index 7c806ad..993c899 100644
--- a/csum-file.c
+++ b/csum-file.c
@@ -35,7 +35,10 @@ int sha1close(struct sha1file *f, unsigned char *result, int update)
 	if (offset) {
 		SHA1_Update(&f->ctx, f->buffer, offset);
 		sha1flush(f, offset);
+		f->offset = 0;
 	}
+	if (update < 0)
+		return 0;	/* only want to flush (no checksum write, no close) */
 	SHA1_Final(f->buffer, &f->ctx);
 	if (result)
 		hashcpy(result, f->buffer);
-- 
1.5.2.rc0.766.gba60-dirty
Next: Shawn O. Pearce
Message 1 of 3 in “git-repack --max-pack-size: make close optional in sha1close()”
  1. 3/8 git-repack --max-pack-size: make close optional in sha1close()Dana How, Apr 30, 2007
  2. Shawn O. PearceMay 1, 2007
  3. Dana HowMay 1, 2007

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.