Eric Sunshine <sunsh...@sunshineco.com> writes:

>> +test_expect_success 'archive subtree from subdir' '
>> +       cd a &&
>> +       git archive --format=tar HEAD >../asubtree.tar &&
>> +       cd .. &&
>> +       make_dir extract &&
>> +       "$TAR" xf asubtree.tar -C extract &&
>> +       check_dir extract af b b/bf b/c b/c/cf
>> +'
>
> If git-archive fails, the subsequent 'cd ..' will not be invoked,
> hence all tests following this one will fail since the current
> directory has not been restored. If you place the 'cd a' in a
> subshell, then the current directory remains unchanged for commands
> outside the subshell (and you can drop the 'cd ..'):
>
>     (
>     cd a &&
>     git archive ...
>     ) &&
>     make_dir ...
>     ...

Thanks, and please indent the commands run in the subshell for
better readability.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to