Skip to content

Make calls to Git optional #8752

@alexsharoff

Description

@alexsharoff

Description

We run swift-package-manager on CI and lately we've noticed that Git's index.lock is left after a build is cancelled. That is a problem, because the lock file prevents post-build repository cleanup from working, i.e. git calls return an error.

Git is called in somewhere here

gitInformation = ContextModel.GitInformation(
currentTag: repo.getCurrentTag(),
currentCommit: try repo.getCurrentRevision().identifier,
hasUncommittedChanges: repo.hasUncommittedChanges()

Is it possible to disable calling Git in swift-package-manager? For example, via an environment variable.

Expected behavior

No response

Actual behavior

No response

Steps to reproduce

No response

Swift Package Manager version/commit hash

No response

Swift & OS version (output of swift --version && uname -a)

No response

Activity

plemarquand

plemarquand commented on Jun 24, 2025

@plemarquand
Contributor

Git is used quire a few places throughout SwiftPM, most prominently during package resolution. Disabling Git would break package resolution, so isn't really an option.

Cancelling a build gracefully (SIGINT or SIGTERM) should also shut down child git processes gracefully, cleaning the lock file. If a build is cancelled with SIGKILL then this may not happen, so isn't recommended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @plemarquand@alexsharoff

        Issue actions

          Make calls to Git optional · Issue #8752 · swiftlang/swift-package-manager