From 2477bb20257689d4d680701934cdb659c8f6fb37 Mon Sep 17 00:00:00 2001 From: Matt Hunter Date: Sat, 21 Feb 2026 17:35:55 -0500 Subject: Use git-precheck to determine if we are inside a repository Use the more robust check implemented by the new git-precheck script, instead of the previous dot_git() logic which checks for a ".git" folder with fallback to git-rev-parse. There is still more work to be done though in refactoring this area of the git-sonar script. Due to the specifics of this new implementation, git-sonar will no longer attempt to operate inside a .git directory or a bare git repository. This makes more sense to me, since git-sonar is intended to be an aid during active development work or branch management from within a working tree. This also avoids some other issues and potential edge cases within the script that fail to run properly in those contexts. git-precheck exits with a code of 3 or less if it successfully determines we are inside a valid git repository working tree, so simply assert this in the is_repo function. Signed-off-by: Matt Hunter --- git-sonar | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/git-sonar b/git-sonar index f957b73..8917cab 100755 --- a/git-sonar +++ b/git-sonar @@ -90,11 +90,8 @@ dot_git() { } is_repo() { - if [[ -n "$(dot_git)" ]]; then - return 0 - else - return 1 - fi + git-precheck --quiet + [ $? -lt 4 ] } record_timestamp() { -- cgit v1.2.3