@@ -39,6 +39,7 @@ import {
3939import { symlinksSupported } from "@t3tools/shared/testing/symlinks" ;
4040import * as ServerConfig from "../config.ts" ;
4141import {
42+ isNonRepositoryGitStderr ,
4243 makeGitVcsDriverCore ,
4344 parseGitCheckoutProgressLine ,
4445 splitNullSeparatedGitStdoutPaths ,
@@ -132,6 +133,27 @@ const makeDriverReleasingLock = (
132133 return { driver, failures } ;
133134 } ) ;
134135
136+ describe ( "isNonRepositoryGitStderr" , ( ) => {
137+ it . each ( [
138+ "fatal: not a git repository (or any of the parent directories): .git" ,
139+ "fatal: not a git repository: /missing-git-directory" ,
140+ // Git 2.56+ wording for a `.git` gitfile that points at a missing directory.
141+ "fatal: gitfile does not point to a valid repository: /tmp/worktrees/feature/.git" ,
142+ "FATAL: GITFILE DOES NOT POINT TO A VALID REPOSITORY: /tmp/x/.git" ,
143+ ] ) ( "classifies %j as a non-repository" , ( stderr ) => {
144+ assert . isTrue ( isNonRepositoryGitStderr ( stderr ) ) ;
145+ } ) ;
146+
147+ it . each ( [
148+ "" ,
149+ "fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree." ,
150+ "fatal: Unable to create '/repo/.git/index.lock': File exists." ,
151+ "fatal: invalid gitfile format: /repo/.git" ,
152+ ] ) ( "does not classify %j as a non-repository" , ( stderr ) => {
153+ assert . isFalse ( isNonRepositoryGitStderr ( stderr ) ) ;
154+ } ) ;
155+ } ) ;
156+
135157it . effect ( "runs background Git in its own lane so user commands never queue behind it" , ( ) =>
136158 Effect . gen ( function * ( ) {
137159 const gate = yield * Deferred . make < void > ( ) ;
0 commit comments