Code

[PATCH] Fix "git-rev-list" revision range parsing
authorLinus Torvalds <torvalds@osdl.org>
Sat, 17 Sep 2005 00:53:19 +0000 (17:53 -0700)
committerJunio C Hamano <junkio@cox.net>
Sat, 17 Sep 2005 18:57:50 +0000 (11:57 -0700)
There were two bugs in there:
 - if the range didn't end up working, we restored the '.' character in
   the wrong place.
 - an empty end-of-range should be interpreted as HEAD.

See rev-parse.c for the reference implementation of this.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
rev-list.c

index c55e912be4faa81a70c9cc27ef44d72a74d49a41..e41d5a045c3192f4759aa5b2e4881f28f92ed68f 100644 (file)
@@ -561,6 +561,8 @@ int main(int argc, char **argv)
                        struct commit *exclude = NULL;
                        struct commit *include = NULL;
                        *dotdot = 0;
+                       if (!*next)
+                               next = "HEAD";
                        exclude = get_commit_reference(arg, UNINTERESTING);
                        include = get_commit_reference(next, 0);
                        if (exclude && include) {
@@ -569,7 +571,7 @@ int main(int argc, char **argv)
                                handle_one_commit(include, &list);
                                continue;
                        }
-                       *next = '.';
+                       *dotdot = '.';
                }
                if (*arg == '^') {
                        flags = UNINTERESTING;