Re: [PATCH v2 2/3] perf: make the tests work in worktrees
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- May 13, 2016, 13:14 UTC
- Message-ID
- <alpine.DEB.2.20.1605131352540.4092@virtualbox>
- In-Reply-To
- <CAPig+cR=MeXZXA-Xdr-7A4nxfNvBrOy2ZtmzJOLHq5YGFiuNyA@mail.gmail.com>
Hi Eric,
On Wed, 11 May 2016, Eric Sunshine wrote:
Show 23 quoted lines
> On Wed, May 11, 2016 at 4:42 AM, Johannes Schindelin
> <johannes.schindelin@gmx.de> wrote:
> > This patch makes perf-lib.sh more robust so that it can run correctly
> > even inside a worktree. For example, it assumed that $GIT_DIR/objects is
> > the objects directory (which is not the case for worktrees) and it used
> > the commondir file verbatim, even if it contained a relative path.
> >
> > Furthermore, the setup code expected `git rev-parse --git-dir` to spit
> > out a relative path, which is also not true for worktrees. Let's just
> > change the code to accept both relative and absolute paths, by avoiding
> > the `cd` into the copied working directory.
> >
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> > diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
> > @@ -80,22 +80,22 @@ test_perf_create_repo_from () {
> > - source_git=$source/$(cd "$source" && git rev-parse --git-dir)
> > + source_git="$(cd "$source" && git rev-parse --git-dir)"
> > + objects_dir="$(cd "$source" && git rev-parse --git-path objects)"
>
> Would it be out of the scope of this patch to simplify these by using -C?
>
> source_git=$(git -C "$source" rev-parse --git-dir)Thanks for educating me: I had not known about this option.
Will send another iteration in a moment.
Ciao, Dscho