git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rm: Accept --staged as a synonym of --cached
@ 2014-02-22  5:30 Ryan Schmitt
  0 siblings, 0 replies; only message in thread
From: Ryan Schmitt @ 2014-02-22  5:30 UTC (permalink / raw)
  To: git; +Cc: Ryan Schmitt, Ryan Schmitt

From: Ryan Schmitt <rschmitt@u.rochester.edu>

This makes git-rm more consistent with git-diff, which also accepts
--staged as a synonym of --cached.

Signed-off-by: Ryan Schmitt <rschmitt@pobox.com>
---
 Documentation/git-rm.txt | 2 +-
 builtin/rm.c             | 1 +
 t/t3600-rm.sh            | 6 ++++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git Documentation/git-rm.txt Documentation/git-rm.txt
index f1efc11..8635e67 100644
--- Documentation/git-rm.txt
+++ Documentation/git-rm.txt
@@ -58,7 +58,7 @@ OPTIONS
 --cached::
 	Use this option to unstage and remove paths only from the index.
 	Working tree files, whether modified or not, will be
-	left alone.
+	left alone. --staged is a synonym for --cached.
 
 --ignore-unmatch::
 	Exit with a zero status even if no files matched.
diff --git builtin/rm.c builtin/rm.c
index 960634d..a88697b 100644
--- builtin/rm.c
+++ builtin/rm.c
@@ -269,6 +269,7 @@ static struct option builtin_rm_options[] = {
 	OPT__DRY_RUN(&show_only, N_("dry run")),
 	OPT__QUIET(&quiet, N_("do not list removed files")),
 	OPT_BOOL( 0 , "cached",         &index_only, N_("only remove from the index")),
+	OPT_BOOL( 0 , "staged",         &index_only, N_("synonym for --cached")),
 	OPT__FORCE(&force, N_("override the up-to-date check")),
 	OPT_BOOL('r', NULL,             &recursive,  N_("allow recursive removal")),
 	OPT_BOOL( 0 , "ignore-unmatch", &ignore_unmatch,
diff --git t/t3600-rm.sh t/t3600-rm.sh
index 3d30581..c32dbf4 100755
--- t/t3600-rm.sh
+++ t/t3600-rm.sh
@@ -72,6 +72,12 @@ test_expect_success \
      git rm --cached -f foo'
 
 test_expect_success \
+    'Test that git rm --staged foo is synonymous with git rm --cached foo' \
+    'echo content > foo
+     git add foo
+     git rm --staged foo'
+
+test_expect_success \
     'Post-check that foo exists but is not in index after git rm foo' \
     '[ -f foo ] && test_must_fail git ls-files --error-unmatch foo'
 
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-02-22  5:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-22  5:30 [PATCH] rm: Accept --staged as a synonym of --cached Ryan Schmitt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).