Skip to content

git.latest rev=tag fails with old git(1) #30999

Closed

Description

@orymate

According to the documentation, from 2015.8 git.latest tries to unset the upstream branch if the specified rev is a tag. This is achieved with the --unset-upstream switch of git branch, which is unavailable before git 1.9.2. The default git package of Ubuntu 12.04 LTS version is bellow this.

Workaround suggested by @BABILEN is to add a patched _states/git.py with s/\['--unset-upstream']/None/' applied.

Reproducing:

# salt precise state.low '{"state": "git", "fun": "latest", "name": "https://github.com/saltstack/pepper.git", "rev": "0.1.0", "target": "/tmp/a"}'
precise:
    ----------
    __run_num__:
        0
    changes:
        ----------
        new:
            https://github.com/saltstack/pepper.git => /tmp/a
    comment:
        error: unknown option `unset-upstream'
        usage: git branch [options] [-r | -a] [--merged | --no-merged]
        [...]
            --merged <commit>     print only merged branches

        Changes already made: https://github.com/saltstack/pepper.git cloned to /tmp/a. Repository was reset to 0.1.0 (d7c2a24).
    duration:
        3434.94
    name:
        https://github.com/saltstack/pepper.git
    result:
        False
    start_time:
        15:51:08.117198

Activity

  1. added
    bug
    severity-medium
    P3
    Platform
    on Feb 8, 2016
  2. added this to the Approved milestone on Feb 8, 2016
  3. jfindlay commented on Feb 8, 2016

    @jfindlay
    Contributor

    @orymate, thanks for reporting.

  4. modified the milestones: B 2, Approved on Feb 18, 2016
  5. self-assigned this
    on Feb 18, 2016
  6. added
    fixed-pls-verify
    on Feb 18, 2016
  7. added a commit that references this issue on Feb 18, 2016
  8. terminalmage commented on Feb 18, 2016

    @terminalmage
    Contributor

    This is fixed in #31301. Just FYI, I did some digging and found that --unset-upstream was added in 1.8.0, not 1.9.2.

  9. wwentland commented on Feb 18, 2016

    @wwentland
    Contributor

    Very nice, ta @terminalmage

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

Metadata

Metadata

Assignees

Labels

P3PlatformState-Modulebugfixed-pls-verifyseverity-medium

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions