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

[PATCH] add *--no-merges* flag to suppress display of merge commits

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 8, 2005, 09:37 UTC
Message-ID
<Pine.LNX.4.63.0508081136210.31438@wgmdd8.biozentrum.uni-wuerzburg.de>

As requested by Junio (who suggested --single-parents-only, but this could forget a no-parent root).

Also, adds a few missing options to the usage string.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 rev-list.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
4c24c4de403dcb658622590f6f6ef35232bbe709
diff --git a/rev-list.c b/rev-list.c
--- a/rev-list.c
+++ b/rev-list.c
@@ -15,12 +15,15 @@ static const char rev_list_usage[] =
 		      "  --max-count=nr\n"
 		      "  --max-age=epoch\n"
 		      "  --min-age=epoch\n"
+		      "  --parents\n"
 		      "  --bisect\n"
 		      "  --objects\n"
 		      "  --unpacked\n"
 		      "  --header\n"
 		      "  --pretty\n"
-		      "  --merge-order [ --show-breaks ]";
+		      "  --no-merges\n"
+		      "  --merge-order [ --show-breaks ]\n"
+		      "  --topo-order";
 
 static int unpacked = 0;
 static int bisect_list = 0;
@@ -39,6 +42,7 @@ static int merge_order = 0;
 static int show_breaks = 0;
 static int stop_traversal = 0;
 static int topo_order = 0;
+static int no_merges = 0;
 
 static void show_commit(struct commit *commit)
 {
@@ -82,6 +86,8 @@ static int filter_commit(struct commit *
 	}
 	if (max_count != -1 && !max_count--)
 		return STOP;
+	if (no_merges && (commit->parents && commit->parents->next))
+		return CONTINUE;
 	return DO;
 }
 
@@ -498,6 +504,10 @@ int main(int argc, char **argv)
 			verbose_header = 1;
 			hdr_termination = '\n';
 			prefix = "commit ";
+			continue;
+		}
+		if (!strncmp(arg, "--no-merges", 11)) {
+			no_merges = 1;
 			continue;
 		}
 		if (!strcmp(arg, "--parents")) {
Message 1 of 1 in “add *--no-merges* flag to suppress display of merge commits”
  1. add *--no-merges* flag to suppress display of merge commitsJohannes Schindelin, Aug 8, 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.