summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorLibravatar Matheus Tavares <matheus.bernardino@usp.br>2021-04-08 17:41:28 -0300
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-04-08 14:18:03 -0700
commitd5f4b8260f623d6fdef36d5eaa8a0c2350390472 (patch)
tree60de9c3ff1ee4936bbb0e8eb231731ea52de4c29 /Documentation
parentadd: warn when asked to update SKIP_WORKTREE entries (diff)
downloadtgif-d5f4b8260f623d6fdef36d5eaa8a0c2350390472.tar.xz
rm: honor sparse checkout patterns
`git add` refrains from adding or updating index entries that are outside the current sparse checkout, but `git rm` doesn't follow the same restriction. This is somewhat counter-intuitive and inconsistent. So make `rm` honor the sparsity rules and advise on how to remove SKIP_WORKTREE entries just like `add` does. Also add some tests for the new behavior. Suggested-by: Elijah Newren <newren@gmail.com> Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/config/advice.txt5
-rw-r--r--Documentation/git-rm.txt4
2 files changed, 6 insertions, 3 deletions
diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt
index 851b83cf30..8b2849ff7b 100644
--- a/Documentation/config/advice.txt
+++ b/Documentation/config/advice.txt
@@ -120,6 +120,7 @@ advice.*::
Advice shown if a user runs the add command without providing
the pathspec parameter.
updateSparsePath::
- Advice shown when linkgit:git-add[1] is asked to update index
- entries outside the current sparse checkout.
+ Advice shown when either linkgit:git-add[1] or linkgit:git-rm[1]
+ is asked to update index entries outside the current sparse
+ checkout.
--
diff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt
index ab750367fd..26e9b28470 100644
--- a/Documentation/git-rm.txt
+++ b/Documentation/git-rm.txt
@@ -23,7 +23,9 @@ branch, and no updates to their contents can be staged in the index,
though that default behavior can be overridden with the `-f` option.
When `--cached` is given, the staged content has to
match either the tip of the branch or the file on disk,
-allowing the file to be removed from just the index.
+allowing the file to be removed from just the index. When
+sparse-checkouts are in use (see linkgit:git-sparse-checkout[1]),
+`git rm` will only remove paths within the sparse-checkout patterns.
OPTIONS