Avoid a test failure when the test wants to skip itself.
[gnulib.git] / tests / test-vc-list-files-git.sh
index 7fffc83..ac50971 100755 (executable)
@@ -16,9 +16,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-PATH="$abs_top_srcdir/build-aux":$PATH
-export PATH
-
 if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
   compare() { diff -u "$@"; }
 elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
@@ -34,7 +31,8 @@ trap '(exit $?); exit $?' 1 2 13 15
 fail=1
 mkdir $tmpdir && cd $tmpdir &&
   # without git, skip the test
-  { git init -q || exit 77; } &&
+  # The double use of 'exit' is needed for the reference to $? inside the trap.
+  { ( git init -q ) > /dev/null 2>&1 || { (exit 77); exit 77; }; } &&
   mkdir d &&
   touch d/a b c &&
   git add . > /dev/null &&