threads / patch / 7572

patch, 8 partsgit-repack --max-pack-size: make close optional in sha1close()

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

## tl;dr

One message between Apr 8, 2007 and Apr 8, 2007. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Dana How· Apr 8, 2007, 23:21 UTC · lore

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

Signed-off-by: Dana How <how@deathvalley.cswitch.com>
---
 csum-file.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Show changes to csum-file.c +3 −0
diff --git a/csum-file.c b/csum-file.c
index b7174c6..e1ff769 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.1.89.g8abf0

← back to recent threads