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

Re: Add "--show-all" revision walker flag for debugging

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Feb 9, 2008, 23:52 UTC
Message-ID
<alpine.LFD.1.00.0802091531220.2896@woody.linux-foundation.org>
In-Reply-To
<alpine.LFD.1.00.0802091341210.2896@woody.linux-foundation.org>
On Sat, 9 Feb 2008, Linus Torvalds wrote:
Show 5 quoted lines
> 
> So here's a patch that adds a "--show-all" flag to the revision walker, 
> which will make it show uninteresting commits too, and they'll have a '*' 
> in front of them (it also fixes a logic error for !verbose_header for 
> boundary commits - we should show the '-' even if left_right isn't shown).
And here's a slight expansion patch on top of the above
It does:
 - when it actually breaks out due to the "everybody_uninteresting()" 
   case, it adds the uninteresting commits (both the one it's looking at 
   now, and the list of pending ones) to the list
   This way, we really list *all* the commits we've looked at
 - Because we now end up listing commits we may not even have been parsed 
   at all "show_log" and "show_commit" need to protect against commits 
   that don't have a commit buffer entry.

That second part is debatable just how it should work. Maybe we shouldn't show such entries at all (with this patch those entries do get shown, they just don't get any message shown with them). But I think this is a useful case.

		Linus
---
 builtin-rev-list.c |    2 +-
 log-tree.c         |    3 +++
 revision.c         |   11 ++++++++++-
 3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 5966199..7163116 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -86,7 +86,7 @@ static void show_commit(struct commit *commit)
 	else
 		putchar('\n');
 
-	if (revs.verbose_header) {
+	if (revs.verbose_header && commit->buffer) {
 		struct strbuf buf;
 		strbuf_init(&buf, 0);
 		pretty_print_commit(revs.commit_format, commit,
diff --git a/log-tree.c b/log-tree.c
index dd110ca..e9ba6df 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -282,6 +282,9 @@ void show_log(struct rev_info *opt, const char *sep)
 		}
 	}
 
+	if (!commit->buffer)
+		return;
+
 	/*
 	 * And then the pretty-printed message itself
 	 */
diff --git a/revision.c b/revision.c
index 158727c..76faf4b 100644
--- a/revision.c
+++ b/revision.c
@@ -558,6 +558,12 @@ static void cherry_pick_list(struct commit_list *list, struct rev_info *revs)
 	free_patch_ids(&ids);
 }
 
+static void add_to_list(struct commit_list **p, struct commit *commit, struct commit_list *n)
+{
+	p = &commit_list_insert(commit, p)->next;
+	*p = n;
+}
+
 static int limit_list(struct rev_info *revs)
 {
 	struct commit_list *list = revs->commits;
@@ -579,8 +585,11 @@ static int limit_list(struct rev_info *revs)
 			return -1;
 		if (obj->flags & UNINTERESTING) {
 			mark_parents_uninteresting(commit);
-			if (everybody_uninteresting(list))
+			if (everybody_uninteresting(list)) {
+				if (revs->show_all)
+					add_to_list(p, commit, list);
 				break;
+			}
 			if (!revs->show_all)
 				continue;
 		}
Previous: Linus TorvaldsNext: Junio C Hamano
Message 2 of 20 in “Add "--show-all" revision walker flag for debugging”
  1. Linus TorvaldsFeb 9, 2008
  2. Linus TorvaldsFeb 9, 2008
  3. Junio C HamanoFeb 10, 2008
  4. Johannes SchindelinFeb 10, 2008
  5. Linus TorvaldsFeb 10, 2008
  6. Johannes SchindelinFeb 10, 2008
  7. Junio C HamanoFeb 10, 2008
  8. Junio C HamanoFeb 10, 2008
  9. Nicolas PitreFeb 10, 2008
  10. Johannes SchindelinFeb 10, 2008
  11. Jakub NarebskiFeb 10, 2008
  12. Linus TorvaldsFeb 10, 2008
  13. Nicolas PitreFeb 10, 2008
  14. Jakub NarebskiFeb 10, 2008
  15. Linus TorvaldsFeb 10, 2008
  16. Jakub NarebskiFeb 11, 2008
  17. Nicolas PitreFeb 11, 2008
  18. Linus TorvaldsFeb 11, 2008
  19. Jakub NarebskiFeb 11, 2008
  20. Nicolas PitreFeb 11, 2008

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.