Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: git@vger.kernel.org
Subject: Re: Rebase semantic and cherry-pick
Date: Wed, 29 Mar 2006 19:40:38 -0800	[thread overview]
Message-ID: <7vmzf84n2h.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0603291852140.27203@g5.osdl.org> (Linus Torvalds's message of "Wed, 29 Mar 2006 18:54:12 -0800 (PST)")

Linus Torvalds <torvalds@osdl.org> writes:

> For consistency reasons, we should probably allow that to be written as 
> just "..branch", the same way we can write "branch.." to mean "everything 
> in HEAD but not in "branch".

Something like this, perhaps.

-- >8 --
revision arguments: ..B means HEAD..B, just like A.. means A..HEAD

For consistency reasons, we should probably allow that to be written as 
just "..branch", the same way we can write "branch.." to mean "everything 
in HEAD but not in "branch".

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/rev-parse.c b/rev-parse.c
index f176c56..e956cd5 100644
--- a/rev-parse.c
+++ b/rev-parse.c
@@ -315,16 +315,17 @@ int main(int argc, char **argv)
 		dotdot = strstr(arg, "..");
 		if (dotdot) {
 			unsigned char end[20];
-			char *n = dotdot+2;
+			char *next = dotdot + 2;
+			char *this = arg;
 			*dotdot = 0;
-			if (!get_sha1(arg, sha1)) {
-				if (!*n)
-					n = "HEAD";
-				if (!get_sha1(n, end)) {
-					show_rev(NORMAL, end, n);
-					show_rev(REVERSED, sha1, arg);
-					continue;
-				}
+			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);
+				continue;
 			}
 			*dotdot = '.';
 		}
diff --git a/revision.c b/revision.c
index 745b0d2..2cda7e0 100644
--- a/revision.c
+++ b/revision.c
@@ -642,14 +642,19 @@ int setup_revisions(int argc, const char
 		if (dotdot) {
 			unsigned char from_sha1[20];
 			char *next = dotdot + 2;
+			char *this = arg;
+			static const char HEAD[] = "HEAD";
 			*dotdot = 0;
 			if (!*next)
-				next = "HEAD";
-			if (!get_sha1(arg, from_sha1) && !get_sha1(next, sha1)) {
+				next = HEAD;
+			if (dotdot == arg)
+				this = HEAD;
+			if (!get_sha1(this, from_sha1) &&
+			    !get_sha1(next, sha1)) {
 				struct commit *exclude;
 				struct commit *include;
 
-				exclude = get_commit_reference(revs, arg, from_sha1, flags ^ UNINTERESTING);
+				exclude = get_commit_reference(revs, this, from_sha1, flags ^ UNINTERESTING);
 				include = get_commit_reference(revs, next, sha1, flags);
 				if (!exclude || !include)
 					die("Invalid revision range %s..%s", arg, next);

  reply	other threads:[~2006-03-30  3:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-29  1:43 How to switch kernel customizations from 2.6.15.6 to 2.6.16? Matt McCutchen
2006-03-29  2:10 ` Linus Torvalds
2006-03-29  2:30   ` Junio C Hamano
2006-03-29  3:58   ` Junio C Hamano
2006-03-29 19:27     ` Linus Torvalds
2006-03-29 19:39       ` Linus Torvalds
2006-03-29 20:24       ` Junio C Hamano
2006-03-30  1:59       ` Rebase semantic and cherry-pick Jakub Narebski
2006-03-30  2:38         ` Junio C Hamano
2006-03-30  2:54           ` Linus Torvalds
2006-03-30  3:40             ` Junio C Hamano [this message]
2006-03-30  3:15       ` How to switch kernel customizations from 2.6.15.6 to 2.6.16? Junio C Hamano
2006-03-29  2:23 ` Shawn Pearce
2006-03-29  2:26 ` Junio C Hamano
2006-03-30  3:01   ` Matt McCutchen
2006-03-30  3:22     ` Junio C Hamano
2006-03-30  3:47       ` Matt McCutchen
2006-03-30 17:32     ` Linus Torvalds
2006-03-30 21:50       ` Matt McCutchen

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=7vmzf84n2h.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.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