Re: [PATCH v2 2/3] perf: make the tests work in worktrees
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- May 11, 2016, 17:40 UTC
- Message-ID
- <CAPig+cR=MeXZXA-Xdr-7A4nxfNvBrOy2ZtmzJOLHq5YGFiuNyA@mail.gmail.com>
- In-Reply-To
- <d783290cabe601ee8623044482b2992fb7936534.1462955446.git.johannes.schindelin@gmx.de>
On Wed, May 11, 2016 at 4:42 AM, Johannes Schindelin <johannes.schindelin@gmx.de> wrote:
Show 17 quoted lines
> 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)