File tree Expand file tree Collapse file tree 6 files changed +33
-3
lines changed Expand file tree Collapse file tree 6 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -709,6 +709,15 @@ of clones and fetches.
709
709
the background which do not want to cause lock contention with
710
710
other operations on the repository. Defaults to `1`.
711
711
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
+
712
721
Discussion[[Discussion]]
713
722
------------------------
714
723
Original file line number Diff line number Diff line change @@ -1942,4 +1942,10 @@ void sleep_millisec(int millisec);
1942
1942
*/
1943
1943
void safe_create_dir (const char * dir , int share );
1944
1944
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
+
1945
1951
#endif /* CACHE_H */
Original file line number Diff line number Diff line change @@ -343,3 +343,18 @@ int use_optional_locks(void)
343
343
{
344
344
return git_env_bool (GIT_OPTIONAL_LOCKS_ENVIRONMENT , 1 );
345
345
}
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' '
19
19
git update-index --add sub1 &&
20
20
git add sub2 &&
21
21
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 &&
23
23
git branch save HEAD &&
24
24
cat >expected <<-\EOF &&
25
25
:000000 160000 00000... A sub1
Original file line number Diff line number Diff line change 131
131
test_expect_success " git $cmd " '
132
132
{
133
133
echo "\$ git $cmd"
134
- git $cmd |
134
+ GIT_PRINT_SHA1_ELLIPSIS="yes" git $cmd |
135
135
sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \
136
136
-e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
137
137
echo "\$"
Original file line number Diff line number Diff line change @@ -876,7 +876,7 @@ test_expect_success 'L: verify internal tree sorting' '
876
876
EXPECT_END
877
877
878
878
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 &&
880
880
test_cmp expect output
881
881
'
882
882
You can’t perform that action at this time.
0 commit comments