Commit Diff


commit - 21ca60e03cc4a786580e7eb26aeb00221a091b5f
commit + c214ca4f02e2e2212414948d8b31e426510b81ba
blob - 67c89a7abe4949fa112ddc68388c7ac88006368e
blob + e8c7b30d40cff93877de27625b5c08b7104940eb
--- gotd/repo_read.c
+++ gotd/repo_read.c
@@ -887,6 +887,11 @@ repo_read_main(const char *title, const char *repo_pat
 		    "bare git repository required");
 		goto done;
 	}
+	if (got_repo_get_object_format(repo_read.repo) != GOT_HASH_SHA1) {
+		err = got_error_msg(GOT_ERR_NOT_IMPL,
+		    "sha256 object IDs unsupported in network protocol");
+		goto done;
+	}
 
 	got_repo_temp_fds_set(repo_read.repo, temp_fds);
 
blob - 979d980b5f2f473086fcf0fbb3cf6c3715d21692
blob + ee4eb5cff4be8f41919997710c1933d9d70f9d98
--- gotd/repo_write.c
+++ gotd/repo_write.c
@@ -2418,6 +2418,11 @@ repo_write_main(const char *title, const char *repo_pa
 		    "bare git repository required");
 		goto done;
 	}
+	if (got_repo_get_object_format(repo_write.repo) != GOT_HASH_SHA1) {
+		err = got_error_msg(GOT_ERR_NOT_IMPL,
+		    "sha256 object IDs unsupported in network protocol");
+		goto done;
+	}
 
 	got_repo_temp_fds_set(repo_write.repo, temp_fds);
 
blob - 772c35e98bb5ed0874ea08d5d0d4437001a7480e
blob + f3b8ccf6b334a2f80606e4decf5ad9c40a484574
--- gotd/session_read.c
+++ gotd/session_read.c
@@ -853,6 +853,11 @@ session_read_main(const char *title, const char *repo_
 		    "bare git repository required");
 		goto done;
 	}
+	if (got_repo_get_object_format(gotd_session.repo) != GOT_HASH_SHA1) {
+		err = got_error_msg(GOT_ERR_NOT_IMPL,
+		    "sha256 object IDs unsupported in network protocol");
+		goto done;
+	}
 
 	got_repo_temp_fds_set(gotd_session.repo, temp_fds);
 
blob - 3e379f9e08e2cc6c3649d68f36f5aff4245910dc
blob + 35c0f7ee43ce29e0246b866883fa599ac9f1f81c
--- gotd/session_write.c
+++ gotd/session_write.c
@@ -1702,6 +1702,11 @@ session_write_main(const char *title, const char *repo
 		    "bare git repository required");
 		goto done;
 	}
+	if (got_repo_get_object_format(gotd_session.repo) != GOT_HASH_SHA1) {
+		err = got_error_msg(GOT_ERR_NOT_IMPL,
+		    "sha256 object IDs unsupported in network protocol");
+		goto done;
+	}
 
 	got_repo_temp_fds_set(gotd_session.repo, temp_fds);
 
blob - ba7667f6986fa052b7c6f36d5d7ff65c5a87bff8
blob + 02b0eae943c002b268adbb1836eda2ac7816e499
--- lib/fetch.c
+++ lib/fetch.c
@@ -135,6 +135,10 @@ got_fetch_pack(struct got_object_id **pack_hash, struc
 	char *progress = NULL;
 
 	*pack_hash = NULL;
+
+	if (repo && got_repo_get_object_format(repo) != GOT_HASH_SHA1)
+		return got_error_fmt(GOT_ERR_NOT_IMPL,
+		    "sha256 object IDs unsupported in network protocol");
 
 	/*
 	 * Prevent fetching of references that won't make any
blob - a1473da8306f07e7f95614c32166941e804ca5f1
blob + b0a5cf8b33408dae6140de910a3ec547a0b06559
--- lib/send.c
+++ lib/send.c
@@ -363,6 +363,10 @@ got_send_pack(const char *remote_name, struct got_path
 
 	TAILQ_INIT(&have_refs);
 	TAILQ_INIT(&their_refs);
+
+	if (got_repo_get_object_format(repo) != GOT_HASH_SHA1)
+		return got_error_fmt(GOT_ERR_NOT_IMPL,
+		    "sha256 object IDs unsupported in network protocol");
 
 	TAILQ_FOREACH(pe, branch_names, entry) {
 		const char *branchname = pe->path;