aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/patch-id.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/patch-id.c')
-rw-r--r--builtin/patch-id.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/builtin/patch-id.c b/builtin/patch-id.c
index f540d8daa7..d26e9d0c1e 100644
--- a/builtin/patch-id.c
+++ b/builtin/patch-id.c
@@ -3,6 +3,7 @@
#include "builtin.h"
#include "config.h"
#include "diff.h"
+#include "environment.h"
#include "gettext.h"
#include "hash.h"
#include "hex.h"
@@ -70,7 +71,7 @@ static size_t get_one_patchid(struct object_id *next_oid, struct object_id *resu
int before = -1, after = -1;
int diff_is_binary = 0;
char pre_oid_str[GIT_MAX_HEXSZ + 1], post_oid_str[GIT_MAX_HEXSZ + 1];
- git_hash_ctx ctx;
+ struct git_hash_ctx ctx;
the_hash_algo->init_fn(&ctx);
oidclr(result, the_repository->hash_algo);
@@ -85,7 +86,7 @@ static size_t get_one_patchid(struct object_id *next_oid, struct object_id *resu
!skip_prefix(line, "From ", &p) &&
starts_with(line, "\\ ") && 12 < strlen(line)) {
if (verbatim)
- the_hash_algo->update_fn(&ctx, line, strlen(line));
+ git_hash_update(&ctx, line, strlen(line));
continue;
}
@@ -104,10 +105,10 @@ static size_t get_one_patchid(struct object_id *next_oid, struct object_id *resu
starts_with(line, "Binary files")) {
diff_is_binary = 1;
before = 0;
- the_hash_algo->update_fn(&ctx, pre_oid_str,
- strlen(pre_oid_str));
- the_hash_algo->update_fn(&ctx, post_oid_str,
- strlen(post_oid_str));
+ git_hash_update(&ctx, pre_oid_str,
+ strlen(pre_oid_str));
+ git_hash_update(&ctx, post_oid_str,
+ strlen(post_oid_str));
if (stable)
flush_one_hunk(result, &ctx);
continue;
@@ -165,7 +166,7 @@ static size_t get_one_patchid(struct object_id *next_oid, struct object_id *resu
/* Add line to hash algo (possibly removing whitespace) */
len = verbatim ? strlen(line) : remove_space(line);
patchlen += len;
- the_hash_algo->update_fn(&ctx, line, len);
+ git_hash_update(&ctx, line, len);
}
if (!found_next)
@@ -235,7 +236,7 @@ int cmd_patch_id(int argc,
OPT_END()
};
- git_config(git_patch_id_config, &config);
+ repo_config(the_repository, git_patch_id_config, &config);
/* verbatim implies stable */
if (config.verbatim)
@@ -254,7 +255,7 @@ int cmd_patch_id(int argc,
* the code that computes patch IDs to always use SHA1.
*/
if (!the_hash_algo)
- repo_set_hash_algo(the_repository, GIT_HASH_SHA1);
+ repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);
generate_id_list(opts ? opts > 1 : config.stable,
opts ? opts == 3 : config.verbatim);