git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Santi Béjar" <sbejar@gmail.com>
To: Git Mailing List <git@vger.kernel.org>,
	"Junio C. Hamano" <junkio@cox.net>
Subject: [PATCH] Teach rev-parse the ... syntax.
Date: Tue, 04 Jul 2006 11:02:22 +0200	[thread overview]
Message-ID: <873bdhbv4x.fsf@gmail.com> (raw)

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

             reply	other threads:[~2006-07-04  9:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-04  9:02 Santi Béjar [this message]
2006-07-04 10:50 ` [PATCH] Teach rev-parse the ... syntax Johannes Schindelin
2006-07-04 11:17   ` Santi

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=873bdhbv4x.fsf@gmail.com \
    --to=sbejar@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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).