@@ -42,10 +42,10 @@ static struct patch_mode patch_mode_add = {
4242 .apply_args = { "--cached" , NULL },
4343 .apply_check_args = { "--cached" , NULL },
4444 .prompt_mode = {
45- N_ ("Stage mode change [y,n,q,a,d%s,?]? " ),
46- N_ ("Stage deletion [y,n,q,a,d%s,?]? " ),
47- N_ ("Stage addition [y,n,q,a,d%s,?]? " ),
48- N_ ("Stage this hunk [y,n,q,a,d%s,?]? " )
45+ N_ ("Stage mode change%s [y,n,q,a,d%s,?]? " ),
46+ N_ ("Stage deletion%s [y,n,q,a,d%s,?]? " ),
47+ N_ ("Stage addition%s [y,n,q,a,d%s,?]? " ),
48+ N_ ("Stage this hunk%s [y,n,q,a,d%s,?]? " )
4949 },
5050 .edit_hunk_hint = N_ ("If the patch applies cleanly, the edited hunk "
5151 "will immediately be marked for staging." ),
@@ -64,10 +64,10 @@ static struct patch_mode patch_mode_stash = {
6464 .apply_args = { "--cached" , NULL },
6565 .apply_check_args = { "--cached" , NULL },
6666 .prompt_mode = {
67- N_ ("Stash mode change [y,n,q,a,d%s,?]? " ),
68- N_ ("Stash deletion [y,n,q,a,d%s,?]? " ),
69- N_ ("Stash addition [y,n,q,a,d%s,?]? " ),
70- N_ ("Stash this hunk [y,n,q,a,d%s,?]? " ),
67+ N_ ("Stash mode change%s [y,n,q,a,d%s,?]? " ),
68+ N_ ("Stash deletion%s [y,n,q,a,d%s,?]? " ),
69+ N_ ("Stash addition%s [y,n,q,a,d%s,?]? " ),
70+ N_ ("Stash this hunk%s [y,n,q,a,d%s,?]? " ),
7171 },
7272 .edit_hunk_hint = N_ ("If the patch applies cleanly, the edited hunk "
7373 "will immediately be marked for stashing." ),
@@ -88,10 +88,10 @@ static struct patch_mode patch_mode_reset_head = {
8888 .is_reverse = 1 ,
8989 .index_only = 1 ,
9090 .prompt_mode = {
91- N_ ("Unstage mode change [y,n,q,a,d%s,?]? " ),
92- N_ ("Unstage deletion [y,n,q,a,d%s,?]? " ),
93- N_ ("Unstage addition [y,n,q,a,d%s,?]? " ),
94- N_ ("Unstage this hunk [y,n,q,a,d%s,?]? " ),
91+ N_ ("Unstage mode change%s [y,n,q,a,d%s,?]? " ),
92+ N_ ("Unstage deletion%s [y,n,q,a,d%s,?]? " ),
93+ N_ ("Unstage addition%s [y,n,q,a,d%s,?]? " ),
94+ N_ ("Unstage this hunk%s [y,n,q,a,d%s,?]? " ),
9595 },
9696 .edit_hunk_hint = N_ ("If the patch applies cleanly, the edited hunk "
9797 "will immediately be marked for unstaging." ),
@@ -111,10 +111,10 @@ static struct patch_mode patch_mode_reset_nothead = {
111111 .apply_check_args = { "--cached" , NULL },
112112 .index_only = 1 ,
113113 .prompt_mode = {
114- N_ ("Apply mode change to index [y,n,q,a,d%s,?]? " ),
115- N_ ("Apply deletion to index [y,n,q,a,d%s,?]? " ),
116- N_ ("Apply addition to index [y,n,q,a,d%s,?]? " ),
117- N_ ("Apply this hunk to index [y,n,q,a,d%s,?]? " ),
114+ N_ ("Apply mode change to index%s [y,n,q,a,d%s,?]? " ),
115+ N_ ("Apply deletion to index%s [y,n,q,a,d%s,?]? " ),
116+ N_ ("Apply addition to index%s [y,n,q,a,d%s,?]? " ),
117+ N_ ("Apply this hunk to index%s [y,n,q,a,d%s,?]? " ),
118118 },
119119 .edit_hunk_hint = N_ ("If the patch applies cleanly, the edited hunk "
120120 "will immediately be marked for applying." ),
@@ -134,10 +134,10 @@ static struct patch_mode patch_mode_checkout_index = {
134134 .apply_check_args = { "-R" , NULL },
135135 .is_reverse = 1 ,
136136 .prompt_mode = {
137- N_ ("Discard mode change from worktree [y,n,q,a,d%s,?]? " ),
138- N_ ("Discard deletion from worktree [y,n,q,a,d%s,?]? " ),
139- N_ ("Discard addition from worktree [y,n,q,a,d%s,?]? " ),
140- N_ ("Discard this hunk from worktree [y,n,q,a,d%s,?]? " ),
137+ N_ ("Discard mode change from worktree%s [y,n,q,a,d%s,?]? " ),
138+ N_ ("Discard deletion from worktree%s [y,n,q,a,d%s,?]? " ),
139+ N_ ("Discard addition from worktree%s [y,n,q,a,d%s,?]? " ),
140+ N_ ("Discard this hunk from worktree%s [y,n,q,a,d%s,?]? " ),
141141 },
142142 .edit_hunk_hint = N_ ("If the patch applies cleanly, the edited hunk "
143143 "will immediately be marked for discarding." ),
@@ -157,10 +157,10 @@ static struct patch_mode patch_mode_checkout_head = {
157157 .apply_check_args = { "-R" , NULL },
158158 .is_reverse = 1 ,
159159 .prompt_mode = {
160- N_ ("Discard mode change from index and worktree [y,n,q,a,d%s,?]? " ),
161- N_ ("Discard deletion from index and worktree [y,n,q,a,d%s,?]? " ),
162- N_ ("Discard addition from index and worktree [y,n,q,a,d%s,?]? " ),
163- N_ ("Discard this hunk from index and worktree [y,n,q,a,d%s,?]? " ),
160+ N_ ("Discard mode change from index and worktree%s [y,n,q,a,d%s,?]? " ),
161+ N_ ("Discard deletion from index and worktree%s [y,n,q,a,d%s,?]? " ),
162+ N_ ("Discard addition from index and worktree%s [y,n,q,a,d%s,?]? " ),
163+ N_ ("Discard this hunk from index and worktree%s [y,n,q,a,d%s,?]? " ),
164164 },
165165 .edit_hunk_hint = N_ ("If the patch applies cleanly, the edited hunk "
166166 "will immediately be marked for discarding." ),
@@ -179,10 +179,10 @@ static struct patch_mode patch_mode_checkout_nothead = {
179179 .apply_for_checkout = 1 ,
180180 .apply_check_args = { NULL },
181181 .prompt_mode = {
182- N_ ("Apply mode change to index and worktree [y,n,q,a,d%s,?]? " ),
183- N_ ("Apply deletion to index and worktree [y,n,q,a,d%s,?]? " ),
184- N_ ("Apply addition to index and worktree [y,n,q,a,d%s,?]? " ),
185- N_ ("Apply this hunk to index and worktree [y,n,q,a,d%s,?]? " ),
182+ N_ ("Apply mode change to index and worktree%s [y,n,q,a,d%s,?]? " ),
183+ N_ ("Apply deletion to index and worktree%s [y,n,q,a,d%s,?]? " ),
184+ N_ ("Apply addition to index and worktree%s [y,n,q,a,d%s,?]? " ),
185+ N_ ("Apply this hunk to index and worktree%s [y,n,q,a,d%s,?]? " ),
186186 },
187187 .edit_hunk_hint = N_ ("If the patch applies cleanly, the edited hunk "
188188 "will immediately be marked for applying." ),
@@ -202,10 +202,10 @@ static struct patch_mode patch_mode_worktree_head = {
202202 .apply_check_args = { "-R" , NULL },
203203 .is_reverse = 1 ,
204204 .prompt_mode = {
205- N_ ("Discard mode change from worktree [y,n,q,a,d%s,?]? " ),
206- N_ ("Discard deletion from worktree [y,n,q,a,d%s,?]? " ),
207- N_ ("Discard addition from worktree [y,n,q,a,d%s,?]? " ),
208- N_ ("Discard this hunk from worktree [y,n,q,a,d%s,?]? " ),
205+ N_ ("Discard mode change from worktree%s [y,n,q,a,d%s,?]? " ),
206+ N_ ("Discard deletion from worktree%s [y,n,q,a,d%s,?]? " ),
207+ N_ ("Discard addition from worktree%s [y,n,q,a,d%s,?]? " ),
208+ N_ ("Discard this hunk from worktree%s [y,n,q,a,d%s,?]? " ),
209209 },
210210 .edit_hunk_hint = N_ ("If the patch applies cleanly, the edited hunk "
211211 "will immediately be marked for discarding." ),
@@ -224,10 +224,10 @@ static struct patch_mode patch_mode_worktree_nothead = {
224224 .apply_args = { NULL },
225225 .apply_check_args = { NULL },
226226 .prompt_mode = {
227- N_ ("Apply mode change to worktree [y,n,q,a,d%s,?]? " ),
228- N_ ("Apply deletion to worktree [y,n,q,a,d%s,?]? " ),
229- N_ ("Apply addition to worktree [y,n,q,a,d%s,?]? " ),
230- N_ ("Apply this hunk to worktree [y,n,q,a,d%s,?]? " ),
227+ N_ ("Apply mode change to worktree%s [y,n,q,a,d%s,?]? " ),
228+ N_ ("Apply deletion to worktree%s [y,n,q,a,d%s,?]? " ),
229+ N_ ("Apply addition to worktree%s [y,n,q,a,d%s,?]? " ),
230+ N_ ("Apply this hunk to worktree%s [y,n,q,a,d%s,?]? " ),
231231 },
232232 .edit_hunk_hint = N_ ("If the patch applies cleanly, the edited hunk "
233233 "will immediately be marked for applying." ),
@@ -1460,6 +1460,7 @@ static int patch_update_file(struct add_p_state *s,
14601460 render_diff_header (s , file_diff , colored , & s -> buf );
14611461 fputs (s -> buf .buf , stdout );
14621462 for (;;) {
1463+ const char * hunk_use_decision = "" ;
14631464 enum {
14641465 ALLOW_GOTO_PREVIOUS_HUNK = 1 << 0 ,
14651466 ALLOW_GOTO_PREVIOUS_UNDECIDED_HUNK = 1 << 1 ,
@@ -1564,8 +1565,14 @@ static int patch_update_file(struct add_p_state *s,
15641565 (uintmax_t )(file_diff -> hunk_nr
15651566 ? file_diff -> hunk_nr
15661567 : 1 ));
1568+ if (hunk -> use != UNDECIDED_HUNK ) {
1569+ if (hunk -> use == USE_HUNK )
1570+ hunk_use_decision = _ (" (was: y)" );
1571+ else
1572+ hunk_use_decision = _ (" (was: n)" );
1573+ }
15671574 printf (_ (s -> mode -> prompt_mode [prompt_mode_type ]),
1568- s -> buf .buf );
1575+ hunk_use_decision , s -> buf .buf );
15691576 if (* s -> s .reset_color_interactive )
15701577 fputs (s -> s .reset_color_interactive , stdout );
15711578 fflush (stdout );
0 commit comments