From: Dan Holmsand <holmsand@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] Make git-diff-tree --pretty
Date: Mon, 06 Jun 2005 23:16:31 +0200 [thread overview]
Message-ID: <d82e8d$km9$1@sea.gmane.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 191 bytes --]
Make git-diff-tree --pretty[=[short|medium|raw]] work as in
git-rev-list.
Also suppress duplicate newline in 'git-diff-tree -s' output.
Signed-off-by: Dan Holmsand <holmsand@gmail.com>
---
[-- Attachment #2: diff-tree.patch.txt --]
[-- Type: text/plain, Size: 1529 bytes --]
diff-tree.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/diff-tree.c b/diff-tree.c
--- a/diff-tree.c
+++ b/diff-tree.c
@@ -323,7 +323,8 @@ static char *generate_header(const char
offset = sprintf(this_header, "%s%s (from %s)\n", header_prefix, commit, parent);
if (verbose_header) {
offset += pretty_print_commit(commit_format, msg, len, this_header + offset, sizeof(this_header) - offset);
- this_header[offset++] = '\n';
+ if (diff_output_format != DIFF_FORMAT_NO_OUTPUT)
+ this_header[offset++] = '\n';
this_header[offset++] = 0;
}
@@ -400,6 +401,19 @@ static int diff_tree_stdin(char *line)
static char *diff_tree_usage =
"git-diff-tree [-p] [-r] [-z] [--stdin] [-M] [-C] [-R] [-S<string>] [-O<orderfile>] [-m] [-s] [-v] [-t] <tree-ish> <tree-ish>";
+static enum cmit_fmt get_commit_format(const char *arg)
+{
+ if (!*arg)
+ return CMIT_FMT_DEFAULT;
+ if (!strcmp(arg, "=raw"))
+ return CMIT_FMT_RAW;
+ if (!strcmp(arg, "=medium"))
+ return CMIT_FMT_MEDIUM;
+ if (!strcmp(arg, "=short"))
+ return CMIT_FMT_SHORT;
+ usage(diff_tree_usage);
+}
+
int main(int argc, const char **argv)
{
int nr_sha1;
@@ -492,6 +506,12 @@ int main(int argc, const char **argv)
header_prefix = "diff-tree ";
continue;
}
+ if (!strncmp(arg, "--pretty", 8)) {
+ commit_format = get_commit_format(arg+8);
+ verbose_header = 1;
+ header_prefix = "diff-tree ";
+ continue;
+ }
if (!strcmp(arg, "--stdin")) {
read_stdin = 1;
continue;
reply other threads:[~2005-06-06 21:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='d82e8d$km9$1@sea.gmane.org' \
--to=holmsand@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).