revision: optionally record matches with pathspec elements
commit86829f3f3ea62853a4a632637ade6de94a1f4c7c
authorJunio C Hamano <gitster@pobox.com>
Wed, 3 Apr 2024 18:14:48 +0000 (3 23:44 +0530)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Apr 2024 21:55:21 +0000 (3 14:55 -0700)
tree9b50facfa74dd050a84ef13207d4e4f0b69c5d18
parentd6fd04375f9196f8b203d442f235bd96a1a068cc
revision: optionally record matches with pathspec elements

Unlike "git add" and other end-user facing commands, where it is
diagnosed as an error to give a pathspec with an element that does
not match any path, the diff machinery does not care if some
elements of the pathspec do not match.  Given that the diff
machinery is heavily used in pathspec-limited "git log" machinery,
and it is common for a path to come and go while traversing the
project history, this is usually a good thing.

However, in some cases we would want to know if all the pathspec
elements matched.  For example, "git add -u <pathspec>" internally
uses the machinery used by "git diff-files" to decide contents from
what paths to add to the index, and as an end-user facing command,
"git add -u" would want to report an unmatched pathspec element.

Add a new .ps_matched member next to the .prune_data member in
"struct rev_info" so that we can optionally keep track of the use of
.prune_data pathspec elements that can be inspected by the caller.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/add.c
builtin/checkout.c
builtin/commit.c
diff-lib.c
read-cache-ll.h
read-cache.c
revision.h