[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH qemu] configure: Enable werror for git worktrees
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH qemu] configure: Enable werror for git worktrees |
Date: |
Thu, 28 Feb 2019 10:03:55 +0000 |
On Thu, 28 Feb 2019 at 04:36, Alexey Kardashevskiy <address@hidden> wrote:
>
> The configure script checks multiple times whether it works in a git
> repository and it does this by "test -e "${source_path}/.git" in 4 cases
> but in one case where it tries to enable werror "-d" is used there which
> fails on git worktrees as .git is a file then and not a directory.
>
> This changes the test to "-e" as other occurrences.
>
> Signed-off-by: Alexey Kardashevskiy <address@hidden>
> ---
> configure | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Given that there is this non-obvious pitfall in trying to
hand-code the "are we running from git?" check and that
we do it in five places in configure, that suggests that
we should abstract this out:
sources_in_git() {
# Note that -d will give the wrong answer for git worktrees
test -e "$source_path/.git"
}
and then use wherever we're currently checking by hand:
if sources_in_git && ...
(warning: code not tested at all)
Defining a sources_in_git variable which we set at
the start of the script would work too; no strong preference.
thanks
-- PMM