Skip to content
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

fatal: --bare and --origin foo options are incompatible. #71

Open
amtoine opened this issue Nov 7, 2023 · 1 comment
Open

fatal: --bare and --origin foo options are incompatible. #71

amtoine opened this issue Nov 7, 2023 · 1 comment
Labels
bug Something isn't working as expected core Related to the main `nu-git-manager` module

Comments

@amtoine
Copy link
Owner

amtoine commented Nov 7, 2023

Describe the bug

when Git has a version prior to 2.43.0, --bare and --origin are incompatible options of ^git clone, thus gm clone --bare will fail with

fatal: --bare and --origin foo options are incompatible.

How to reproduce

tk run {
    gm clone https://github.com/raphamorim/rio --bare
}

will fail on Ubuntu for instance.

Expected behavior

either

Configuration

> git --version
git version 2.34.1

Additional context

See commit 3b910d6 (22 Sep 2022) by Jeff King (peff).
(Merged by Junio C Hamano (gitster) in commit 7aeb0d4, 10 Oct 2022)

@amtoine amtoine added bug Something isn't working as expected core Related to the main `nu-git-manager` module labels Nov 7, 2023
@amtoine
Copy link
Owner Author

amtoine commented Nov 7, 2023

a way to compare semantic versions

export def "semver parse" []: string -> record<major: int, minor: int, patch: int> {
    parse "{major}.{minor}.{patch}" | into value | into record
}

# Example
#     check the version of Git (see [*Why are git clone --bare and --origin incompatible?*](https://stackoverflow.com/questions/19434441/why-are-git-clone-bare-and-origin-incompatible))
#     > let git_version = (
#           git --version | str trim | parse "git version {version}" | into record | get version
#       )
#       $git_version | semver parse | semver after ("2.39.0" | semver parse)
export def "semver after" [
    other: record<major: int, minor: int, patch: int>
]: record<major: int, minor: int, patch: int> -> bool {
    let version = $in

    if $version.major < $other.major {
        return false
    }

    if $version.minor < $other.minor {
        return false
    }

    if $version.patch < $other.patch {
        return false
    }

    true
}

# Example
#     check the version of Git (see [*Why are git clone --bare and --origin incompatible?*](https://stackoverflow.com/questions/19434441/why-are-git-clone-bare-and-origin-incompatible))
#     > let git_version = (
#           git --version | str trim | parse "git version {version}" | into record | get version
#       )
#       $git_version | semver parse | semver before ("2.39.0" | semver parse)
export def "semver before" [
    other: record<major: int, minor: int, patch: int>
]: record<major: int, minor: int, patch: int> -> bool {
    not ($in | semver after $other)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected core Related to the main `nu-git-manager` module
Projects
None yet
Development

No branches or pull requests

1 participant