Ann T Ropea <bedhan...@gmx.de> writes: > +# Detached HEAD tests for GIT_PRINT_SHA1_ELLIPSIS > + > +# The first detach operation is more chatty than the following ones. > +cat > 1st_detach <<'EOF' > +Note: checking out 'HEAD^'. > + > +You are in 'detached HEAD' state. You can look around, make experimental > +changes and commit them, and you can discard any commits you make in this > +state without impacting any branches by performing another checkout. > + > +If you want to create a new branch to retain commits you create, you may > +do so (now or later) by using -b with the checkout command again. Example: > + > + git checkout -b <new-branch-name> > + > +HEAD is now at 7c7cd714e262 three > +EOF > +# The remaining ones just show info about previous and current HEADs. > +cat > 2nd_detach <<'EOF' > +Previous HEAD position was 7c7cd714e262 three > +HEAD is now at 139b20d8e6c5 two > +EOF > +cat > 3rd_detach <<'EOF' > +Previous HEAD position was 139b20d8e6c5 two > +HEAD is now at d79ce1670bdc one > +EOF
It is preferrable to have all of the above inside the test_expect_success block that uses them. Also lose the SP between redirection operator and its target filename, i.e. command >file not command > file > +test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when > not asked to' ' > + reset && check_not_detached && unset GIT_PRINT_SHA1_ELLIPSIS && > + > + # Various ways of *not* asking for ellipses > + > + unset GIT_PRINT_SHA1_ELLIPSIS && git -c 'core.abbrev=12' checkout HEAD^ > 1> actual 2>&1 && Use sane_unset from t/test-lib-functions.sh instead, unless you are absolutely sure that the variable you are unsetting _is_ set at this point. > + check_detached && > + test_cmp 1st_detach actual && unset GIT_PRINT_SHA1_ELLIPSIS && Is the output we are grabbing with check_detached from the command internationalized? If so, the comparison should be done with test_i18ncmp (otherwise, the test will break under the "poisoned gettext" build). Thanks.