summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4a7cc2f)
raw | patch | inline | side by side (parent: 4a7cc2f)
author | Jeff King <peff@peff.net> | |
Mon, 7 Dec 2009 05:26:25 +0000 (00:26 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 7 Dec 2009 08:41:14 +0000 (00:41 -0800) |
We have three output formats: short, porcelain, and long.
The short and long formats respect user-config, and the
porcelain one does not. This led to us repeating
config-related setup code for the short and long formats.
Since the last commit, color config is explicitly cleared
when showing the porcelain format. Let's do the same with
relative-path configuration, which enables us to hoist the
duplicated code from the switch statement in cmd_status.
As a bonus, this fixes "commit --dry-run --porcelain", which
was unconditionally setting up that configuration, anyway.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The short and long formats respect user-config, and the
porcelain one does not. This led to us repeating
config-related setup code for the short and long formats.
Since the last commit, color config is explicitly cleared
when showing the porcelain format. Let's do the same with
relative-path configuration, which enables us to hoist the
duplicated code from the switch statement in cmd_status.
As a bonus, this fixes "commit --dry-run --porcelain", which
was unconditionally setting up that configuration, anyway.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-commit.c | patch | blob | history | |
wt-status.c | patch | blob | history |
diff --git a/builtin-commit.c b/builtin-commit.c
index ded58984ac983fe09b817c2c2b0af386266f6fe3..b39295fbf25233570ceaf0205682874d5c873d13 100644 (file)
--- a/builtin-commit.c
+++ b/builtin-commit.c
s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
wt_status_collect(&s);
+ if (s.relative_paths)
+ s.prefix = prefix;
+ if (s.use_color == -1)
+ s.use_color = git_use_color_default;
+ if (diff_use_color_default == -1)
+ diff_use_color_default = git_use_color_default;
+
switch (status_format) {
case STATUS_FORMAT_SHORT:
- if (s.relative_paths)
- s.prefix = prefix;
- if (s.use_color == -1)
- s.use_color = git_use_color_default;
- if (diff_use_color_default == -1)
- diff_use_color_default = git_use_color_default;
wt_shortstatus_print(&s, null_termination);
break;
case STATUS_FORMAT_PORCELAIN:
break;
case STATUS_FORMAT_LONG:
s.verbose = verbose;
- if (s.relative_paths)
- s.prefix = prefix;
- if (s.use_color == -1)
- s.use_color = git_use_color_default;
- if (diff_use_color_default == -1)
- diff_use_color_default = git_use_color_default;
wt_status_print(&s);
break;
}
diff --git a/wt-status.c b/wt-status.c
index 756defea1a4d5ee38700608cf4ed231c27f9a294..3fdcf97e1132fdcee7be9af4665a746a17933a0b 100644 (file)
--- a/wt-status.c
+++ b/wt-status.c
void wt_porcelain_print(struct wt_status *s, int null_termination)
{
s->use_color = 0;
+ s->relative_paths = 0;
+ s->prefix = NULL;
wt_shortstatus_print(s, null_termination);
}