Skip to content

Commit

Permalink
Add --no-commit-id option for git-diff-tree, use it in gitk
Browse files Browse the repository at this point in the history
This patch introduces -no-commit-id option for git-diff-tree, which
suppresses commit ID output.

[jc: dropped gitk part for now.]

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Pavel Roskin authored and Junio C Hamano committed Nov 11, 2005
1 parent 17cf939 commit 601c978
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Documentation/git-diff-tree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ git-diff-tree - Compares the content and mode of blobs found via two tree object

SYNOPSIS
--------
'git-diff-tree' [--stdin] [-m] [-s] [-v] [--pretty] [-t] [-r] [--root] [<common diff options>] <tree-ish> [<tree-ish>] [<path>...]
'git-diff-tree' [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty] [-t] [-r] [--root] [<common diff options>] <tree-ish> [<tree-ish>] [<path>...]

DESCRIPTION
-----------
Expand Down Expand Up @@ -74,6 +74,10 @@ separated with a single space are given.
commit message. Without "=<style>", it defaults to
medium.

--no-commit-id::
git-diff-tree outputs a line with the commit ID when
applicable. This flag suppressed the commit ID output.


Limiting Output
---------------
Expand Down
8 changes: 7 additions & 1 deletion diff-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "commit.h"

static int show_root_diff = 0;
static int no_commit_id = 0;
static int verbose_header = 0;
static int ignore_merges = 1;
static int read_stdin = 0;
Expand All @@ -29,7 +30,8 @@ static int call_diff_flush(void)
return 0;
}
if (header) {
printf("%s%c", header, diff_options.line_termination);
if (!no_commit_id)
printf("%s%c", header, diff_options.line_termination);
header = NULL;
}
diff_flush(&diff_options);
Expand Down Expand Up @@ -231,6 +233,10 @@ int main(int argc, const char **argv)
show_root_diff = 1;
continue;
}
if (!strcmp(arg, "--no-commit-id")) {
no_commit_id = 1;
continue;
}
usage(diff_tree_usage);
}
if (diff_options.output_format == DIFF_FORMAT_PATCH)
Expand Down

0 comments on commit 601c978

Please sign in to comment.