* [PATCH] gdb/testsuite: fix git repository check in gdb.src/pre-commit.exp
@ 2025-10-24 21:18 Andrew Burgess
2025-10-25 5:09 ` Kevin Buettner
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Burgess @ 2025-10-24 21:18 UTC (permalink / raw)
To: gdb-patches; +Cc: Andrew Burgess
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] gdb/testsuite: fix git repository check in gdb.src/pre-commit.exp
2025-10-24 21:18 [PATCH] gdb/testsuite: fix git repository check in gdb.src/pre-commit.exp Andrew Burgess
@ 2025-10-25 5:09 ` Kevin Buettner
2025-10-29 9:15 ` Andrew Burgess
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2025-10-25 5:09 UTC (permalink / raw)
To: Andrew Burgess; +Cc: gdb-patches
On Fri, 24 Oct 2025 22:18:19 +0100
Andrew Burgess <aburgess@redhat.com> wrote:
> 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.
Makes sense to me...
Approved-by: Kevin Buettner <kevinb@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] gdb/testsuite: fix git repository check in gdb.src/pre-commit.exp
2025-10-25 5:09 ` Kevin Buettner
@ 2025-10-29 9:15 ` Andrew Burgess
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Burgess @ 2025-10-29 9:15 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
Kevin Buettner <kevinb@redhat.com> writes:
> On Fri, 24 Oct 2025 22:18:19 +0100
> Andrew Burgess <aburgess@redhat.com> wrote:
>
>> 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.
>
> Makes sense to me...
>
> Approved-by: Kevin Buettner <kevinb@redhat.com>
Pushed.
Thanks,
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-29 9:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-24 21:18 [PATCH] gdb/testsuite: fix git repository check in gdb.src/pre-commit.exp Andrew Burgess
2025-10-25 5:09 ` Kevin Buettner
2025-10-29 9:15 ` Andrew Burgess
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox