Re: [PATCH] git-checkout: Test for relative path use.
- From
David Symonds <dsymonds@gmail.com>
- Date
- Nov 9, 2007, 07:24 UTC
- Message-ID
- <ee77f5c20711082324s39a9d441tc05c5a27e6d39f3e@mail.gmail.com>
- In-Reply-To
- <47340895.6000403@viscovery.net>
On Nov 9, 2007 6:13 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
Show 18 quoted lines
> David Symonds schrieb: > > +test_expect_success 'remove and restore with relative path' ' > > + > > + cd dir1 && > > + rm ../file0 && > > + git checkout HEAD -- ../file0 && > > + test "base" = "$(cat ../file0)" && > > + rm ../dir2/file2 && > > + git checkout HEAD -- ../dir2/file2 && > > + test "bonjour" = "$(cat ../dir2/file2)" && > > + rm ../file0 ./file1 && > > + git checkout HEAD -- .. && > > + test "base" = "$(cat ../file0)" && > > + test "hello" = "$(cat file1)" && > > + cd - > > What if this test fails? Then the rest of the tests run from the wrong > directory. You should put the test in parenthesis (and drop the cd -).
Looking at the existing tests which, when they change directories, don't cd back to where they were; they "cd .." at the start of the next test. I'll add a "cd .." to the relevant bits of my tests.
Dave.