Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
status: fix null termination with "-b"
author
Jeff King
<peff@peff.net>
Mon, 7 May 2012 21:02:18 +0000
(17:02 -0400)
committer
Jeff King
<peff@peff.net>
Tue, 8 May 2012 08:51:08 +0000
(
04:51
-0400)
When the "-z" option is given to status, we are supposed to
NUL-terminate each record. However, the "-b" code to show
the tracking branch did not respect this, and always ended
with a newline.
Signed-off-by: Jeff King <peff@peff.net>
t/t7508-status.sh
patch
|
blob
|
history
wt-status.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
3207a3a
)
diff --git
a/t/t7508-status.sh
b/t/t7508-status.sh
index fc57b135c50e34ab86c04d0a0ec81052ce40f8ff..24728facf9c9fbf92a7aca4a5eb20e5905a84bee 100755
(executable)
--- a/
t/t7508-status.sh
+++ b/
t/t7508-status.sh
@@
-271,6
+271,15
@@
test_expect_success 'status -s -b' '
'
'
+test_expect_success 'status -s -z -b' '
+ tr "\\n" Q <expect >expect.q &&
+ mv expect.q expect &&
+ git status -s -z -b >output &&
+ nul_to_q <output >output.q &&
+ mv output.q output &&
+ test_cmp expect output
+'
+
test_expect_success 'setup dir3' '
mkdir dir3 &&
: >dir3/untracked1 &&
test_expect_success 'setup dir3' '
mkdir dir3 &&
: >dir3/untracked1 &&
diff --git
a/wt-status.c
b/wt-status.c
index afb4bd7d76e14060de90646af30893f5bf76b929..b5305ae5f414298313f363caef74529910d1942d 100644
(file)
--- a/
wt-status.c
+++ b/
wt-status.c
@@
-889,8
+889,8
@@
static void wt_shortstatus_print_tracking(struct wt_status *s)
if (s->is_initial)
color_fprintf(s->fp, header_color, _("Initial commit on "));
if (!stat_tracking_info(branch, &num_ours, &num_theirs)) {
if (s->is_initial)
color_fprintf(s->fp, header_color, _("Initial commit on "));
if (!stat_tracking_info(branch, &num_ours, &num_theirs)) {
- color_fprintf
_ln(s->fp, branch_color_local,
-
"%s", branch_name
);
+ color_fprintf
(s->fp, branch_color_local, "%s", branch_name);
+
fputc(s->null_termination ? '\0' : '\n', s->fp
);
return;
}
return;
}
@@
-914,7
+914,8
@@
static void wt_shortstatus_print_tracking(struct wt_status *s)
color_fprintf(s->fp, branch_color_remote, "%d", num_theirs);
}
color_fprintf(s->fp, branch_color_remote, "%d", num_theirs);
}
- color_fprintf_ln(s->fp, header_color, "]");
+ color_fprintf(s->fp, header_color, "]");
+ fputc(s->null_termination ? '\0' : '\n', s->fp);
}
void wt_shortstatus_print(struct wt_status *s, int show_branch)
}
void wt_shortstatus_print(struct wt_status *s, int show_branch)