MCPcopy Create free account
hub / github.com/git/git / wt_longstatus_print_unmerged_header

Function wt_longstatus_print_unmerged_header

wt-status.c:170–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170static void wt_longstatus_print_unmerged_header(struct wt_status *s)
171{
172 int i;
173 int del_mod_conflict = 0;
174 int both_deleted = 0;
175 int not_deleted = 0;
176 const char *c = color(WT_STATUS_HEADER, s);
177
178 status_printf_ln(s, c, _("Unmerged paths:"));
179
180 for (i = 0; i < s->change.nr; i++) {
181 struct string_list_item *it = &(s->change.items[i]);
182 struct wt_status_change_data *d = it->util;
183
184 switch (d->stagemask) {
185 case 0:
186 break;
187 case 1:
188 both_deleted = 1;
189 break;
190 case 3:
191 case 5:
192 del_mod_conflict = 1;
193 break;
194 default:
195 not_deleted = 1;
196 break;
197 }
198 }
199
200 if (!s->hints)
201 return;
202 if (s->whence != FROM_COMMIT)
203 ;
204 else if (!s->is_initial) {
205 if (!strcmp(s->reference, "HEAD"))
206 status_printf_ln(s, c,
207 _(" (use \"git restore --staged <file>...\" to unstage)"));
208 else
209 status_printf_ln(s, c,
210 _(" (use \"git restore --source=%s --staged <file>...\" to unstage)"),
211 s->reference);
212 } else
213 status_printf_ln(s, c, _(" (use \"git rm --cached <file>...\" to unstage)"));
214
215 if (!both_deleted) {
216 if (!del_mod_conflict)
217 status_printf_ln(s, c, _(" (use \"git add <file>...\" to mark resolution)"));
218 else
219 status_printf_ln(s, c, _(" (use \"git add/rm <file>...\" as appropriate to mark resolution)"));
220 } else if (!del_mod_conflict && !not_deleted) {
221 status_printf_ln(s, c, _(" (use \"git rm <file>...\" to mark resolution)"));
222 } else {
223 status_printf_ln(s, c, _(" (use \"git add/rm <file>...\" as appropriate to mark resolution)"));
224 }
225}
226
227static void wt_longstatus_print_cached_header(struct wt_status *s)

Callers 1

Calls 2

status_printf_lnFunction · 0.85
colorFunction · 0.70

Tested by

no test coverage detected