Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnn T Ropea <bedhanger@gmx.de>2017-12-04 00:27:39 +0300
committerJunio C Hamano <gitster@pobox.com>2017-12-04 19:25:35 +0300
commita2cd709de314a7bfa038e14fd36f1d21077b4173 (patch)
tree49da7a18df71cc8cf4f3e6d1a05e44c1b654717a /environment.c
parentf61d89e1009da8025794057ca87c21e277d380fa (diff)
print_sha1_ellipsis: introduce helper
Introduce a helper print_sha1_ellipsis() that pays attention to the GIT_PRINT_SHA1_ELLIPSIS environment variable, and prepare the tests to unconditionally set it for the test pieces that will be broken once the code stops showing the extra dots by default. The removal of these dots is merely a plan at this step and has not happened yet but soon will. Document GIT_PRINT_SHA1_ELLIPSIS. Signed-off-by: Ann T Ropea <bedhanger@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'environment.c')
-rw-r--r--environment.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/environment.c b/environment.c
index 8289c25b44..a3abdd3c58 100644
--- a/environment.c
+++ b/environment.c
@@ -343,3 +343,18 @@ int use_optional_locks(void)
{
return git_env_bool(GIT_OPTIONAL_LOCKS_ENVIRONMENT, 1);
}
+
+int print_sha1_ellipsis(void)
+{
+ /*
+ * Determine if the calling environment contains the variable
+ * GIT_PRINT_SHA1_ELLIPSIS set to "yes".
+ */
+ static int cached_result = -1; /* unknown */
+
+ if (cached_result < 0) {
+ const char *v = getenv("GIT_PRINT_SHA1_ELLIPSIS");
+ cached_result = (v && !strcasecmp(v, "yes"));
+ }
+ return cached_result;
+}