summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/wt-status.c b/wt-status.c
index dd5270647e..cc6f94504d 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -19,6 +19,8 @@
#include "lockfile.h"
#include "sequencer.h"
+#define AB_DELAY_WARNING_IN_MS (2 * 1000)
+
static const char cut_line[] =
"------------------------ >8 ------------------------\n";
@@ -200,7 +202,6 @@ static void wt_longstatus_print_unmerged_header(struct wt_status *s)
} else {
status_printf_ln(s, c, _(" (use \"git add/rm <file>...\" as appropriate to mark resolution)"));
}
- status_printf_ln(s, c, "%s", "");
}
static void wt_longstatus_print_cached_header(struct wt_status *s)
@@ -222,7 +223,6 @@ static void wt_longstatus_print_cached_header(struct wt_status *s)
s->reference);
} else
status_printf_ln(s, c, _(" (use \"git rm --cached <file>...\" to unstage)"));
- status_printf_ln(s, c, "%s", "");
}
static void wt_longstatus_print_dirty_header(struct wt_status *s,
@@ -241,7 +241,6 @@ static void wt_longstatus_print_dirty_header(struct wt_status *s,
status_printf_ln(s, c, _(" (use \"git restore <file>...\" to discard changes in working directory)"));
if (has_dirty_submodules)
status_printf_ln(s, c, _(" (commit or discard the untracked or modified content in submodules)"));
- status_printf_ln(s, c, "%s", "");
}
static void wt_longstatus_print_other_header(struct wt_status *s,
@@ -253,7 +252,6 @@ static void wt_longstatus_print_other_header(struct wt_status *s,
if (!s->hints)
return;
status_printf_ln(s, c, _(" (use \"git %s <file>...\" to include in what will be committed)"), how);
- status_printf_ln(s, c, "%s", "");
}
static void wt_longstatus_print_trailer(struct wt_status *s)
@@ -1097,14 +1095,29 @@ static void wt_longstatus_print_tracking(struct wt_status *s)
struct branch *branch;
char comment_line_string[3];
int i;
+ uint64_t t_begin = 0;
assert(s->branch && !s->is_initial);
if (!skip_prefix(s->branch, "refs/heads/", &branch_name))
return;
branch = branch_get(branch_name);
+
+ t_begin = getnanotime();
+
if (!format_tracking_info(branch, &sb, s->ahead_behind_flags))
return;
+ if (advice_status_ahead_behind_warning &&
+ s->ahead_behind_flags == AHEAD_BEHIND_FULL) {
+ uint64_t t_delta_in_ms = (getnanotime() - t_begin) / 1000000;
+ if (t_delta_in_ms > AB_DELAY_WARNING_IN_MS) {
+ strbuf_addf(&sb, _("\n"
+ "It took %.2f seconds to compute the branch ahead/behind values.\n"
+ "You can use '--no-ahead-behind' to avoid this.\n"),
+ t_delta_in_ms / 1000.0);
+ }
+ }
+
i = 0;
if (s->display_comment_prefix) {
comment_line_string[i++] = comment_line_char;
@@ -1421,6 +1434,8 @@ static void show_cherry_pick_in_progress(struct wt_status *s,
status_printf_ln(s, color,
_(" (all conflicts fixed: run \"git cherry-pick --continue\")"));
status_printf_ln(s, color,
+ _(" (use \"git cherry-pick --skip\" to skip this patch)"));
+ status_printf_ln(s, color,
_(" (use \"git cherry-pick --abort\" to cancel the cherry-pick operation)"));
}
wt_longstatus_print_trailer(s);
@@ -1448,6 +1463,8 @@ static void show_revert_in_progress(struct wt_status *s,
status_printf_ln(s, color,
_(" (all conflicts fixed: run \"git revert --continue\")"));
status_printf_ln(s, color,
+ _(" (use \"git revert --skip\" to skip this patch)"));
+ status_printf_ln(s, color,
_(" (use \"git revert --abort\" to cancel the revert operation)"));
}
wt_longstatus_print_trailer(s);
@@ -2012,7 +2029,7 @@ static void wt_porcelain_v2_print_tracking(struct wt_status *s)
char eol = s->null_termination ? '\0' : '\n';
fprintf(s->fp, "# branch.oid %s%c",
- (s->is_initial ? "(initial)" : sha1_to_hex(s->sha1_commit)),
+ (s->is_initial ? "(initial)" : oid_to_hex(&s->oid_commit)),
eol);
if (!s->branch)