This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -69,20 +69,36 @@ public RepositoryPathConfiguration(NPath repositoryPath)
69
69
RepositoryPath = repositoryPath ;
70
70
71
71
DotGitPath = repositoryPath . Combine ( ".git" ) ;
72
+ NPath CommonPath ;
72
73
if ( DotGitPath . FileExists ( ) )
73
74
{
74
75
DotGitPath =
75
76
DotGitPath . ReadAllLines ( )
76
77
. Where ( x => x . StartsWith ( "gitdir:" ) )
77
78
. Select ( x => x . Substring ( 7 ) . Trim ( ) . ToNPath ( ) )
78
79
. First ( ) ;
80
+ if ( DotGitPath . Combine ( "commondir" ) . FileExists ( ) )
81
+ {
82
+ CommonPath = DotGitPath . Combine ( "commondir" ) . ReadAllLines ( )
83
+ . Select ( x => x . Trim ( ) . ToNPath ( ) )
84
+ . First ( ) ;
85
+ CommonPath = DotGitPath . Combine ( CommonPath ) ;
86
+ }
87
+ else
88
+ {
89
+ CommonPath = DotGitPath ;
90
+ }
91
+ }
92
+ else
93
+ {
94
+ CommonPath = DotGitPath ;
79
95
}
80
96
81
- BranchesPath = DotGitPath . Combine ( "refs" , "heads" ) ;
82
- RemotesPath = DotGitPath . Combine ( "refs" , "remotes" ) ;
97
+ BranchesPath = CommonPath . Combine ( "refs" , "heads" ) ;
98
+ RemotesPath = CommonPath . Combine ( "refs" , "remotes" ) ;
83
99
DotGitIndex = DotGitPath . Combine ( "index" ) ;
84
100
DotGitHead = DotGitPath . Combine ( "HEAD" ) ;
85
- DotGitConfig = DotGitPath . Combine ( "config" ) ;
101
+ DotGitConfig = CommonPath . Combine ( "config" ) ;
86
102
DotGitCommitEditMsg = DotGitPath . Combine ( "COMMIT_EDITMSG" ) ;
87
103
}
88
104
Original file line number Diff line number Diff line change @@ -89,9 +89,9 @@ public void InitializeRepository(NPath? repositoryPath = null)
89
89
90
90
expectedRepositoryPath = repositoryPath != null ? repositoryPath . Value : UnityProjectPath ;
91
91
92
- if ( ! expectedRepositoryPath . DirectoryExists ( ".git" ) )
92
+ if ( ! expectedRepositoryPath . Exists ( ".git" ) )
93
93
{
94
- NPath reporoot = UnityProjectPath . RecursiveParents . FirstOrDefault ( d => d . DirectoryExists ( ".git" ) ) ;
94
+ NPath reporoot = UnityProjectPath . RecursiveParents . FirstOrDefault ( d => d . Exists ( ".git" ) ) ;
95
95
if ( reporoot . IsInitialized )
96
96
expectedRepositoryPath = reporoot ;
97
97
}
@@ -102,7 +102,7 @@ public void InitializeRepository(NPath? repositoryPath = null)
102
102
}
103
103
104
104
FileSystem . SetCurrentDirectory ( expectedRepositoryPath ) ;
105
- if ( expectedRepositoryPath . DirectoryExists ( ".git" ) )
105
+ if ( expectedRepositoryPath . Exists ( ".git" ) )
106
106
{
107
107
RepositoryPath = expectedRepositoryPath ;
108
108
Repository = new Repository ( RepositoryPath , CacheContainer ) ;
You can’t perform that action at this time.
0 commit comments