From: Junio C Hamano Date: Tue, 03 Dec 2013 17:54:03 GMT Subject: Re: [PATCH] Improvements to git-archive tests and add_submodule_odb() Message-ID: In-Reply-To: Eric Sunshine 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.