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>
Jürgen Rühle committed
Jan 2, 2007 at 20:26 UTC
98bf8a47c296f51ea9722fef4bb81dbfb70cd4bb
1 file changed
+3
-2
wt-status.c
+3
-2
@@ -41,8 +41,6 @@ void wt_status_prepare(struct wt_status *s)
41
unsigned char sha1[20];
42
const char *head;
43
44
- s->is_initial = get_sha1("HEAD", sha1) ? 1 : 0;
45
-
44
head = resolve_ref("HEAD", sha1, 0, NULL);
45
s->branch = head ? xstrdup(head) : NULL;
46
@@ -277,6 +275,9 @@ static void wt_status_print_verbose(struct wt_status *s)
275
276
void wt_status_print(struct wt_status *s)
277
{
278
+ unsigned char sha1[20];
279
+ s->is_initial = get_sha1(s->reference, sha1) ? 1 : 0;
280
+
281
if (s->branch)
282
color_printf_ln(color(WT_STATUS_HEADER),
283
"# On branch %s", s->branch);