diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-12-19 11:33:58 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-12-19 11:33:58 -0800 |
commit | 8d7fefaac4318ac3155368f475e10f97714ebd47 (patch) | |
tree | 225f9c262ffa4d1bcd58a2b407df396594a711cb /environment.c | |
parent | 66d3f19324ac9eeae8ef0d2ae2067ae7b18f8ac8 (diff) | |
parent | 64a5e98032d2462749021136a53d9e1928cd0db0 (diff) | |
download | git-8d7fefaac4318ac3155368f475e10f97714ebd47.tar.gz |
Merge branch 'ar/unconfuse-three-dots'
Ancient part of codebase still shows dots after an abbreviated
object name just to show that it is not a full object name, but
these ellipses are confusing to people who newly discovered Git
who are used to seeing abbreviated object names and find them
confusing with the range syntax.
* ar/unconfuse-three-dots:
t2020: test variations that matter
t4013: test new output from diff --abbrev --raw
diff: diff_aligned_abbrev: remove ellipsis after abbreviated SHA-1 value
t4013: prepare for upcoming "diff --raw --abbrev" output format change
checkout: describe_detached_head: remove ellipsis after committish
print_sha1_ellipsis: introduce helper
Documentation: user-manual: limit usage of ellipsis
Documentation: revisions: fix typo: "three dot" ---> "three-dot" (in line with "two-dot").
Diffstat (limited to 'environment.c')
-rw-r--r-- | environment.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/environment.c b/environment.c index 8fa032f307..63ac38a46f 100644 --- a/environment.c +++ b/environment.c @@ -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; +} |