From 021043f91b3effbdaf9d62f45fa9320df01648d2 Mon Sep 17 00:00:00 2001 From: Wesley de Groot Date: Mon, 4 Mar 2024 13:17:52 +0100 Subject: [PATCH] Fix branch display on repo's without commits. --- Sources/Version-Control/Base/Commands/Branch.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Version-Control/Base/Commands/Branch.swift b/Sources/Version-Control/Base/Commands/Branch.swift index fdcde4a8..ae24ceb3 100644 --- a/Sources/Version-Control/Base/Commands/Branch.swift +++ b/Sources/Version-Control/Base/Commands/Branch.swift @@ -20,7 +20,7 @@ public struct Branch { // swiftlint:disable:this type_body_length /// - Throws: An error if the shell command fails. public func getCurrentBranch(directoryURL: URL) throws -> String { return try ShellClient.live().run( - "cd \(directoryURL.relativePath.escapedWhiteSpaces());git rev-parse --abbrev-ref HEAD" + "cd \(directoryURL.relativePath.escapedWhiteSpaces());git branch --show-current" ).removingNewLines() }