]> git.ipfire.org Git - thirdparty/git.git/blobdiff - environment.c
Merge branch '2.16' of https://github.com/ChrisADR/git-po
[thirdparty/git.git] / environment.c
index 8fa032f3074255541dc3f3d926fedf6b1991dd91..63ac38a46f8f01ee3d09ed8e09bd93acba63b21a 100644 (file)
@@ -344,3 +344,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;
+}