about summary refs log tree commit diff
path: root/third_party/git/csum-file.h
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/git/csum-file.h')
-rw-r--r--third_party/git/csum-file.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/third_party/git/csum-file.h b/third_party/git/csum-file.h
index a98b1eee53f4..f9cbd317fbbc 100644
--- a/third_party/git/csum-file.h
+++ b/third_party/git/csum-file.h
@@ -42,6 +42,15 @@ void hashflush(struct hashfile *f);
 void crc32_begin(struct hashfile *);
 uint32_t crc32_end(struct hashfile *);
 
+/*
+ * Returns the total number of bytes fed to the hashfile so far (including ones
+ * that have not been written out to the descriptor yet).
+ */
+static inline off_t hashfile_total(struct hashfile *f)
+{
+	return f->total + f->offset;
+}
+
 static inline void hashwrite_u8(struct hashfile *f, uint8_t data)
 {
 	hashwrite(f, &data, sizeof(data));