saltstack / saltstack/salt

git.latest is confused on Windows

Open
#55,797 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

When executing salt state git.latest on a Windows minion, the minion is confused about the branch name. It compares the branch name with the same branch name, but with an additional LF character.
e.g.:

ID: XXX
Function: git.latest
Name: https://hostname/.../repository.git
Result: False
Comment: Repository would be updated to cb36b52, but this is not a fast-forward merge. Set 'force_reset' to True to force this update. The desired rev (master) differs from the name of the local branch (master
              ), if the desired rev is a branch name then a forced update could possibly be avoided by setting the 'branch' argument to 'master' instead.
Started: 22:04:09.633601
Duration: 3093.719 ms
Changes:   

Note the additional newline after the second time the branchname is shown.

Setup

Use state git.latest on a minion.
Use a valid GIT workspace directory there.

Versions Report
Salt Version:
           Salt: 2019.2.2
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: unknown
       dateutil: 2.4.2
      docker-py: 2.6.1
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8.1
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.35.2
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 3.6.8 (default, Aug  7 2019, 17:28:10)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.4.2
            ZMQ: 4.1.4
 
System Versions:
           dist: centos 7.7.1908 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-1062.9.1.el7.x86_64
         system: Linux
        version: CentOS Linux 7.7.1908 Core

same version (2019.2.2) on the Windows minion.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the git.latest implementation and reproduce the reported state on a Windows minion using a valid Git workspace. Trace how the local branch name is obtained and compared with the desired revision; done means the branch names compare without the extra LF and the state no longer reports a false mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.