Skip to content

adjust git call supported by older git clients #7155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/SourceControl/GitRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public struct GitRepositoryProvider: RepositoryProvider, Cancellable {
}

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

Expand Down
2 changes: 1 addition & 1 deletion Sources/SourceControl/RepositoryManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public class RepositoryManager: Cancellable {
// and recoverable, and as such can be ignored
quick: if (try? self.provider.repositoryExists(at: repositoryPath)) ?? false {
let repository = try handle.open()

guard ((try? self.provider.isValidDirectory(repositoryPath, for: repositorySpecifier)) ?? false) else {
observabilityScope.emit(warning: "\(repositoryPath) is not valid git repository for '\(repositorySpecifier.location)', will fetch again.")
break quick
Expand Down