Re: [PATCH] Add test case for running from a subdirectory with GIT_WORK_TREE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Sat, 27 Oct 2007, Nguyen Thai Ngoc Duy wrote:

> On 10/27/07, Johannes Schindelin <Johannes.Schindelin@xxxxxx> wrote:
> > Hi,
> >
> > On Sat, 27 Oct 2007, Nguyễn Thái Ngọc Duy wrote:
> >
> > > +mkdir -p work/sub/dir || exit 1
> > > +mv .git work
> > > +if test "$1" = --normal; then
> > > +     say "Normal case"
> > > +else
> > > +     say "Worktree case"
> > > +fi
> > > +test "$1" = --normal || mv work/.git repo.git || exit 1
> > > +
> > > +test "$1" = --normal || export GIT_DIR=$(pwd)/repo.git
> > > +export GIT_CONFIG="$(pwd)"/$GIT_DIR/config
> > > +test "$1" = --normal || export GIT_WORK_TREE=$(pwd)/work
> > > +
> > > +cd work/sub || exit 1
> >
> > Why don't you put this block into a test_expect_success?  And then just
> > make a
> >
> >         for mode in normal worktree
> >         do
> >
> >         ...
> >
> >         done
> >
> > Hmm?  I would like to see this test case in the official git.git.
> 
> Because after normal iteration, the test repository is no longer in
> clean state that the second iteration needs. Maybe I should just
> create another repo then set parameters properly in test_expect_*

Yes, you can do that:

	test_create_repo other-repo

Another option would be that you clean up at the end of the loop.

Ciao,
Dscho

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux