Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH] gdb/testsuite: fix git repository check in gdb.src/pre-commit.exp
Date: Fri, 24 Oct 2025 22:18:19 +0100	[thread overview]
Message-ID: <5fa8de4b2b28278dbc3bf4ae78709ee9e71c3aa0.1761340690.git.aburgess@redhat.com> (raw)

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.
---
 gdb/testsuite/gdb.src/pre-commit.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.src/pre-commit.exp b/gdb/testsuite/gdb.src/pre-commit.exp
index 5fb0dfed6d7..8745b31272e 100644
--- a/gdb/testsuite/gdb.src/pre-commit.exp
+++ b/gdb/testsuite/gdb.src/pre-commit.exp
@@ -17,7 +17,7 @@
 
 set repodir $srcdir/../..
 
-if {![file isdirectory $repodir/.git]} {
+if {![file exists $repodir/.git]} {
     unsupported "Not in a git repository"
     return
 }

base-commit: 7d169f96d5f372c76ee560355af3dcac4355418f
-- 
2.47.1


             reply	other threads:[~2025-10-24 21:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24 21:18 Andrew Burgess [this message]
2025-10-25  5:09 ` Kevin Buettner
2025-10-29  9:15   ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5fa8de4b2b28278dbc3bf4ae78709ee9e71c3aa0.1761340690.git.aburgess@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox