@@ -1022,9 +1022,33 @@ define(function (require, exports) {
10221022
10231023 function getGitRoot ( ) {
10241024 var projectRoot = Utils . getProjectRoot ( ) ;
1025- return git ( [ "rev-parse" , "--show-toplevel" ] , {
1026- cwd : fs . getTauriPlatformPath ( projectRoot )
1027- } )
1025+
1026+ // Quick filesystem pre-check: if .git doesn't exist in the project root,
1027+ // skip spawning git entirely. This avoids triggering macOS CLT shim dialogs
1028+ // on non-git projects and is a minor optimization on all platforms.
1029+ return new Promise ( function ( resolve ) {
1030+ var checkPath = projectRoot ;
1031+ if ( strEndsWith ( checkPath , "/" ) ) {
1032+ checkPath = checkPath . slice ( 0 , - 1 ) ;
1033+ }
1034+ if ( typeof brackets !== "undefined" && brackets . fs && brackets . fs . stat ) {
1035+ brackets . fs . stat ( checkPath + "/.git" , function ( err , result ) {
1036+ var exists = err ? false : ( result . isFile ( ) || result . isDirectory ( ) ) ;
1037+ resolve ( exists ) ;
1038+ } ) ;
1039+ } else {
1040+ FileSystem . resolve ( checkPath + "/.git" , function ( err , item , stat ) {
1041+ var exists = err ? false : ( stat . isFile || stat . isDirectory ) ;
1042+ resolve ( exists ) ;
1043+ } ) ;
1044+ }
1045+ } ) . then ( function ( hasGitDir ) {
1046+ if ( ! hasGitDir ) {
1047+ return null ;
1048+ }
1049+ return git ( [ "rev-parse" , "--show-toplevel" ] , {
1050+ cwd : fs . getTauriPlatformPath ( projectRoot )
1051+ } )
10281052 . catch ( function ( e ) {
10291053 if ( ErrorHandler . contains ( e , "Not a git repository" ) ) {
10301054 return null ;
@@ -1095,6 +1119,7 @@ define(function (require, exports) {
10951119 } ) ;
10961120
10971121 } ) ;
1122+ } ) ;
10981123 }
10991124
11001125 function setTagName ( tagname , commitHash ) {
0 commit comments