diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-07-02 18:59:00 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-07-02 18:59:00 +0200 |
commit | 7b472da91541d672ee220896a3a7fd4508c378f3 (patch) | |
tree | 2687a29530b4a8b50c7f99a394cc5b69f06d7adb /diff.c | |
parent | Merge branch 'ew/cat-file-unbuffered-tests' (diff) | |
parent | hex: guard declarations with `USE_THE_REPOSITORY_VARIABLE` (diff) | |
download | git-7b472da91541d672ee220896a3a7fd4508c378f3.tar.xz git-7b472da91541d672ee220896a3a7fd4508c378f3.zip |
Merge branch 'ps/use-the-repository'
A CPP macro USE_THE_REPOSITORY_VARIABLE is introduced to help
transition the codebase to rely less on the availability of the
singleton the_repository instance.
* ps/use-the-repository:
hex: guard declarations with `USE_THE_REPOSITORY_VARIABLE`
t/helper: remove dependency on `the_repository` in "proc-receive"
t/helper: fix segfault in "oid-array" command without repository
t/helper: use correct object hash in partial-clone helper
compat/fsmonitor: fix socket path in networked SHA256 repos
replace-object: use hash algorithm from passed-in repository
protocol-caps: use hash algorithm from passed-in repository
oidset: pass hash algorithm when parsing file
http-fetch: don't crash when parsing packfile without a repo
hash-ll: merge with "hash.h"
refs: avoid include cycle with "repository.h"
global: introduce `USE_THE_REPOSITORY_VARIABLE` macro
hash: require hash algorithm in `empty_tree_oid_hex()`
hash: require hash algorithm in `is_empty_{blob,tree}_oid()`
hash: make `is_null_oid()` independent of `the_repository`
hash: convert `oidcmp()` and `oideq()` to compare whole hash
global: ensure that object IDs are always padded
hash: require hash algorithm in `oidread()` and `oidclr()`
hash: require hash algorithm in `hasheq()`, `hashcmp()` and `hashclr()`
hash: drop (mostly) unused `is_empty_{blob,tree}_sha1()` functions
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1,6 +1,9 @@ /* * Copyright (C) 2005 Junio C Hamano */ + +#define USE_THE_REPOSITORY_VARIABLE + #include "git-compat-util.h" #include "abspath.h" #include "base85.h" @@ -4596,7 +4599,7 @@ static void diff_fill_oid_info(struct diff_filespec *one, struct index_state *is if (!one->oid_valid) { struct stat st; if (one->is_stdin) { - oidclr(&one->oid); + oidclr(&one->oid, the_repository->hash_algo); return; } if (lstat(one->path, &st) < 0) @@ -4606,7 +4609,7 @@ static void diff_fill_oid_info(struct diff_filespec *one, struct index_state *is } } else - oidclr(&one->oid); + oidclr(&one->oid, the_repository->hash_algo); } static void strip_prefix(int prefix_length, const char **namep, const char **otherp) @@ -6440,7 +6443,7 @@ static int diff_get_patch_id(struct diff_options *options, struct object_id *oid the_hash_algo->init_fn(&ctx); memset(&data, 0, sizeof(struct patch_id_t)); data.ctx = &ctx; - oidclr(oid); + oidclr(oid, the_repository->hash_algo); for (i = 0; i < q->nr; i++) { xpparam_t xpp; |