         // Get the contents using `cat-file`.
         //
         // FIXME: We need to get the raw bytes back, not a String.
-        let output = try Git.runPopen([Git.tool, "-C", path.asString, "cat-file", "-p", hash.bytes.asString!])
+        let output = try runPopen([Git.tool, "-C", path.asString, "cat-file", "-p", hash.bytes.asString!])
         return ByteString(encodingAsUTF8: output)
+    }
+
+    /// Runs the command in the serial queue.
+    private func runCommandQuietly(_ command: [String]) throws {
+        try queue.sync {
+            try Git.runCommandQuietly(command)
+        }
+    }
+
+    /// Executes popen in the serial queue.
+    private func runPopen(_ command: [String]) throws -> String {
+        return try queue.sync {
+            return try Git.runPopen(command)
+        }
     }
 }
 

    // MARK: Working Checkout Interface

    public func getCurrentRevision() throws -> Revision {
        return Revision(identifier: try Git.runPopen([Git.tool, "-C", path.asString, "rev-parse", "--verify", "HEAD"]).chomp())
    }

    public func checkout(tag: String) throws {
        // FIXME: Audit behavior with off-branch tags in remote repositories, we
        // may need to take a little more care here.
        try system(
            Git.tool, "-C", path.asString, "reset", "--hard", tag, message: nil)
    }

    public func checkout(revision: Revision) throws {
        // FIXME: Audit behavior with off-branch tags in remote repositories, we
        // may need to take a little more care here.
        try system(
            Git.tool, "-C", path.asString, "reset", "--hard", revision.identifier, message: nil)
    }

    // MARK: Git Operations

    /// The path of the repository on disk.
    public let path: AbsolutePath

    /// The (serial) queue to execute git cli on.
    private let queue = DispatchQueue(label: "org.swift.swiftpm.gitqueue")

    public init(path: AbsolutePath) {
        self.path = path
    }

    // MARK: Repository Interface

    /// Returns the tags present in repository.
    public var tags: [String] {
        return queue.sync {
            // Check if we already have the tags cached.
            if let tags = tagsCache {
                return tags
            }
            tagsCache = getTags()
            return tagsCache!
        }
    }

    /// Cache for the tags.
    private var tagsCache: [String]? = nil

    /// Returns the tags present in repository.
    private func getTags() -> [String] {
        // FIXME: Error handling.
        let tagList = try! Git.runPopen([Git.tool, "-C", path.asString, "tag", "-l"])
