{"thread":{"id":"7572","subject":"[PATCH 3/8] git-repack --max-pack-size: make close optional in sha1close()","startedAt":"2007-04-08T23:21:38Z","lastAt":"2007-04-08T23:21:38Z","messageCount":1,"participants":["Dana How"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"38891","messageId":"46197902.1060302@gmail.com","threadId":"7572","inReplyTo":null,"subject":"[PATCH 3/8] git-repack --max-pack-size: make close optional in sha1close()","fromName":"Dana How","fromEmail":"danahow@gmail.com","sentAt":"2007-04-08T23:21:38Z","receivedAt":"2007-04-08T23:21:38Z","isPatch":true,"sender":{"key":"danahow@gmail.com","avatar":null},"body":"\nsha1close() flushes, writes checksum, and closes.\nThe second can be suppressed; make the last suppressible as well.\n\nSigned-off-by: Dana How <how@deathvalley.cswitch.com>\n---\n csum-file.c |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/csum-file.c b/csum-file.c\nindex b7174c6..e1ff769 100644\n--- a/csum-file.c\n+++ b/csum-file.c\n@@ -35,7 +35,10 @@ int sha1close(struct sha1file *f, unsigned char *result, int update)\n \tif (offset) {\n \t\tSHA1_Update(&f->ctx, f->buffer, offset);\n \t\tsha1flush(f, offset);\n+\t\tf->offset = 0;\n \t}\n+\tif (update < 0)\n+\t\treturn 0;\t/* only want to flush (no checksum write, no close) */\n \tSHA1_Final(f->buffer, &f->ctx);\n \tif (result)\n \t\thashcpy(result, f->buffer);\n-- \n1.5.1.89.g8abf0\n"}]}