]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: fix git repository check in gdb.src/pre-commit.exp
authorAndrew Burgess <aburgess@redhat.com>
Fri, 24 Oct 2025 21:14:56 +0000 (22:14 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Wed, 29 Oct 2025 09:13:20 +0000 (09:13 +0000)
In the recently added gdb.src/pre-commit.exp test, we check if the
source directory is a git repository like this:

  if {![file isdirectory $repodir/.git]} {
      unsupported "Not in a git repository"
      return
  }

I make extensive use of git worktrees for development.  In a worktree
.git is a file containing the location of the actual .git directory,
it is not itself a directory.  As such, the above check fails,
claiming my source tree is not a git repository, when in fact, it is.

Fix this by relaxing the check to 'file exists $repodir/.git', which
will cover the directory and file case.

Approved-By: Kevin Buettner <kevinb@redhat.com>
gdb/testsuite/gdb.src/pre-commit.exp

index 5fb0dfed6d75a924123e255f10d9888c1d2f110d..8745b31272e9c49c5ca5c6e4765183f818e885fe 100644 (file)
@@ -17,7 +17,7 @@
 
 set repodir $srcdir/../..
 
-if {![file isdirectory $repodir/.git]} {
+if {![file exists $repodir/.git]} {
     unsupported "Not in a git repository"
     return
 }