git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Ginzel <hans@matfyz.cz>
To: git@vger.kernel.org
Subject: git rm --recursive
Date: Wed, 18 Nov 2015 16:06:38 +0100	[thread overview]
Message-ID: <20151118150637.GA49061@artax.karlin.mff.cuni.cz> (raw)

Hello!

I have added the --recursive alias for the -r option to the rm command.

H.
From 83f197151c04164b0dfd4d127e72439aebaf8b71 Mon Sep 17 00:00:00 2001
From: Hans Ginzel <hans@matfyz.cz>
Date: Wed, 18 Nov 2015 15:44:56 +0100
Subject: [PATCH] builtin: rm: add --recursive to be consistent with GNU rm


diff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt
index f1efc11..0ab1cd4 100644
--- a/Documentation/git-rm.txt
+++ b/Documentation/git-rm.txt
@@ -47,6 +47,7 @@ OPTIONS
 	by the command.
 
 -r::
+--recursive::
         Allow recursive removal when a leading directory name is
         given.
 
diff --git a/builtin/rm.c b/builtin/rm.c
index 80b972f..311b4da 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -269,7 +269,7 @@ static struct option builtin_rm_options[] = {
 	OPT__QUIET(&quiet, N_("do not list removed files")),
 	OPT_BOOL( 0 , "cached",         &index_only, N_("only remove from the index")),
 	OPT__FORCE(&force, N_("override the up-to-date check")),
-	OPT_BOOL('r', NULL,             &recursive,  N_("allow recursive removal")),
+	OPT_BOOL('r', "recursive",      &recursive,  N_("allow recursive removal")),
 	OPT_BOOL( 0 , "ignore-unmatch", &ignore_unmatch,
 				N_("exit with a zero status even if nothing matched")),
 	OPT_END(),
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index 9d90d2c..d7b73f9 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -207,12 +207,25 @@ test_expect_success 'Recursive with -r but dirty' '
 	test -f frotz/nitfol
 '
 
+test_expect_success 'Recursive with --recursive but dirty' '
+	echo qfwfq >>frotz/nitfol &&
+	test_must_fail git rm --recursive frotz &&
+	test -d frotz &&
+	test -f frotz/nitfol
+'
+
 test_expect_success 'Recursive with -r -f' '
 	git rm -f -r frotz &&
 	! test -f frotz/nitfol &&
 	! test -d frotz
 '
 
+test_expect_success 'Recursive with --recursive -f' '
+	git rm -f --recursive frotz &&
+	! test -f frotz/nitfol &&
+	! test -d frotz
+'
+
 test_expect_success 'Remove nonexistent file returns nonzero exit status' '
 	test_must_fail git rm nonexistent
 '
-- 
1.9.1

             reply	other threads:[~2015-11-18 15:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-18 15:06 Hans Ginzel [this message]
2015-11-24  2:12 ` git rm --recursive Eric Sunshine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151118150637.GA49061@artax.karlin.mff.cuni.cz \
    --to=hans@matfyz.cz \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).