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

[RFC/PATCH 2/2] rebuash - support for status

From
Edmundo Carmona Antoranz <eantoranz@gmail.com>
Date
Jun 30, 2019, 05:18 UTC
Message-ID
<20190630051816.8814-2-eantoranz@gmail.com>
In-Reply-To
<20190630051816.8814-1-eantoranz@gmail.com>
---
 wt-status.c | 49 +++++++++++++++++++++++++++++++++++++++++++------
 wt-status.h |  1 +
 2 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index 0bccef542f..2a7627b331 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1118,11 +1118,24 @@ static void show_merge_in_progress(struct wt_status *s,
 	if (has_unmerged(s)) {
 		status_printf_ln(s, color, _("You have unmerged paths."));
 		if (s->hints) {
-			status_printf_ln(s, color,
-					 _("  (fix conflicts and run \"git commit\")"));
-			status_printf_ln(s, color,
-					 _("  (use \"git merge --abort\" to abort the merge)"));
+			if (s->state.rebuash_in_progress) {
+				status_printf_ln(s, color,
+						_("  (fix conflicts and run \"git rebuash --continue\")"));
+				status_printf_ln(s, color,
+						_("  (use \"git rebuash --abort\" to abort the operation)"));
+			} else {
+				status_printf_ln(s, color,
+						_("  (fix conflicts and run \"git commit\")"));
+				status_printf_ln(s, color,
+						_("  (use \"git merge --abort\" to abort the merge)"));
+			}
 		}
+	} else if (s->state.rebuash_in_progress) {
+		status_printf_ln(s, color,
+			_("All conflicts fixed but you are still rebuashing."));
+		if (s->hints)
+			status_printf_ln(s, color,
+				_("  (use \"git rebuash --continue\" to conclude rebuash)"));
 	} else {
 		status_printf_ln(s, color,
 			_("All conflicts fixed but you are still merging."));
@@ -1386,6 +1399,15 @@ static void show_rebase_in_progress(struct wt_status *s,
 	wt_longstatus_print_trailer(s);
 }
 
+static void show_rebuash_in_progress(struct wt_status *s,
+				    const char *color)
+{
+	if (&s->state.rebuash_in_progress)
+		status_printf_ln(s, color,
+			_("Rebuash currently in progress."));
+	wt_longstatus_print_trailer(s);
+}
+
 static void show_cherry_pick_in_progress(struct wt_status *s,
 					 const char *color)
 {
@@ -1583,6 +1605,18 @@ int wt_status_check_rebase(const struct worktree *wt,
 	return 1;
 }
 
+int wt_status_check_rebuash(const struct worktree *wt,
+			   struct wt_status_state *state)
+{
+	struct stat st;
+
+	if (!stat(worktree_git_path(wt, "REBUASH_STATE"), &st)) {
+		state->rebuash_in_progress = 1;
+	} else
+		return 0;
+	return 1;
+}
+
 int wt_status_check_bisect(const struct worktree *wt,
 			   struct wt_status_state *state)
 {
@@ -1614,6 +1648,7 @@ void wt_status_get_state(struct repository *r,
 		state->cherry_pick_in_progress = 1;
 		oidcpy(&state->cherry_pick_head_oid, &oid);
 	}
+	wt_status_check_rebuash(NULL, state);
 	wt_status_check_bisect(NULL, state);
 	if (!stat(git_path_revert_head(r), &st) &&
 	    !get_oid("REVERT_HEAD", &oid)) {
@@ -1643,6 +1678,8 @@ static void wt_longstatus_print_state(struct wt_status *s)
 			show_rebase_information(s, state_color);
 			fputs("\n", s->fp);
 		}
+		if (state->rebuash_in_progress)
+			show_rebuash_in_progress(s, state_color);
 		show_merge_in_progress(s, state_color);
 	} else if (state->am_in_progress)
 		show_am_in_progress(s, state_color);
@@ -1688,7 +1725,7 @@ static void wt_longstatus_print(struct wt_status *s)
 		status_printf(s, color(WT_STATUS_HEADER, s), "%s", "");
 		status_printf_more(s, branch_status_color, "%s", on_what);
 		status_printf_more(s, branch_color, "%s\n", branch_name);
-		if (!s->is_initial)
+		if (!(s->is_initial || s->state.rebuash_in_progress))
 			wt_longstatus_print_tracking(s);
 	}
 
@@ -1731,7 +1768,7 @@ static void wt_longstatus_print(struct wt_status *s)
 
 	if (s->verbose)
 		wt_longstatus_print_verbose(s);
-	if (!s->committable) {
+	if (!(s->committable || s->state.rebuash_in_progress)) {
 		if (s->amend)
 			status_printf_ln(s, GIT_COLOR_NORMAL, _("No changes"));
 		else if (s->nowarn)
diff --git a/wt-status.h b/wt-status.h
index 64f1ddc9fd..2995866327 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -72,6 +72,7 @@ struct wt_status_state {
 	int rebase_in_progress;
 	int rebase_interactive_in_progress;
 	int cherry_pick_in_progress;
+	int rebuash_in_progress;
 	int bisect_in_progress;
 	int revert_in_progress;
 	int detached_at;
-- 
2.20.1
Previous: Edmundo Carmona AntoranzNext: Edmundo Carmona Antoranz
Message 2 of 13 in “rebuash - squash/rebase in a single step”
  1. 1/2 rebuash - squash/rebase in a single stepEdmundo Carmona Antoranz, Jun 30, 2019
  2. 2/2 rebuash - support for statusEdmundo Carmona Antoranz, Jun 30, 2019
  3. Edmundo Carmona AntoranzJun 30, 2019
  4. Jeff KingJun 30, 2019
  5. Edmundo Carmona AntoranzJun 30, 2019
  6. Jeff KingJun 30, 2019
  7. Edmundo Carmona AntoranzJul 1, 2019
  8. Junio C HamanoJul 1, 2019
  9. Edmundo Carmona AntoranzJul 1, 2019
  10. Junio C HamanoJul 1, 2019
  11. Derrick StoleeJul 2, 2019
  12. Junio C HamanoJul 2, 2019
  13. Johannes SixtJul 2, 2019

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.