Skip to content

Commit 0894632

Browse files
authored
Handle Missing Remotes (Git) (#1604)
1 parent c3d148d commit 0894632

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

CodeEdit/Features/Git/Client/GitClient+CommitHistory.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@ extension GitClient {
3434
"log --pretty=%h¦%H¦%s¦%aN¦%ae¦%cn¦%ce¦%aD¦ \(maxCountString) \(branchNameString) \(fileLocalPath)"
3535
.trimmingCharacters(in: .whitespacesAndNewlines)
3636
)
37-
let remote = try await run("ls-remote --get-url")
38-
let remoteURL = URL(string: remote.trimmingCharacters(in: .whitespacesAndNewlines))
37+
38+
let remote = try? await run("ls-remote --get-url")
39+
let remoteURL: URL? = if let remote {
40+
URL(string: remote.trimmingCharacters(in: .whitespacesAndNewlines))
41+
} else {
42+
nil
43+
}
3944

4045
return output
4146
.split(separator: "\n")

0 commit comments

Comments
 (0)