t3404: work around platform-specific behaviour on macOS 10.15

Two of our tests in t3404 use indented HERE docs where leading tabs on some of the lines are actually relevant. The tabs do get removed though, and we try to fix this up by using sed(1) to replace leading tabs in the actual output, as well. But macOS 10.15 uses an oldish version of sed(1) that has BSD lineage, which does not understand "\t", and thus we fail to strip those leading tabs and fail the test. Address this issue by using `q_to_tab` such that we do not have to strip leading tabs from the actual output. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Taylor Blau <me@ttaylorr.com>

Patrick Steinhardt committed Oct 16, 2024 at 10:13 UTC f74949fa3d219d0863109f64191b7165c92fbf43
1 file changed +12 -14
t/t3404-rebase-interactive.sh
+12 -14
@@ -1917,18 +1917,17 @@ test_expect_success '--update-refs updates refs correctly' '
1917 test_cmp_rev HEAD~1 refs/heads/third &&
1918 test_cmp_rev HEAD refs/heads/no-conflict-branch &&
1919
1920 - cat >expect <<-\EOF &&
1920 + q_to_tab >expect <<-\EOF &&
1921 Successfully rebased and updated refs/heads/update-refs.
1922 Updated the following refs with --update-refs:
1923 - refs/heads/first
1924 - refs/heads/no-conflict-branch
1925 - refs/heads/second
1926 - refs/heads/third
1923 + Qrefs/heads/first
1924 + Qrefs/heads/no-conflict-branch
1925 + Qrefs/heads/second
1926 + Qrefs/heads/third
1927 EOF
1928
1929 # Clear "Rebasing (X/Y)" progress lines and drop leading tabs.
1930 - sed -e "s/Rebasing.*Successfully/Successfully/g" -e "s/^\t//g" \
1931 - <err >err.trimmed &&
1930 + sed "s/Rebasing.*Successfully/Successfully/g" <err >err.trimmed &&
1931 test_cmp expect err.trimmed
1932 '
1933
@@ -2178,19 +2177,18 @@ test_expect_success '--update-refs: check failed ref update' '
2177 test_must_fail git rebase --continue 2>err &&
2178 grep "update_ref failed for ref '\''refs/heads/second'\''" err &&
2179
2181 - cat >expect <<-\EOF &&
2180 + q_to_tab >expect <<-\EOF &&
2181 Updated the following refs with --update-refs:
2183 - refs/heads/first
2184 - refs/heads/no-conflict-branch
2185 - refs/heads/third
2182 + Qrefs/heads/first
2183 + Qrefs/heads/no-conflict-branch
2184 + Qrefs/heads/third
2185 Failed to update the following refs with --update-refs:
2187 - refs/heads/second
2186 + Qrefs/heads/second
2187 EOF
2188
2189 # Clear "Rebasing (X/Y)" progress lines and drop leading tabs.
2190 tail -n 6 err >err.last &&
2192 - sed -e "s/Rebasing.*Successfully/Successfully/g" -e "s/^\t//g" \
2193 - <err.last >err.trimmed &&
2191 + sed "s/Rebasing.*Successfully/Successfully/g" <err.last >err.trimmed &&
2192 test_cmp expect err.trimmed
2193 '
2194