Re: [PATCH v2 59/62] livepatch/klp-build: Introduce klp-build script for generating livepatch modules
From: Dylan Hatch
Date: Wed Jun 18 2025 - 18:38:31 EST
On Fri, May 9, 2025 at 1:30 PM Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> +
> +# Make sure git re-stats the changed files
> +git_refresh() {
> + local patch="$1"
> + local files=()
> +
> + [[ ! -d "$SRC/.git" ]] && return
As a user of git worktrees, my $SRC/.git is a file containing a key:
value pair "gitdir: <path>", causing this script to fail on a [[ ! -d
"$SRC/.git" ]] check. Can this be handled, perhaps with a check if
.git is a file?
It seems like the check is just to confirm the $SRC directory is still
a git tree, in which case maybe adding a -f check would fix this:
[[ ! -d "$SRC/.git" ]] && [[ ! -f "$SRC/.git" ]] && return
Or if the actual git directory is needed for something, maybe it can
be located ahead of time:
GITDIR="$SRC/.git"
[[ -f $GITDIR ]] && GITDIR=$(sed -n
's/^gitdir[[:space:]]*:[[:space:]]*//p' $GITDIR)
Thanks,
Dylan