git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonas Fonseca <fonseca@diku.dk>
To: git@vger.kernel.org
Subject: [PATCH] git-diff-cache: handle pathspec beginning with a dash
Date: Mon, 6 Jun 2005 23:27:00 +0200	[thread overview]
Message-ID: <20050606212700.GA3498@diku.dk> (raw)

Parse everything after '--' as tree name or pathspec.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---

 diff-cache.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/diff-cache.c b/diff-cache.c
--- a/diff-cache.c
+++ b/diff-cache.c
@@ -167,13 +167,14 @@ int main(int argc, const char **argv)
 	void *tree;
 	unsigned long size;
 	int ret;
+	int allow_options = 1;
 	int i;
 
 	read_cache();
 	for (i = 1; i < argc; i++) {
 		const char *arg = argv[i];
 
-		if (*arg != '-') {
+		if (!allow_options || *arg != '-') {
 			if (tree_name) {
 				pathspec = argv + i;
 				break;
@@ -182,6 +183,10 @@ int main(int argc, const char **argv)
 			continue;
 		}
 			
+		if (!strcmp(arg, "--")) {
+			allow_options = 0;
+			continue;
+		}
 		if (!strcmp(arg, "-r")) {
 			/* We accept the -r flag just to look like git-diff-tree */
 			continue;
-- 
Jonas Fonseca

             reply	other threads:[~2005-06-06 21:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-06 21:27 Jonas Fonseca [this message]
2005-06-06 21:32 ` [PATCH] cg-commit: prefix pathspec argument with -- Jonas Fonseca
2005-06-08 18:47 ` [PATCH] git-diff-cache: handle pathspec beginning with a dash Petr Baudis
2005-06-08 20:00   ` Linus Torvalds
2005-06-08 20:06     ` Petr Baudis
2005-06-08 20:13       ` Linus Torvalds

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=20050606212700.GA3498@diku.dk \
    --to=fonseca@diku.dk \
    --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).