Skip to content

Commit

Permalink
Support --amend on initial commit in status output
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jürgen Rühle authored and Junio C Hamano committed Jan 3, 2007
1 parent 6e458bf commit 98bf8a4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions wt-status.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 98bf8a4

Please sign in to comment.