diff mbox series

[v3,08/44] pkt-line: add a member for hash algorithm

Message ID 20200619175601.569856-9-sandals@crustytoothpaste.net (mailing list archive)
State New, archived
Headers show
Series SHA-256 part 2/3: protocol functionality | expand

Commit Message

brian m. carlson June 19, 2020, 5:55 p.m. UTC
Add a member for the hash algorithm currently in use to the packet
reader so it can parse references correctly.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 pkt-line.c | 1 +
 pkt-line.h | 3 +++
 2 files changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/pkt-line.c b/pkt-line.c
index 8f9bc68ee2..844c253ccd 100644
--- a/pkt-line.c
+++ b/pkt-line.c
@@ -490,6 +490,7 @@  void packet_reader_init(struct packet_reader *reader, int fd,
 	reader->buffer_size = sizeof(packet_buffer);
 	reader->options = options;
 	reader->me = "git";
+	reader->hash_algo = &hash_algos[GIT_HASH_SHA1];
 }
 
 enum packet_read_status packet_reader_read(struct packet_reader *reader)
diff --git a/pkt-line.h b/pkt-line.h
index 5b373fe4cd..8c90daa59e 100644
--- a/pkt-line.h
+++ b/pkt-line.h
@@ -177,6 +177,9 @@  struct packet_reader {
 
 	unsigned use_sideband : 1;
 	const char *me;
+
+	/* hash algorithm in use */
+	const struct git_hash_algo *hash_algo;
 };
 
 /*