summaryrefslogtreecommitdiffstats
path: root/add-patch.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-06-14 08:50:18 +0200
committerJunio C Hamano <gitster@pobox.com>2024-06-14 19:26:33 +0200
commit7abbca0e7470d1f7b6973933358c17022c6ee8a1 (patch)
treeca407e02f2c2e189f1e250ae7b8e964dbb409210 /add-patch.c
parenthash: require hash algorithm in `is_empty_{blob,tree}_oid()` (diff)
downloadgit-7abbca0e7470d1f7b6973933358c17022c6ee8a1.tar.xz
git-7abbca0e7470d1f7b6973933358c17022c6ee8a1.zip
hash: require hash algorithm in `empty_tree_oid_hex()`
The `empty_tree_oid_hex()` function use `the_repository` to derive the hash function that shall be used. Require callers to pass in the hash algorithm to get rid of this implicit dependency. While at it, remove the unused `empty_blob_oid_hex()` function. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'add-patch.c')
-rw-r--r--add-patch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/add-patch.c b/add-patch.c
index 814de57c4a..86181770f2 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -420,7 +420,7 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
/* could be on an unborn branch */
!strcmp("HEAD", s->revision) &&
repo_get_oid(the_repository, "HEAD", &oid) ?
- empty_tree_oid_hex() : s->revision);
+ empty_tree_oid_hex(the_repository->hash_algo) : s->revision);
}
color_arg_index = args.nr;
/* Use `--no-color` explicitly, just in case `diff.color = always`. */