git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/4] Support --amend on initial commit in status output

From
JRJuergen Ruehle <j.ruehle@bmiag.de>
Date
Jan 2, 2007, 19:26 UTC
Message-ID
<11677659961794-git-send-email-j.ruehle@bmiag.de>
In-Reply-To
<1167765983316-git-send-email-j.ruehle@bmiag.de>
From: =?iso-8859-1?q?J=FCrgen_R=FChle?= <j-r@online.de>

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>
---
 wt-status.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index 302f7ee..166d0e3 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;
 
@@ -287,6 +285,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);
-- 
1.5.0.rc0.g31e2
Previous: Juergen RuehleNext: Junio C Hamano
Message 12 of 15 in “Assorted small changes to runstatus”
  1. Assorted small changes to runstatusJuergen Ruehle, Jan 2, 2007
  2. 1/4 Clarify syntax and role of git-add in status outputJuergen Ruehle, Jan 2, 2007
  3. 2/4 Improve cached content header of status outputJuergen Ruehle, Jan 2, 2007
  4. Andy WhitcroftJan 5, 2007
  5. Junio C HamanoJan 5, 2007
  6. Andy WhitcroftJan 5, 2007
  7. Juergen RuehleJan 5, 2007
  8. Junio C HamanoJan 5, 2007
  9. Andy WhitcroftJan 8, 2007
  10. Juergen RuehleJan 8, 2007
  11. 3/4 Improve "nothing to commit" part of status outputJuergen Ruehle, Jan 2, 2007
  12. 4/4 Support --amend on initial commit in status outputJuergen Ruehle, Jan 2, 2007
  13. Junio C HamanoJan 3, 2007
  14. Juergen RuehleJan 3, 2007
  15. Remove unnecessary git-rm --cached reference from status outputJuergen Ruehle, Jan 7, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.