From: "Jeff Hostetler via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Jeff Hostetler <jeffhost@microsoft.com>
Subject: [PATCH 05/11] status: add warning when a/b calculation takes too long for long/normal format
Date: Mon, 03 Jun 2019 13:18:22 -0700 (PDT) [thread overview]
Message-ID: <d2e5cf185711385643999493fcfbcf03afe13e34.1559593097.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.254.git.gitgitgadget@gmail.com>
From: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
advice.c | 2 ++
advice.h | 1 +
wt-status.c | 17 +++++++++++++++++
3 files changed, 20 insertions(+)
diff --git a/advice.c b/advice.c
index ce5f374ecd..54f8dea30c 100644
--- a/advice.c
+++ b/advice.c
@@ -12,6 +12,7 @@ int advice_push_needs_force = 1;
int advice_push_unqualified_ref_name = 1;
int advice_status_hints = 1;
int advice_status_u_option = 1;
+int advice_status_ahead_behind_warning = 1;
int advice_commit_before_merge = 1;
int advice_reset_quiet_warning = 1;
int advice_resolve_conflict = 1;
@@ -68,6 +69,7 @@ static struct {
{ "pushUnqualifiedRefName", &advice_push_unqualified_ref_name },
{ "statusHints", &advice_status_hints },
{ "statusUoption", &advice_status_u_option },
+ { "statusAheadBehindWarning", &advice_status_ahead_behind_warning },
{ "commitBeforeMerge", &advice_commit_before_merge },
{ "resetQuiet", &advice_reset_quiet_warning },
{ "resolveConflict", &advice_resolve_conflict },
diff --git a/advice.h b/advice.h
index e50f02cdfe..c86de9b9b8 100644
--- a/advice.h
+++ b/advice.h
@@ -12,6 +12,7 @@ extern int advice_push_needs_force;
extern int advice_push_unqualified_ref_name;
extern int advice_status_hints;
extern int advice_status_u_option;
+extern int advice_status_ahead_behind_warning;
extern int advice_commit_before_merge;
extern int advice_reset_quiet_warning;
extern int advice_resolve_conflict;
diff --git a/wt-status.c b/wt-status.c
index d2a1bec226..c94d43879a 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";
@@ -1085,14 +1087,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;
--
gitgitgadget
next prev parent reply other threads:[~2019-06-03 20:18 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-03 20:18 [PATCH 00/11] [RFC] Create 'core.size=large' setting to update config defaults Derrick Stolee via GitGitGadget
2019-06-03 20:18 ` [PATCH 01/11] repo-settings: create repo.size=large setting Derrick Stolee via GitGitGadget
2019-06-03 20:42 ` Jeff Hostetler
2019-06-03 20:18 ` [PATCH 03/11] repo-settings: pack.useSparse=true Derrick Stolee via GitGitGadget
2019-06-03 20:18 ` [PATCH 02/11] repo-settings: use index.version=4 by default Derrick Stolee via GitGitGadget
2019-06-03 20:18 ` [PATCH 04/11] status: add status.aheadbehind setting Jeff Hostetler via GitGitGadget
2019-06-03 20:18 ` Jeff Hostetler via GitGitGadget [this message]
2019-06-03 20:18 ` [PATCH 07/11] repo-settings: status.aheadBehind=false Derrick Stolee via GitGitGadget
2019-06-03 20:18 ` [PATCH 06/11] status: ignore status.aheadbehind in porcelain formats Jeff Hostetler via GitGitGadget
2019-06-03 20:18 ` [PATCH 08/11] fetch: add --[no-]show-forced-updates argument Derrick Stolee via GitGitGadget
2019-06-03 20:18 ` [PATCH 09/11] fetch: warn about forced updates after branch list Derrick Stolee via GitGitGadget
2019-06-03 20:18 ` [PATCH 10/11] pull: add --[no-]show-forced-updates passthrough to fetch Derrick Stolee via GitGitGadget
2019-06-03 20:18 ` [PATCH 11/11] repo-settings: fetch.showForcedUpdates=false Derrick Stolee via GitGitGadget
2019-06-03 20:55 ` [PATCH 00/11] [RFC] Create 'core.size=large' setting to update config defaults Derrick Stolee
2019-06-04 14:43 ` Johannes Schindelin
2019-06-04 14:56 ` Derrick Stolee
2019-06-05 20:39 ` Junio C Hamano
2019-06-06 12:23 ` Derrick Stolee
2019-06-06 16:07 ` Junio C Hamano
2019-06-19 15:11 ` [PATCH v2 0/3] [RFC] Create 'core.featureAdoptionRate' " Derrick Stolee via GitGitGadget
2019-06-19 15:12 ` [PATCH v2 1/3] repo-settings: create core.featureAdoptionRate setting Derrick Stolee via GitGitGadget
2019-06-28 20:50 ` Junio C Hamano
2019-06-28 21:08 ` Derrick Stolee
2019-06-28 21:42 ` Junio C Hamano
2019-06-29 1:43 ` Derrick Stolee
2019-06-30 18:35 ` Carlo Arenas
2019-07-01 12:45 ` Derrick Stolee
2019-07-02 10:47 ` Ævar Arnfjörð Bjarmason
2019-07-02 11:09 ` Duy Nguyen
2019-07-02 14:54 ` Derrick Stolee
2019-07-02 16:59 ` Junio C Hamano
2019-06-19 15:12 ` [PATCH v2 2/3] repo-settings: use index.version=4 by default Derrick Stolee via GitGitGadget
2019-06-19 15:12 ` [PATCH v2 3/3] repo-settings: pack.useSparse=true Derrick Stolee via GitGitGadget
2019-07-01 14:29 ` [PATCH v3 0/3] [RFC] Create 'core.featureAdoptionRate' setting to update config defaults Derrick Stolee via GitGitGadget
2019-07-01 14:29 ` [PATCH v3 1/3] repo-settings: create core.featureAdoptionRate setting Derrick Stolee via GitGitGadget
2019-07-01 23:27 ` Carlo Arenas
2019-07-02 9:20 ` Duy Nguyen
2019-07-02 10:53 ` Ævar Arnfjörð Bjarmason
2019-07-04 22:47 ` Jakub Narebski
2019-07-01 14:29 ` [PATCH v3 2/3] repo-settings: use index.version=4 by default Derrick Stolee via GitGitGadget
2019-07-01 14:29 ` [PATCH v3 3/3] repo-settings: pack.useSparse=true Derrick Stolee via GitGitGadget
2019-07-08 19:22 ` [PATCH v3 0/3] [RFC] Create 'core.featureAdoptionRate' setting to update config defaults Derrick Stolee
2019-07-09 18:55 ` Taylor Blau
2019-07-09 19:21 ` Junio C Hamano
2019-07-09 19:45 ` Derrick Stolee
2019-07-09 22:05 ` Junio C Hamano
2019-07-22 12:10 ` Derrick Stolee
2019-07-11 21:54 ` Jakub Narebski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d2e5cf185711385643999493fcfbcf03afe13e34.1559593097.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jeffhost@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).