1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-25 04:16:09 +02:00

Merge branch 'jc/blame-ignore-fix'

"git blame --ignore-revs-file=<file>" learned to ignore a
non-existent object name in the input, instead of complaining.

* jc/blame-ignore-fix:
  blame: silently ignore invalid ignore file objects
This commit is contained in:
Junio C Hamano 2020-11-18 13:32:54 -08:00
commit b4e245a17a
2 changed files with 5 additions and 4 deletions

View File

@ -72,9 +72,10 @@ 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' ||
(fn && fn(&oid, cbdata)))
if (parse_oid_hex(sb.buf, &oid, &p) || *p != '\0')
die("invalid object name: %s", sb.buf);
if (fn && fn(&oid, cbdata))
continue;
oidset_insert(set, &oid);
}
if (ferror(fp))

View File

@ -39,10 +39,10 @@ test_expect_success 'validate --ignore-rev' '
test_must_fail git blame --ignore-rev X^{tree} file
'
# Ensure bogus --ignore-revs-file requests are caught
# Ensure bogus --ignore-revs-file requests are silently accepted
test_expect_success 'validate --ignore-revs-file' '
git rev-parse X^{tree} >ignore_x &&
test_must_fail git blame --ignore-revs-file ignore_x file
git blame --ignore-revs-file ignore_x file
'
for I in X XT