# [PATCH] git-diff-cache: handle pathspec beginning with a dash

6 messages from 2005-06-06 to 2005-06-08. Participants: Jonas Fonseca, Petr Baudis, Linus Torvalds.
Thread: https://gitlist.dev/t/849

## Jonas Fonseca, 2005-06-06 21:27

Subject: [PATCH] git-diff-cache: handle pathspec beginning with a dash
Message-ID: <20050606212700.GA3498@diku.dk>
URL: https://gitlist.dev/e/20050606212700.GA3498%40diku.dk

```
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

```

## Jonas Fonseca, 2005-06-06 21:32

Subject: [PATCH] cg-commit: prefix pathspec argument with --
Message-ID: <20050606213252.GB3498@diku.dk>
URL: https://gitlist.dev/e/20050606213252.GB3498%40diku.dk
In-Reply-To: <20050606212700.GA3498@diku.dk>

```
Make cg-commit handle files beginning with dashes.

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

[ Obviously depends on the patch I sent previously. ]

 cg-commit |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/cg-commit b/cg-commit
--- a/cg-commit
+++ b/cg-commit
@@ -110,7 +110,7 @@ if [ "$1" ]; then
 	[ "$ignorecache" ] && die "-C and listing files to commit does not make sense"
 	[ -s $_git/merging ] && die "cannot commit individual files when merging"
 
-	eval commitfiles=($(git-diff-cache -r -m HEAD "$@" | \
+	eval commitfiles=($(git-diff-cache -r -m HEAD -- "$@" | \
 		sed 's/^\([^	]*\)\(.	.*\)\(	.*\)*$/"\2"/'))
 	customfiles=1
 
-- 
Jonas Fonseca

```

## Petr Baudis, 2005-06-08 18:47

Subject: Re: [PATCH] git-diff-cache: handle pathspec beginning with a dash
Message-ID: <20050608184709.GE982@pasky.ji.cz>
URL: https://gitlist.dev/e/20050608184709.GE982%40pasky.ji.cz
In-Reply-To: <20050606212700.GA3498@diku.dk>

```
Dear diary, on Mon, Jun 06, 2005 at 11:27:00PM CEST, I got a letter
where Jonas Fonseca <fonseca@diku.dk> told me that...
> Parse everything after '--' as tree name or pathspec.
> 
> Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

Thanks, applied to git-pb. Linus, any particular reason for holding this
off?

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor

```

## Linus Torvalds, 2005-06-08 20:00

Subject: Re: [PATCH] git-diff-cache: handle pathspec beginning with a dash
Message-ID: <Pine.LNX.4.58.0506081259580.2286@ppc970.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.58.0506081259580.2286%40ppc970.osdl.org
In-Reply-To: <20050608184709.GE982@pasky.ji.cz>

```


On Wed, 8 Jun 2005, Petr Baudis wrote:
>
> Dear diary, on Mon, Jun 06, 2005 at 11:27:00PM CEST, I got a letter
> where Jonas Fonseca <fonseca@diku.dk> told me that...
> > Parse everything after '--' as tree name or pathspec.
> > 
> > Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
> 
> Thanks, applied to git-pb. Linus, any particular reason for holding this
> off?

It seems to have gone only to the mailing list. I only glance through the 
lists, and assume that if somebody wants me to apply a patch, they'll cc 
me personally too..

		Linus

```

## Petr Baudis, 2005-06-08 20:06

Subject: Re: [PATCH] git-diff-cache: handle pathspec beginning with a dash
Message-ID: <20050608200612.GM982@pasky.ji.cz>
URL: https://gitlist.dev/e/20050608200612.GM982%40pasky.ji.cz
In-Reply-To: <Pine.LNX.4.58.0506081259580.2286@ppc970.osdl.org>

```
Dear diary, on Wed, Jun 08, 2005 at 10:00:48PM CEST, I got a letter
where Linus Torvalds <torvalds@osdl.org> told me that...
> 
> 
> On Wed, 8 Jun 2005, Petr Baudis wrote:
> >
> > Dear diary, on Mon, Jun 06, 2005 at 11:27:00PM CEST, I got a letter
> > where Jonas Fonseca <fonseca@diku.dk> told me that...
> > > Parse everything after '--' as tree name or pathspec.
> > > 
> > > Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
> > 
> > Thanks, applied to git-pb. Linus, any particular reason for holding this
> > off?
> 
> It seems to have gone only to the mailing list. I only glance through the 
> lists, and assume that if somebody wants me to apply a patch, they'll cc 
> me personally too..

I see. Jonas mentioned on IRC that he forgot to Cc' you. I'm usually
going through everything on the mailing list, so if some patch stays out
for few days I'll start nagging. ;-)

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor

```

## Linus Torvalds, 2005-06-08 20:13

Subject: Re: [PATCH] git-diff-cache: handle pathspec beginning with a dash
Message-ID: <Pine.LNX.4.58.0506081312410.2286@ppc970.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.58.0506081312410.2286%40ppc970.osdl.org
In-Reply-To: <20050608200612.GM982@pasky.ji.cz>

```


On Wed, 8 Jun 2005, Petr Baudis wrote:
> 
> I see. Jonas mentioned on IRC that he forgot to Cc' you. I'm usually
> going through everything on the mailing list, so if some patch stays out
> for few days I'll start nagging. ;-)

Even better, just forward it to me with the original author as "From:" at
the top of the email, and an added sign-off by you, and it will show which
path it took.

I took the two patches you pointed out from the mailing list, so they're 
in my archives now.

		Linus

```
