git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.
Previous: Johannes SixtNext: David Symonds
Message 9 of 15 in “git-checkout: Support relative paths containing "..".”
  1. git-checkout: Support relative paths containing "..".David Symonds, Nov 9, 2007
  2. git-checkout: Test for relative path use.David Symonds, Nov 9, 2007
  3. Junio C HamanoNov 9, 2007
  4. David SymondsNov 9, 2007
  5. Junio C HamanoNov 9, 2007
  6. David SymondsNov 9, 2007
  7. Robin RosenbergNov 9, 2007
  8. Johannes SixtNov 9, 2007
  9. David SymondsNov 9, 2007
  10. git-checkout: Test for relative path use.David Symonds, Nov 9, 2007
  11. Junio C HamanoNov 9, 2007
  12. David SymondsNov 9, 2007
  13. Junio C HamanoNov 9, 2007
  14. David SymondsNov 9, 2007
  15. git-checkout: Test for relative path use.David Symonds, Nov 9, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.