@@ -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) {
@@ -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;
}
@@ -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;
@@ -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 {
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> --- builtin/blame.c | 1 + fsck.c | 3 ++- oidset.c | 8 +++++--- oidset.h | 4 +++- 4 files changed, 11 insertions(+), 5 deletions(-)