# [PATCH] Teach rev-parse the ... syntax.

3 messages from 2006-07-04 to 2006-07-04. Participants: Santi Béjar, Johannes Schindelin, Santi.
Thread: https://gitlist.dev/t/4763

## Santi Béjar, 2006-07-04 09:02

Subject: [PATCH] Teach rev-parse the ... syntax.
Message-ID: <873bdhbv4x.fsf@gmail.com>
URL: https://gitlist.dev/e/873bdhbv4x.fsf%40gmail.com

```
Signed-off-by: Santi Béjar <sbejar@gmail.com>
---

 I think this time the mail patch is OK, I've tested it.

 builtin-rev-parse.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index 5f5ade4..8d2beb2 100644
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
@@ -331,14 +331,29 @@ int cmd_rev_parse(int argc, const char *
 			unsigned char end[20];
 			const char *next = dotdot + 2;
 			const char *this = arg;
+			int symmetric = *next == '.';
+
 			*dotdot = 0;
+			next += symmetric;
+
 			if (!*next)
 				next = "HEAD";
 			if (dotdot == arg)
 				this = "HEAD";
 			if (!get_sha1(this, sha1) && !get_sha1(next, end)) {
 				show_rev(NORMAL, end, next);
-				show_rev(REVERSED, sha1, this);
+				show_rev(symmetric?NORMAL:REVERSED, sha1, this);
+				if (symmetric) {
+				  struct commit *a, *b;
+				  a = lookup_commit_reference(sha1);
+				  b = lookup_commit_reference(end);
+				  struct commit_list *exclude = get_merge_bases(a, b,1);
+				  while (exclude) {
+				    show_rev(REVERSED,
+					     exclude->item->object.sha1,NULL);
+				    exclude = exclude->next;
+				  }
+				}
 				continue;
 			}
 			*dotdot = '.';
-- 
1.4.1.ge6c0-dirty

```

## Johannes Schindelin, 2006-07-04 10:50

Subject: Re: [PATCH] Teach rev-parse the ... syntax.
Message-ID: <Pine.LNX.4.63.0607041247200.29667@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0607041247200.29667%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <873bdhbv4x.fsf@gmail.com>

```
Hi,

On Tue, 4 Jul 2006, Santi Béjar wrote:

> +				  struct commit_list *exclude = get_merge_bases(a, b,1);

You never free_commit_list() exclude.

Side thought: we do not really support multiple ranges, do we? E.g.

	git-rev-list HEAD~10..HEAD~8 HEAD^..

would not yield the intended result, right? (And same goes for ... ranges) 
Maybe we should at least warn about that.

Ciao,
Dscho
```

## Santi, 2006-07-04 11:17

Subject: Re: [PATCH] Teach rev-parse the ... syntax.
Message-ID: <8aa486160607040417n2016ecc3h70e6f3c92f851b13@mail.gmail.com>
URL: https://gitlist.dev/e/8aa486160607040417n2016ecc3h70e6f3c92f851b13%40mail.gmail.com
In-Reply-To: <Pine.LNX.4.63.0607041247200.29667@wbgn013.biozentrum.uni-wuerzburg.de>

```
2006/7/4, Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> Hi,
>
> On Tue, 4 Jul 2006, Santi Béjar wrote:
>
> > +                               struct commit_list *exclude = get_merge_bases(a, b,1);
>
> You never free_commit_list() exclude.
>

Ups! But thanks to Junio it is already there :)

Santi
-- 
Looking for signature...
Looking for signature...done

```
