aboutsummaryrefslogtreecommitdiff
path: root/builtin-diff.c
diff options
context:
space:
mode:
authorTimo Hirvonen <tihirvon@gmail.com>2006-06-24 20:24:14 +0300
committerJunio C Hamano <junkio@cox.net>2006-06-26 14:58:40 -0700
commitc9b5ef998a3027d9f11b0820bb13896096833ccb (patch)
treee37c30116512362697c9e670b654b4c013477c7a /builtin-diff.c
parenta610786f4bc282410d348aba97316115a57740a0 (diff)
downloadgit-c9b5ef998a3027d9f11b0820bb13896096833ccb.tar.gz
git-c9b5ef998a3027d9f11b0820bb13896096833ccb.tar.xz
Set default diff output format after parsing command line
Initialize output_format to 0 instead of DIFF_FORMAT_RAW so that we can see later if any command line options changed it. Default value is set only if output format was not specified. Signed-off-by: Timo Hirvonen <tihirvon@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-diff.c')
-rw-r--r--builtin-diff.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin-diff.c b/builtin-diff.c
index 91235a118..47e0a37e2 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -252,9 +252,11 @@ int cmd_diff(int argc, const char **argv, char **envp)
git_config(git_diff_config);
init_revisions(&rev);
- rev.diffopt.output_format = DIFF_FORMAT_PATCH;
argc = setup_revisions(argc, argv, &rev, NULL);
+ if (!rev.diffopt.output_format)
+ rev.diffopt.output_format = DIFF_FORMAT_PATCH;
+
/* Do we have --cached and not have a pending object, then
* default to HEAD by hand. Eek.
*/