Skip to content

Commit 98bf8a4

Browse files
j-rJunio C Hamano
authored andcommitted
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>
1 parent 6e458bf commit 98bf8a4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

wt-status.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ void wt_status_prepare(struct wt_status *s)
4141
unsigned char sha1[20];
4242
const char *head;
4343

44-
s->is_initial = get_sha1("HEAD", sha1) ? 1 : 0;
45-
4644
head = resolve_ref("HEAD", sha1, 0, NULL);
4745
s->branch = head ? xstrdup(head) : NULL;
4846

@@ -277,6 +275,9 @@ static void wt_status_print_verbose(struct wt_status *s)
277275

278276
void wt_status_print(struct wt_status *s)
279277
{
278+
unsigned char sha1[20];
279+
s->is_initial = get_sha1(s->reference, sha1) ? 1 : 0;
280+
280281
if (s->branch)
281282
color_printf_ln(color(WT_STATUS_HEADER),
282283
"# On branch %s", s->branch);

0 commit comments

Comments
 (0)