diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-04-15 14:11:43 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-04-15 14:11:43 -0700 |
| commit | d75ec4c62715fd768a56523f714fe9ecd2b1abb3 (patch) | |
| tree | 0c14da40b63504b40b957f08eaf06ae37fa8c318 /read-cache.c | |
| parent | Merge branch 'ds/fetch-config-parse-microfix' (diff) | |
| parent | builtin/add: error out when passing untracked path with -u (diff) | |
| download | git-d75ec4c62715fd768a56523f714fe9ecd2b1abb3.tar.gz git-d75ec4c62715fd768a56523f714fe9ecd2b1abb3.zip | |
Merge branch 'gt/add-u-commit-i-pathspec-check'
"git add -u <pathspec>" and "git commit [-i] <pathspec>" did not
diagnose a pathspec element that did not match any files in certain
situations, unlike "git add <pathspec>" did.
* gt/add-u-commit-i-pathspec-check:
builtin/add: error out when passing untracked path with -u
builtin/commit: error out when passing untracked path with -i
revision: optionally record matches with pathspec elements
Diffstat (limited to 'read-cache.c')
| -rw-r--r-- | read-cache.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/read-cache.c b/read-cache.c index f546cf7875..e1723ad796 100644 --- a/read-cache.c +++ b/read-cache.c @@ -3958,8 +3958,8 @@ static void update_callback(struct diff_queue_struct *q, } int add_files_to_cache(struct repository *repo, const char *prefix, - const struct pathspec *pathspec, int include_sparse, - int flags) + const struct pathspec *pathspec, char *ps_matched, + int include_sparse, int flags) { struct update_callback_data data; struct rev_info rev; @@ -3971,8 +3971,10 @@ int add_files_to_cache(struct repository *repo, const char *prefix, repo_init_revisions(repo, &rev, prefix); setup_revisions(0, NULL, &rev, NULL); - if (pathspec) + if (pathspec) { copy_pathspec(&rev.prune_data, pathspec); + rev.ps_matched = ps_matched; + } rev.diffopt.output_format = DIFF_FORMAT_CALLBACK; rev.diffopt.format_callback = update_callback; rev.diffopt.format_callback_data = &data; |
