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>
This commit is contained in:
committed by
Junio C Hamano
parent
f61d89e100
commit
a2cd709de3
@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user