[libcamera-devel] utils: update-kernel-headers: Support git worktrees
diff mbox series

Message ID 20230926120831.8891-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit d2094a0185647666ca8f810265521f0b892c4646
Headers show
Series
  • [libcamera-devel] utils: update-kernel-headers: Support git worktrees
Related show

Commit Message

Laurent Pinchart Sept. 26, 2023, 12:08 p.m. UTC
When operating on a git worktree, the Linux kernel directory contains a
.git file, not a .git directory. Relax the git tree check to support
both.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 utils/update-kernel-headers.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kieran Bingham Sept. 26, 2023, 12:11 p.m. UTC | #1
Quoting Laurent Pinchart via libcamera-devel (2023-09-26 13:08:31)
> When operating on a git worktree, the Linux kernel directory contains a
> .git file, not a .git directory. Relax the git tree check to support
> both.
> 

Oh, subtle. But yes - that sounds reasonable. Is the .git file a
symlink? Eitherway:


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  utils/update-kernel-headers.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/update-kernel-headers.sh b/utils/update-kernel-headers.sh
> index a006452e6836..590986d2b7e2 100755
> --- a/utils/update-kernel-headers.sh
> +++ b/utils/update-kernel-headers.sh
> @@ -18,7 +18,7 @@ if [ "$line" != "# Kbuild for top-level directory of the kernel" ] ; then
>         exit 1
>  fi
>  
> -if [ ! -d "${kernel_dir}/.git" ] ; then
> +if [ ! -e "${kernel_dir}/.git" ] ; then
>         echo "Directory ${kernel_dir} doesn't contain a git tree"
>         exit 1
>  fi
> 
> -- 
> Regards,
> 
> Laurent Pinchart
>
Laurent Pinchart Sept. 26, 2023, 12:20 p.m. UTC | #2
On Tue, Sep 26, 2023 at 01:11:11PM +0100, Kieran Bingham wrote:
> Quoting Laurent Pinchart via libcamera-devel (2023-09-26 13:08:31)
> > When operating on a git worktree, the Linux kernel directory contains a
> > .git file, not a .git directory. Relax the git tree check to support
> > both.
> 
> Oh, subtle. But yes - that sounds reasonable. Is the .git file a
> symlink? Eitherway:

No, it's a regular file that contains

gitdir: /path/to/git/dir

I considered testing for either a directory or a regular file, but I
think it's overkill, -e should be fine.

> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  utils/update-kernel-headers.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/utils/update-kernel-headers.sh b/utils/update-kernel-headers.sh
> > index a006452e6836..590986d2b7e2 100755
> > --- a/utils/update-kernel-headers.sh
> > +++ b/utils/update-kernel-headers.sh
> > @@ -18,7 +18,7 @@ if [ "$line" != "# Kbuild for top-level directory of the kernel" ] ; then
> >         exit 1
> >  fi
> >  
> > -if [ ! -d "${kernel_dir}/.git" ] ; then
> > +if [ ! -e "${kernel_dir}/.git" ] ; then
> >         echo "Directory ${kernel_dir} doesn't contain a git tree"
> >         exit 1
> >  fi
> >

Patch
diff mbox series

diff --git a/utils/update-kernel-headers.sh b/utils/update-kernel-headers.sh
index a006452e6836..590986d2b7e2 100755
--- a/utils/update-kernel-headers.sh
+++ b/utils/update-kernel-headers.sh
@@ -18,7 +18,7 @@  if [ "$line" != "# Kbuild for top-level directory of the kernel" ] ; then
 	exit 1
 fi
 
-if [ ! -d "${kernel_dir}/.git" ] ; then
+if [ ! -e "${kernel_dir}/.git" ] ; then
 	echo "Directory ${kernel_dir} doesn't contain a git tree"
 	exit 1
 fi