summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2006-11-05 17:22:15 -0500
committerJunio C Hamano <junkio@cox.net>2006-11-05 18:35:08 -0800
commit49b8b2926fdcc4322445f0a3bda459e81cd98e9a (patch)
tree3e62dd3c87c69cc57bb3f3ff4878af9274e96e10 /wt-status.c
parent6c2f207b2316149ee8dfaf026e4a869ff9ab42f7 (diff)
downloadgit-49b8b2926fdcc4322445f0a3bda459e81cd98e9a.tar.gz
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>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/wt-status.c b/wt-status.c
index 4b74e68584..68ecb0b921 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -156,10 +156,8 @@ void wt_status_print_initial(struct wt_status *s)
static void wt_status_print_updated(struct wt_status *s)
{
struct rev_info rev;
- const char *argv[] = { NULL, NULL, NULL };
- argv[1] = s->reference;
init_revisions(&rev, NULL);
- setup_revisions(2, argv, &rev, NULL);
+ setup_revisions(0, NULL, &rev, s->reference);
rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
rev.diffopt.format_callback = wt_status_print_updated_cb;
rev.diffopt.format_callback_data = s;
@@ -170,9 +168,8 @@ static void wt_status_print_updated(struct wt_status *s)
static void wt_status_print_changed(struct wt_status *s)
{
struct rev_info rev;
- const char *argv[] = { NULL, NULL };
init_revisions(&rev, "");
- setup_revisions(1, argv, &rev, NULL);
+ setup_revisions(0, NULL, &rev, NULL);
rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
rev.diffopt.format_callback = wt_status_print_changed_cb;
rev.diffopt.format_callback_data = s;
@@ -227,10 +224,8 @@ static void wt_status_print_untracked(const struct wt_status *s)
static void wt_status_print_verbose(struct wt_status *s)
{
struct rev_info rev;
- const char *argv[] = { NULL, NULL, NULL };
- argv[1] = s->reference;
init_revisions(&rev, NULL);
- setup_revisions(2, argv, &rev, NULL);
+ setup_revisions(0, NULL, &rev, s->reference);
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
rev.diffopt.detect_rename = 1;
run_diff_index(&rev, 1);