fix issue checking detached when git less than 2.22 by ericsciple · Pull Request #128 · actions/checkout (original) (raw)

@ericsciple

@ericsciple

ericsciple

@ericsciple

@ericsciple ericsciple changed the titlefix issue checking detached when git less than 2.22 [wip] fix issue checking detached when git less than 2.22

Jan 2, 2020

@ericsciple

@ericsciple

@ericsciple ericsciple changed the title[wip] fix issue checking detached when git less than 2.22 fix issue checking detached when git less than 2.22

Jan 2, 2020

ericsciple

// Note, this implementation uses "rev-parse --symbolic-full-name" because the output from
// "branch --list" is more difficult when in a detached HEAD state.
const args = ['rev-parse', '--symbolic'];
// Note, this implementation uses "rev-parse --symbolic-full-name" because there is a bug

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i ran into this bug in git 2.18 when testing. Switching to --symbolic-full-name and trimming refs/heads/ and refs/remotes/ from the output works around the issue.

ericsciple

@@ -4799,9 +4799,11 @@ class GitCommandManager {
branchList(remote) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useful script for testing:

  - run: |
      cd ..
      Invoke-WebRequest -Uri https://github.com/git-for-windows/git/releases/download/v2.18.0.windows.1/MinGit-2.18.0-64-bit.zip -OutFile mingit.zip
      mkdir mingit
      Expand-Archive -LiteralPath .\mingit.zip -DestinationPath .\mingit
      dir .\mingit
      echo "::add-path::$PWD\mingit\cmd"

TingluoHuang

This was referenced

Mar 6, 2021

This was referenced

Mar 14, 2021

This was referenced

Mar 15, 2021

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})