mirror of
https://github.com/git/git.git
synced 2024-09-08 03:50:44 +02:00
oidset: pass hash algorithm when parsing file
The `oidset_parse_file_carefully()` function implicitly depends on `the_repository` when parsing object IDs. Fix this by having callers pass in the hash algorithm to use. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
afa2c6ddc8
commit
f2c32a66f5
@ -852,6 +852,7 @@ static void build_ignorelist(struct blame_scoreboard *sb,
|
||||
oidset_clear(&sb->ignore_list);
|
||||
else
|
||||
oidset_parse_file_carefully(&sb->ignore_list, i->string,
|
||||
the_repository->hash_algo,
|
||||
peel_to_commit_oid, sb);
|
||||
}
|
||||
for_each_string_list_item(i, ignore_rev_list) {
|
||||
|
3
fsck.c
3
fsck.c
@ -205,7 +205,8 @@ void fsck_set_msg_types(struct fsck_options *options, const char *values)
|
||||
if (!strcmp(buf, "skiplist")) {
|
||||
if (equal == len)
|
||||
die("skiplist requires a path");
|
||||
oidset_parse_file(&options->skiplist, buf + equal + 1);
|
||||
oidset_parse_file(&options->skiplist, buf + equal + 1,
|
||||
the_repository->hash_algo);
|
||||
buf += len + 1;
|
||||
continue;
|
||||
}
|
||||
|
8
oidset.c
8
oidset.c
@ -48,12 +48,14 @@ void oidset_clear(struct oidset *set)
|
||||
oidset_init(set, 0);
|
||||
}
|
||||
|
||||
void oidset_parse_file(struct oidset *set, const char *path)
|
||||
void oidset_parse_file(struct oidset *set, const char *path,
|
||||
const struct git_hash_algo *algop)
|
||||
{
|
||||
oidset_parse_file_carefully(set, path, NULL, NULL);
|
||||
oidset_parse_file_carefully(set, path, algop, NULL, NULL);
|
||||
}
|
||||
|
||||
void oidset_parse_file_carefully(struct oidset *set, const char *path,
|
||||
const struct git_hash_algo *algop,
|
||||
oidset_parse_tweak_fn fn, void *cbdata)
|
||||
{
|
||||
FILE *fp;
|
||||
@ -79,7 +81,7 @@ void oidset_parse_file_carefully(struct oidset *set, const char *path,
|
||||
if (!sb.len)
|
||||
continue;
|
||||
|
||||
if (parse_oid_hex(sb.buf, &oid, &p) || *p != '\0')
|
||||
if (parse_oid_hex_algop(sb.buf, &oid, &p, algop) || *p != '\0')
|
||||
die("invalid object name: %s", sb.buf);
|
||||
if (fn && fn(&oid, cbdata))
|
||||
continue;
|
||||
|
4
oidset.h
4
oidset.h
@ -80,7 +80,8 @@ void oidset_clear(struct oidset *set);
|
||||
* are allowed. Leading whitespace and empty or white-space only lines are
|
||||
* ignored.
|
||||
*/
|
||||
void oidset_parse_file(struct oidset *set, const char *path);
|
||||
void oidset_parse_file(struct oidset *set, const char *path,
|
||||
const struct git_hash_algo *algop);
|
||||
|
||||
/*
|
||||
* Similar to the above, but with a callback which can (1) return non-zero to
|
||||
@ -89,6 +90,7 @@ void oidset_parse_file(struct oidset *set, const char *path);
|
||||
*/
|
||||
typedef int (*oidset_parse_tweak_fn)(struct object_id *, void *);
|
||||
void oidset_parse_file_carefully(struct oidset *set, const char *path,
|
||||
const struct git_hash_algo *algop,
|
||||
oidset_parse_tweak_fn fn, void *cbdata);
|
||||
|
||||
struct oidset_iter {
|
||||
|
Loading…
Reference in New Issue
Block a user