t: test fetch/prune diff parsing with ANSI escapes

We set the "color.diff" Git configuration directive to "always"
in several tests which exercise the scanning and parsing of
"git log -p" output in order to validate that they still
succeed even with ANSI color code escape sequences in the
Git diff output.

Unfortunately, at the present time, the tests will no longer
succeed as a result of this change, but we intend to resolve
that problem in a subsequent commit.
This commit is contained in:
Chris Darroch 2021-08-17 18:31:41 -07:00
parent 314c30dfc0
commit 2752acc925
2 changed files with 18 additions and 0 deletions

@ -105,6 +105,9 @@ begin_test "fetch-recent commits"
git config lfs.fetchrecentremoterefs false
git config lfs.fetchrecentcommitsdays 7
# force color codes in git diff meta-information
git config color.diff always
git lfs fetch --recent origin
# that should have fetched main plus previous state needed within 7 days
# current state

@ -167,6 +167,9 @@ begin_test "prune keep unpushed"
git config lfs.fetchrecentcommitsdays 0 # only keep AT refs, no recents
git config lfs.pruneoffsetdays 2
# force color codes in git diff meta-information
git config color.diff always
git lfs prune
# Now push main and show that older versions on main will be removed
@ -316,6 +319,9 @@ begin_test "prune keep recent"
git config lfs.fetchrecentcommitsdays 1
git config lfs.pruneoffsetdays 1
# force color codes in git diff meta-information
git config color.diff always
# push everything so that's not a reason to retain
git push origin main:main branch_old:branch_old branch1:branch1 branch2:branch2
@ -669,6 +675,9 @@ begin_test "prune keep stashed changes"
assert_local_object "$oid_stashed" "${#content_stashed}"
assert_local_object "$oid_stashedbranch" "${#content_stashedbranch}"
# force color codes in git diff meta-information
git config color.diff always
# Prune data, should NOT delete stashed files
git lfs prune
@ -767,6 +776,9 @@ begin_test "prune keep stashed changes in index"
assert_local_object "$oid_indexstashedbranch" "${#content_indexstashedbranch}"
assert_local_object "$oid_stashedbranch" "${#content_stashedbranch}"
# force color codes in git diff meta-information
git config color.diff always
# Prune data, should NOT delete stashed file or stashed changes to index
git lfs prune
@ -884,6 +896,9 @@ begin_test "prune keep stashed untracked files"
assert_local_object "$oid_stashedbranch" "${#content_stashedbranch}"
assert_local_object "$oid_untrackedstashedbranch" "${#content_untrackedstashedbranch}"
# force color codes in git diff meta-information
git config color.diff always
# Prune data, should NOT delete stashed file or stashed changes to index
git lfs prune