{"thread":{"id":"2420","subject":"[PATCH] Add --no-commit-id option for git-diff-tree, use it in gitk","startedAt":"2005-11-10T05:30:12Z","lastAt":"2005-11-10T05:30:12Z","messageCount":1,"participants":["Pavel Roskin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"11454","messageId":"1131600612.10499.4.camel@dv","threadId":"2420","inReplyTo":null,"subject":"[PATCH] Add --no-commit-id option for git-diff-tree, use it in gitk","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-11-10T05:30:12Z","receivedAt":"2005-11-10T05:30:12Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"This patch introduces -no-commit-id option for git-diff-tree, which\nsuppresses commit ID output.\n\nThis option is used in gitk, to suppress empty lines after \"Comments\"\nintroduced in 8b7e5d76e836396a097bb6f61cf930ea872a7bd3.  Also, the p\nvariable is removed where is became unused due to the same patch.\n\nSigned-off-by: Pavel Roskin <proski@gnu.org>\n\ndiff --git a/Documentation/git-diff-tree.txt b/Documentation/git-diff-tree.txt\nindex f57c8d0..9a2947e 100644\n--- a/Documentation/git-diff-tree.txt\n+++ b/Documentation/git-diff-tree.txt\n@@ -8,7 +8,7 @@ git-diff-tree - Compares the content and\n \n SYNOPSIS\n --------\n-'git-diff-tree' [--stdin] [-m] [-s] [-v] [--pretty] [-t] [-r] [--root] [<common diff options>] <tree-ish> [<tree-ish>] [<path>...]\n+'git-diff-tree' [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty] [-t] [-r] [--root] [<common diff options>] <tree-ish> [<tree-ish>] [<path>...]\n \n DESCRIPTION\n -----------\n@@ -74,6 +74,10 @@ separated with a single space are given.\n \tcommit message.  Without \"=<style>\", it defaults to\n \tmedium.\n \n+--no-commit-id::\n+\tgit-diff-tree outputs a line with the commit ID when\n+\tapplicable.  This flag suppressed the commit ID output.\n+\n \n Limiting Output\n ---------------\ndiff --git a/diff-tree.c b/diff-tree.c\nindex ed323d8..f2c629b 100644\n--- a/diff-tree.c\n+++ b/diff-tree.c\n@@ -3,6 +3,7 @@\n #include \"commit.h\"\n \n static int show_root_diff = 0;\n+static int no_commit_id = 0;\n static int verbose_header = 0;\n static int ignore_merges = 1;\n static int read_stdin = 0;\n@@ -28,7 +29,7 @@ static int call_diff_flush(void)\n \t\tdiff_options.output_format = saved_fmt;\n \t\treturn 0;\n \t}\n-\tif (header) {\n+\tif (header && !no_commit_id) {\n \t\tprintf(\"%s%c\", header, diff_options.line_termination);\n \t\theader = NULL;\n \t}\n@@ -231,6 +232,10 @@ int main(int argc, const char **argv)\n \t\t\tshow_root_diff = 1;\n \t\t\tcontinue;\n \t\t}\n+\t\tif (!strcmp(arg, \"--no-commit-id\")) {\n+\t\t\tno_commit_id = 1;\n+\t\t\tcontinue;\n+\t\t}\n \t\tusage(diff_tree_usage);\n \t}\n \tif (diff_options.output_format == DIFF_FORMAT_PATCH)\ndiff --git a/gitk b/gitk\nindex a9d37d9..6d47139 100755\n--- a/gitk\n+++ b/gitk\n@@ -2805,8 +2805,7 @@ proc gettreediffs {ids} {\n     set treepending $ids\n     set treediff {}\n     set id [lindex $ids 0]\n-    set p [lindex $ids 1]\n-    if [catch {set gdtf [open \"|git-diff-tree -r $id\" r]}] return\n+    if [catch {set gdtf [open \"|git-diff-tree --no-commit-id -r $id\" r]}] return\n     fconfigure $gdtf -blocking 0\n     fileevent $gdtf readable [list gettreediffline $gdtf $ids]\n }\n@@ -2840,9 +2839,8 @@ proc getblobdiffs {ids} {\n     global difffilestart nextupdate diffinhdr treediffs\n \n     set id [lindex $ids 0]\n-    set p [lindex $ids 1]\n     set env(GIT_DIFF_OPTS) $diffopts\n-    set cmd [list | git-diff-tree -r -p -C $id]\n+    set cmd [list | git-diff-tree --no-commit-id -r -p -C $id]\n     if {[catch {set bdf [open $cmd r]} err]} {\n \tputs \"error getting diffs: $err\"\n \treturn\n\n\n-- \nRegards,\nPavel Roskin\n"}]}