summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorJürgen Rühle <j-r@online.de>2007-01-02 20:26:23 +0100
committerJunio C Hamano <junkio@cox.net>2007-01-02 23:43:31 -0800
commit98bf8a47c296f51ea9722fef4bb81dbfb70cd4bb (patch)
treea8bf544dcf8f11b0914db29768ca099c2d197193 /wt-status.c
parent6e458bf63f48fb7d15cb70ad7c7b7b71915d94a2 (diff)
downloadgit-98bf8a47c296f51ea9722fef4bb81dbfb70cd4bb.tar.gz
Support --amend on initial commit in status output
We check the existence of the parent commit to determine whether the status is requested for an initial commit. Since the parent commit depends on the presence of the --amend switch do initial commit detection after command line arguments have been handled. Signed-off-by: Jürgen Rühle <j-r@online.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/wt-status.c b/wt-status.c
index ca4690e86b..9b777a569e 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -41,8 +41,6 @@ void wt_status_prepare(struct wt_status *s)
unsigned char sha1[20];
const char *head;
- s->is_initial = get_sha1("HEAD", sha1) ? 1 : 0;
-
head = resolve_ref("HEAD", sha1, 0, NULL);
s->branch = head ? xstrdup(head) : NULL;
@@ -277,6 +275,9 @@ static void wt_status_print_verbose(struct wt_status *s)
void wt_status_print(struct wt_status *s)
{
+ unsigned char sha1[20];
+ s->is_initial = get_sha1(s->reference, sha1) ? 1 : 0;
+
if (s->branch)
color_printf_ln(color(WT_STATUS_HEADER),
"# On branch %s", s->branch);