All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nazri Ramliy <ayiehere@gmail.com>
To: git@vger.kernel.org
Cc: Nazri Ramliy <ayiehere@gmail.com>
Subject: [PATCH 5/6] Teach --id to "git rm"
Date: Wed,  5 Aug 2009 17:51:45 +0800	[thread overview]
Message-ID: <1249465906-3940-6-git-send-email-ayiehere@gmail.com> (raw)
In-Reply-To: <1249465906-3940-5-git-send-email-ayiehere@gmail.com>

---
 builtin-rm.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/builtin-rm.c b/builtin-rm.c
index 57975db..d2982a0 100644
--- a/builtin-rm.c
+++ b/builtin-rm.c
@@ -137,6 +137,7 @@ static struct lock_file lock_file;
 
 static int show_only = 0, force = 0, index_only = 0, recursive = 0, quiet = 0;
 static int ignore_unmatch = 0;
+static const char *file_id;
 
 static struct option builtin_rm_options[] = {
 	OPT__DRY_RUN(&show_only),
@@ -146,6 +147,7 @@ static struct option builtin_rm_options[] = {
 	OPT_BOOLEAN('r', NULL,             &recursive,  "allow recursive removal"),
 	OPT_BOOLEAN( 0 , "ignore-unmatch", &ignore_unmatch,
 				"exit with a zero status even if nothing matched"),
+	OPT_STRING('d', "id", &file_id, "FILE_ID", "file id"),
 	OPT_END(),
 };
 
@@ -154,11 +156,18 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 	int i, newfd;
 	const char **pathspec;
 	char *seen;
+	char **new_argv;
 
 	git_config(git_default_config, NULL);
 
 	argc = parse_options(argc, argv, prefix, builtin_rm_options,
 			     builtin_rm_usage, 0);
+
+	if (file_id)
+		new_argv = (char **) expand_file_ids(file_id, &argc, (char **) argv);
+	else
+		new_argv = (char **) argv;
+
 	if (!argc)
 		usage_with_options(builtin_rm_usage, builtin_rm_options);
 
@@ -171,7 +180,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 		die("index file corrupt");
 	refresh_cache(REFRESH_QUIET);
 
-	pathspec = get_pathspec(prefix, argv);
+	pathspec = get_pathspec(prefix, (const char **) new_argv);
 	seen = NULL;
 	for (i = 0; pathspec[i] ; i++)
 		/* nothing */;
-- 
1.6.4.13.ge6580

  reply	other threads:[~2009-08-05  9:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-05  9:51 [PATCH] RFC - Say goodbye to the rodent Nazri Ramliy
2009-08-05  9:51 ` [PATCH 1/6] Teach --id/-d to "git status" Nazri Ramliy
2009-08-05  9:51   ` [PATCH 2/6] Teach --id to "git add" Nazri Ramliy
2009-08-05  9:51     ` [PATCH 3/6] Teach --id to "git checkout" Nazri Ramliy
2009-08-05  9:51       ` [PATCH 4/6] Teach --d to "git commit" Nazri Ramliy
2009-08-05  9:51         ` Nazri Ramliy [this message]
2009-08-05  9:51           ` [PATCH 6/6] Teach --id to "git reset" Nazri Ramliy
2009-08-05 18:11   ` [PATCH 1/6] Teach --id/-d to "git status" Alex Riesen
2009-08-05 18:25     ` Sverre Rabbelier
2009-08-05 18:27       ` Junio C Hamano
2009-08-05 18:30         ` Sverre Rabbelier
2009-08-05 18:33       ` Alex Riesen
2009-08-05 18:35         ` Sverre Rabbelier
2009-08-05 10:04 ` [PATCH] RFC - Say goodbye to the rodent Andreas Ericsson
2009-08-05 11:54 ` Matthieu Moy
2009-08-05 19:02 ` Jeff King
2009-08-05 20:01   ` Nicolas Pitre

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=1249465906-3940-6-git-send-email-ayiehere@gmail.com \
    --to=ayiehere@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.