All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Cc: Linus Torvalds <torvalds@osdl.org>
Subject: [PATCH] Teach rev-list since..til notation.
Date: Thu, 04 Aug 2005 02:34:31 -0700	[thread overview]
Message-ID: <7vpssu2ggo.fsf_-_@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.58.0508032236470.3258@g5.osdl.org> (Linus Torvalds's message of "Wed, 3 Aug 2005 22:42:06 -0700 (PDT)")

The King Penguin says:

    Now, for extra bonus points, maybe you should make "git-rev-list" also
    understand the "rev..rev" format (which you can't do with just the
    get_sha1() interface, since it expands into more).

The faithful servant makes it so.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

 rev-list.c |   38 ++++++++++++++++++++++++++++++--------
 1 files changed, 30 insertions(+), 8 deletions(-)

f22d271a469b65760f73dc483aeb2448619e0ff1
diff --git a/rev-list.c b/rev-list.c
--- a/rev-list.c
+++ b/rev-list.c
@@ -457,6 +457,15 @@ static struct commit *get_commit_referen
 	die("%s is unknown object", name);
 }
 
+static void handle_one_commit(struct commit *com, struct commit_list **lst)
+{
+	if (!com || com->object.flags & SEEN)
+		return;
+	com->object.flags |= SEEN;
+	commit_list_insert(com, lst);
+}
+
+
 int main(int argc, char **argv)
 {
 	struct commit_list *list = NULL;
@@ -465,6 +474,7 @@ int main(int argc, char **argv)
 	for (i = 1 ; i < argc; i++) {
 		int flags;
 		char *arg = argv[i];
+		char *dotdot;
 		struct commit *commit;
 
 		if (!strncmp(arg, "--max-count=", 12)) {
@@ -523,21 +533,33 @@ int main(int argc, char **argv)
 			continue;
 		}
 
+		if (show_breaks && !merge_order)
+			usage(rev_list_usage);
+
 		flags = 0;
+		dotdot = strstr(arg, "..");
+		if (dotdot) {
+			char *next = dotdot + 2;
+			struct commit *exclude = NULL;
+			struct commit *include = NULL;
+			*dotdot = 0;
+			exclude = get_commit_reference(arg, UNINTERESTING);
+			include = get_commit_reference(next, 0);
+			if (exclude && include) {
+				limited = 1;
+				handle_one_commit(exclude, &list);
+				handle_one_commit(include, &list);
+				continue;
+			}
+			*next = '.';
+		}
 		if (*arg == '^') {
 			flags = UNINTERESTING;
 			arg++;
 			limited = 1;
 		}
-		if (show_breaks && !merge_order)
-			usage(rev_list_usage);
 		commit = get_commit_reference(arg, flags);
-		if (!commit)
-			continue;
-		if (commit->object.flags & SEEN)
-			continue;
-		commit->object.flags |= SEEN;
-		commit_list_insert(commit, &list);
+		handle_one_commit(commit, &list);
 	}
 
 	if (!merge_order) {		

  parent reply	other threads:[~2005-08-05 17:21 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-02 23:10 Users of git-check-files? Johannes Schindelin
2005-08-03  2:43 ` Linus Torvalds
2005-08-03  6:17   ` Junio C Hamano
2005-08-03 14:21     ` Johannes Schindelin
2005-08-03 18:00       ` Linus Torvalds
2005-08-03 22:09         ` Johannes Schindelin
2005-08-03 15:09     ` Linus Torvalds
2005-08-03 15:51       ` Junio C Hamano
2005-08-03 16:17         ` Linus Torvalds
2005-08-03 16:36           ` Junio C Hamano
2005-08-03 16:45             ` Linus Torvalds
2005-08-03 16:50               ` Johannes Schindelin
2005-08-03 17:08                 ` Josef Weidendorfer
2005-08-03 17:30                   ` Junio C Hamano
2005-08-03 17:46                   ` Josef Weidendorfer
2005-08-03 18:08                   ` Linus Torvalds
2005-08-03 23:25                     ` [PATCH] (preview) Renaming push Junio C Hamano
2005-08-03 23:48                       ` Linus Torvalds
2005-08-04  0:05                         ` Junio C Hamano
2005-08-04  0:13                           ` Linus Torvalds
2005-08-04  1:02                         ` Junio C Hamano
2005-08-04  5:26                         ` Junio C Hamano
2005-08-04  5:42                           ` Linus Torvalds
2005-08-04  8:09                             ` Junio C Hamano
2005-08-04  9:34                             ` Junio C Hamano [this message]
2005-08-03 18:02                 ` Users of git-check-files? Linus Torvalds
2005-08-03 17:02               ` Junio C Hamano
2005-08-03 17:23                 ` Linus Torvalds
2005-08-03 17:37                   ` Junio C Hamano
2005-08-03 17:46                     ` Josef Weidendorfer
2005-08-03 18:10                       ` Linus Torvalds
2005-08-03 17:48                     ` Linus Torvalds
2005-08-03 18:07                       ` Junio C Hamano
2005-08-03 18:31                         ` Josef Weidendorfer
2005-08-03 16:46             ` Johannes Schindelin
2005-08-04 20:59       ` Junio C Hamano
2005-08-04 21:10         ` Johannes Schindelin

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=7vpssu2ggo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.