File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -709,6 +709,15 @@ of clones and fetches.
709709 the background which do not want to cause lock contention with
710710 other operations on the repository. Defaults to `1`.
711711
712+ `GIT_PRINT_SHA1_ELLIPSIS` (deprecated)::
713+ If set to `yes`, print an ellipsis following an
714+ (abbreviated) SHA-1 value. This affects indications of
715+ detached HEADs (linkgit:git-checkout[1]) and the raw
716+ diff output (linkgit:git-diff[1]). Printing an
717+ ellipsis in the cases mentioned is no longer considered
718+ adequate and support for it is likely to be removed in the
719+ foreseeable future (along with the variable).
720+
712721Discussion[[Discussion]]
713722------------------------
714723
Original file line number Diff line number Diff line change @@ -1942,4 +1942,10 @@ void sleep_millisec(int millisec);
19421942 */
19431943void safe_create_dir (const char * dir , int share );
19441944
1945+ /*
1946+ * Should we print an ellipsis after an abbreviated SHA-1 value
1947+ * when doing diff-raw output or indicating a detached HEAD?
1948+ */
1949+ extern int print_sha1_ellipsis (void );
1950+
19451951#endif /* CACHE_H */
Original file line number Diff line number Diff line change @@ -343,3 +343,18 @@ int use_optional_locks(void)
343343{
344344 return git_env_bool (GIT_OPTIONAL_LOCKS_ENVIRONMENT , 1 );
345345}
346+
347+ int print_sha1_ellipsis (void )
348+ {
349+ /*
350+ * Determine if the calling environment contains the variable
351+ * GIT_PRINT_SHA1_ELLIPSIS set to "yes".
352+ */
353+ static int cached_result = -1 ; /* unknown */
354+
355+ if (cached_result < 0 ) {
356+ const char * v = getenv ("GIT_PRINT_SHA1_ELLIPSIS" );
357+ cached_result = (v && !strcasecmp (v , "yes" ));
358+ }
359+ return cached_result ;
360+ }
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ test_expect_success 'setup: create subprojects' '
1919 git update-index --add sub1 &&
2020 git add sub2 &&
2121 git commit -q -m "subprojects added" &&
22- git diff-tree --abbrev=5 HEAD^ HEAD |cut -d" " -f-3,5- >current &&
22+ GIT_PRINT_SHA1_ELLIPSIS="yes" git diff-tree --abbrev=5 HEAD^ HEAD |cut -d" " -f-3,5- >current &&
2323 git branch save HEAD &&
2424 cat >expected <<-\EOF &&
2525 :000000 160000 00000... A sub1
Original file line number Diff line number Diff line change 131131 test_expect_success " git $cmd " '
132132 {
133133 echo "\$ git $cmd"
134- git $cmd |
134+ GIT_PRINT_SHA1_ELLIPSIS="yes" git $cmd |
135135 sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \
136136 -e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
137137 echo "\$"
Original file line number Diff line number Diff line change @@ -876,7 +876,7 @@ test_expect_success 'L: verify internal tree sorting' '
876876 EXPECT_END
877877
878878 git fast-import <input &&
879- git diff-tree --abbrev --raw L^ L >output &&
879+ GIT_PRINT_SHA1_ELLIPSIS="yes" git diff-tree --abbrev --raw L^ L >output &&
880880 test_cmp expect output
881881'
882882
You can’t perform that action at this time.
0 commit comments