Skip to content

Commit 3b1dfc1

Browse files
committed
adjust git call supported by older git clients (#7155)
motivation: new git call added does not work with older git clients (eg Centos7) changes: use "git config --get remote.origin.url" instead of "git remote get-url origin"
1 parent 7643b60 commit 3b1dfc1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Sources/SourceControl/GitRepository.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public struct GitRepositoryProvider: RepositoryProvider, Cancellable {
211211
}
212212

213213
public func isValidDirectory(_ directory: Basics.AbsolutePath, for repository: RepositorySpecifier) throws -> Bool {
214-
let remoteURL = try self.git.run(["-C", directory.pathString, "remote", "get-url", "origin"])
214+
let remoteURL = try self.git.run(["-C", directory.pathString, "config", "--get", "remote.origin.url"])
215215
return remoteURL == repository.url
216216
}
217217

Sources/SourceControl/RepositoryManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public class RepositoryManager: Cancellable {
202202
// and recoverable, and as such can be ignored
203203
quick: if (try? self.provider.repositoryExists(at: repositoryPath)) ?? false {
204204
let repository = try handle.open()
205-
205+
206206
guard ((try? self.provider.isValidDirectory(repositoryPath, for: repositorySpecifier)) ?? false) else {
207207
observabilityScope.emit(warning: "\(repositoryPath) is not valid git repository for '\(repositorySpecifier.location)', will fetch again.")
208208
break quick

0 commit comments

Comments
 (0)