summary refs log tree commit diff
path: root/wt-status.c
diff options
context:
space:
mode:
author徐沛文 (Aleen) <aleen42@vip.qq.com>2021-12-09 07:25:55 +0000
committerJunio C Hamano <gitster@pobox.com>2021-12-15 17:04:19 -0800
commit9e7e41bf19ed10469f9adb60669b1699c81b8ea6 (patch)
tree38c8ff55fb6b3b4280b09c6b87dcbdfa96da0d3a /wt-status.c
parent7c096b8d61e1276acb6f84bf446cfe74578382a0 (diff)
am: support --allow-empty to record specific empty patches
This option helps to record specific empty patches in the middle
of an am session, which does create empty commits only when:

    1. the index has not changed
    2. lacking a branch

When the index has changed, "--allow-empty" will create a non-empty
commit like passing "--continue" or "--resolved".

Signed-off-by: 徐沛文 (Aleen) <aleen42@vip.qq.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/wt-status.c b/wt-status.c
index e4f29b2b4c..09045c62e1 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1212,17 +1212,23 @@ static void show_merge_in_progress(struct wt_status *s,
 static void show_am_in_progress(struct wt_status *s,
 				const char *color)
 {
+	int am_empty_patch;
+
 	status_printf_ln(s, color,
 		_("You are in the middle of an am session."));
 	if (s->state.am_empty_patch)
 		status_printf_ln(s, color,
 			_("The current patch is empty."));
 	if (s->hints) {
-		if (!s->state.am_empty_patch)
+		am_empty_patch = s->state.am_empty_patch;
+		if (!am_empty_patch)
 			status_printf_ln(s, color,
 				_("  (fix conflicts and then run \"git am --continue\")"));
 		status_printf_ln(s, color,
 			_("  (use \"git am --skip\" to skip this patch)"));
+		if (am_empty_patch)
+			status_printf_ln(s, color,
+				_("  (use \"git am --allow-empty\" to record this patch as an empty commit)"));
 		status_printf_ln(s, color,
 			_("  (use \"git am --abort\" to restore the original branch)"));
 	}