On Wed, Jun 18, 2025 at 05:38:07PM -0500, Dylan Hatch wrote: > On Fri, May 9, 2025 at 1:30 PM Josh Poimboeuf <jpoim...@kernel.org> 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)
I believe the subsequent "git update-index" operation should work on git worktrees as well, so I changed that to use '-e': [[ ! -e "$SRC/.git" ]] && return -- Josh