git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Fix "git-rev-list" revision range parsing

From
Linus Torvalds <torvalds@osdl.org>
Date
Sep 17, 2005, 00:53 UTC
Message-ID
<Pine.LNX.4.58.0509161750420.26803@g5.osdl.org>
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>
---
diff --git a/rev-list.c b/rev-list.c
--- a/rev-list.c
+++ b/rev-list.c
@@ -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;
Message 1 of 1 in “Fix "git-rev-list" revision range parsing”
  1. Linus TorvaldsSep 17, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.