mbox series

[v2,0/3] commit, add: error out when passing untracked path

Message ID 20240329205649.1483032-2-shyamthakkar001@gmail.com (mailing list archive)
Headers show
Series commit, add: error out when passing untracked path | expand

Message

Ghanshyam Thakkar March 29, 2024, 8:56 p.m. UTC
Fix 'commit -i' and 'add -u', which expect known paths, not erroring
out when passing untracked paths.

The first patch introduces a new parameter to add_files_to_cache() and
run_diff_files() to optionally collect pathspec matching info for use
in reporting error. And the second and third patch use this parameter
to collect pathspec matching info and report error when passing
untracked paths to 'git commit -i' and 'git add -u' respectively.

Ghanshyam Thakkar (3):
  optionally collect pathspec matching info
  builtin/commit: error out when passing untracked path with -i
  builtin/add: error out when passing untracked path with -u

 add-interactive.c                     |  2 +-
 builtin/add.c                         | 13 ++++++++++---
 builtin/checkout.c                    |  3 ++-
 builtin/commit.c                      |  9 ++++++++-
 builtin/diff-files.c                  |  2 +-
 builtin/diff.c                        |  2 +-
 builtin/merge.c                       |  2 +-
 builtin/stash.c                       |  2 +-
 builtin/submodule--helper.c           |  4 ++--
 diff-lib.c                            |  5 +++--
 diff.h                                |  3 ++-
 read-cache-ll.h                       |  4 ++--
 read-cache.c                          |  6 +++---
 t/t2200-add-update.sh                 |  6 ++++++
 t/t7501-commit-basic-functionality.sh | 16 +---------------
 wt-status.c                           |  6 +++---
 16 files changed, 47 insertions(+), 38 deletions(-)