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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Santi Béjar <sbejar@xxxxxxxxx>
---

 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

-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]