git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rocco Rutte <pdmef@gmx.net>
To: git@vger.kernel.org
Cc: Rocco Rutte <pdmef@gmx.net>
Subject: [PATCH] Fix git-runstatus for repositories containing a file named HEAD
Date: Sun,  5 Nov 2006 21:52:50 +0000	[thread overview]
Message-ID: <11627635702846-git-send-email-pdmef@gmx.net> (raw)

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.

The fix is to append the '--' delimiter to the setup_revisions() call so
that it knows for sure that the 'HEAD' argument is a revision and not a
filename.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
---
 wt-status.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/wt-status.c b/wt-status.c
index 7dd6857..7c0dbdb 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -154,10 +154,10 @@ void wt_status_print_initial(struct wt_s
 static void wt_status_print_updated(struct wt_status *s)
 {
 	struct rev_info rev;
-	const char *argv[] = { NULL, NULL, NULL };
+	const char *argv[] = { NULL, NULL, "--", NULL };
 	argv[1] = s->reference;
 	init_revisions(&rev, NULL);
-	setup_revisions(2, argv, &rev, NULL);
+	setup_revisions(3, argv, &rev, NULL);
 	rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
 	rev.diffopt.format_callback = wt_status_print_updated_cb;
 	rev.diffopt.format_callback_data = s;
@@ -225,10 +225,10 @@ static void wt_status_print_untracked(co
 static void wt_status_print_verbose(struct wt_status *s)
 {
 	struct rev_info rev;
-	const char *argv[] = { NULL, NULL, NULL };
+	const char *argv[] = { NULL, NULL, "--", NULL };
 	argv[1] = s->reference;
 	init_revisions(&rev, NULL);
-	setup_revisions(2, argv, &rev, NULL);
+	setup_revisions(3, argv, &rev, NULL);
 	rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
 	rev.diffopt.detect_rename = 1;
 	run_diff_index(&rev, 1);
-- 
1.4.3.4.g50f39-dirty

             reply	other threads:[~2006-11-05 21:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-05 21:52 Rocco Rutte [this message]
2006-11-05 22:22 ` [PATCH] Fix git-runstatus for repositories containing a file named HEAD Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11627635702846-git-send-email-pdmef@gmx.net \
    --to=pdmef@gmx.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).