Fix git-runstatus for repositories containing a file named HEAD
The wt_status_print_updated() and wt_status_print_untracked() routines call setup_revisions() with 'HEAD' being the reference to the tip of the current branch. However, setup_revisions() gets confused if the branch also contains a file named 'HEAD' resulting in a fatal error. Instead, don't pass an argv to setup_revisions() at all; simply give it no arguments, and make 'HEAD' the default revision. Bug noticed by Rocco Rutte <pdmef@gmx.net>. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Jeff King committed
Nov 5, 2006 at 17:22 UTC
49b8b2926fdcc4322445f0a3bda459e81cd98e9a
1 file changed
+3
-8
wt-status.c
+3
-8
@@ -156,10 +156,8 @@ void wt_status_print_initial(struct wt_status *s)
156
static void wt_status_print_updated(struct wt_status *s)
157
{
158
struct rev_info rev;
159
- const char *argv[] = { NULL, NULL, NULL };
160
- argv[1] = s->reference;
159
init_revisions(&rev, NULL);
162
- setup_revisions(2, argv, &rev, NULL);
160
+ setup_revisions(0, NULL, &rev, s->reference);
161
rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
162
rev.diffopt.format_callback = wt_status_print_updated_cb;
163
rev.diffopt.format_callback_data = s;
@@ -170,9 +168,8 @@ static void wt_status_print_updated(struct wt_status *s)
168
static void wt_status_print_changed(struct wt_status *s)
169
{
170
struct rev_info rev;
173
- const char *argv[] = { NULL, NULL };
171
init_revisions(&rev, "");
175
- setup_revisions(1, argv, &rev, NULL);
172
+ setup_revisions(0, NULL, &rev, NULL);
173
rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
174
rev.diffopt.format_callback = wt_status_print_changed_cb;
175
rev.diffopt.format_callback_data = s;
@@ -227,10 +224,8 @@ static void wt_status_print_untracked(const struct wt_status *s)
224
static void wt_status_print_verbose(struct wt_status *s)
225
{
226
struct rev_info rev;
230
- const char *argv[] = { NULL, NULL, NULL };
231
- argv[1] = s->reference;
227
init_revisions(&rev, NULL);
233
- setup_revisions(2, argv, &rev, NULL);
228
+ setup_revisions(0, NULL, &rev, s->reference);
229
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
230
rev.diffopt.detect_rename = 1;
231
run_diff_index(&rev, 1);