add: include magic part of pathspec on --refresh error
When `git add --refresh <pathspec>` doesn't find any matches for the given pathspec, it prints an error message using the `match` field of the `struct pathspec_item`. However, this field doesn't contain the magic part of the pathspec. Instead, let's use the `original` field. Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
a5828ae6b5
commit
4e95698349
@ -187,7 +187,7 @@ static void refresh(int verbose, const struct pathspec *pathspec)
|
|||||||
for (i = 0; i < pathspec->nr; i++) {
|
for (i = 0; i < pathspec->nr; i++) {
|
||||||
if (!seen[i])
|
if (!seen[i])
|
||||||
die(_("pathspec '%s' did not match any files"),
|
die(_("pathspec '%s' did not match any files"),
|
||||||
pathspec->items[i].match);
|
pathspec->items[i].original);
|
||||||
}
|
}
|
||||||
free(seen);
|
free(seen);
|
||||||
}
|
}
|
||||||
|
@ -196,6 +196,12 @@ test_expect_success 'git add --refresh with pathspec' '
|
|||||||
grep baz actual
|
grep baz actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'git add --refresh correctly reports no match error' "
|
||||||
|
echo \"fatal: pathspec ':(icase)nonexistent' did not match any files\" >expect &&
|
||||||
|
test_must_fail git add --refresh ':(icase)nonexistent' 2>actual &&
|
||||||
|
test_cmp expect actual
|
||||||
|
"
|
||||||
|
|
||||||
test_expect_success POSIXPERM,SANITY 'git add should fail atomically upon an unreadable file' '
|
test_expect_success POSIXPERM,SANITY 'git add should fail atomically upon an unreadable file' '
|
||||||
git reset --hard &&
|
git reset --hard &&
|
||||||
date >foo1 &&
|
date >foo1 &&
|
||||||
|
Loading…
Reference in New Issue
Block a user