Skip to content

Inconsistencies using git describe --dirty #250

@umarcor

Description

@umarcor

While trying to use git describe --dirty to get a description of the repo, I found the behaviour of v2 misleading. At the same time, there are certain setups that produce a "dirty" state on Windows. To test it, I configured ~40 jobs in https://github.com/umarcor/ghdl/blob/checkout-dirty/.github/workflows/checkout.yml. Results are summarized in the following table:

job actions unshallow depth 0 inherit clone in MSYS2 pacman git dirty? msys dirty?
v1 (ubuntu) v1 - - - - - no -
v1 (windows) v1 - - - - - no -
v1 (macos) v1 - - - - - no -
v2 (ubuntu) v2 - - - - - fatal: No names found, cannot describe anything -
v2 (windows) v2 - - - - - fatal: No names found, cannot describe anything -
v2 (macos) v2 - - - - - fatal: No names found, cannot describe anything -
v2-depth0 (ubuntu) v2 - x - - - fatal: No names found, cannot describe anything no -
v2-depth0 (windows) v2 - x - - - fatal: No names found, cannot describe anything no -
v2-depth0 (macos) v2 - x - - - fatal: No names found, cannot describe anything no -
v2-unshallow (ubuntu) v2 x - - - - no -
v2-unshallow (windows) v2 x - - - - no -
v2-unshallow (macos) v2 x - - - - no -
v2-depth0-unshallow (ubuntu) v2 x x - - - fatal: --unshallow on a complete repository does not make sense -
v2-depth0-unshallow (windows) v2 x x - - - fatal: --unshallow on a complete repository does not make sense -
v2-depth0-unshallow (macos) v2 x x - - - fatal: --unshallow on a complete repository does not make sense -
master (ubuntu) master - - - - - fatal: No names found, cannot describe anything -
master (windows) master - - - - - fatal: No names found, cannot describe anything -
master (macos) master - - - - - fatal: No names found, cannot describe anything -
master-depth0 (ubuntu) master - x - - - fatal: No names found, cannot describe anything no -
master-depth0 (windows) master - x - - - fatal: No names found, cannot describe anything no -
master-depth0 (macos) master - x - - - fatal: No names found, cannot describe anything no -
master-unshallow (ubuntu) master x - - - - no -
master-unshallow (windows) master x - - - - no -
master-unshallow (macos) master x - - - - no -
msys-depth0 (MINGW32) master - x - - - fatal: No names found, cannot describe anything no git: command not found
msys-depth0 (MINGW64) master - x - - - fatal: No names found, cannot describe anything no git: command not found
msys-unshallow (MINGW32) master x - - - - no git: command not found
msys-unshallow (MINGW64) master x - - - - no git: command not found
msys-depth0-git (MINGW32) master - x - - x fatal: No names found, cannot describe anything no yes
msys-depth0-git (MINGW64) master - x - - x fatal: No names found, cannot describe anything no yes
msys-unshallow-git (MINGW32) master x - - - x no yes
msys-unshallow-git (MINGW64) master x - - - x no yes
msys-depth0-inherit (MINGW32) master - x x - - - fatal: No names found, cannot describe anything no
msys-depth0-inherit (MINGW64) master - x x - - - fatal: No names found, cannot describe anything no
msys-unshallow-inherit (MINGW32) master x - x - - - no
msys-unshallow-inherit (MINGW64) master x - x - - - no
msys-clone (MINGW32) - - - - x x - no
msys-clone (MINGW64) - - - - x x - no
msys-inherit-clone (MINGW32) - - - x x - - no
msys-inherit-clone (MINGW64) - - - x x - - no

Overall, I find misleading that using fetch-depth: 0 does not retrieve tags and, at the same time, it does not allow using --unshallow. It seems not possible to use the Action as is to retrieve some describable state. Some additional step is always required.

In my target use case, I need to run git describe --dirty in a script that is executed on MSYS2 (both MINGW32 and MING64). As shown in the table, there seem to be two possible setups only, and one of them produces an invalid result.

Precisely, cases msys-unshallow-git produce a dirty description, even if the repo is clean. These cases imply cloning a repo with this action and the using git installed through pacman. It seems to be some clonflict with line endings, but neither dos2unix nor unix2dos can fis it easily.
Hence, in order to get a clean description, users are "forced" to inherit the PATH and to avoid using git installed through pacman (cases msys-unshallow-inherit). This is undesirable, because other tools might be overriden through the PATH.

Alternatively, manually cloning the repo inside MSYS2 works ok, regardless of using git inherited from the PATH (cases msys-inherit-clone) or installed through pacman (cases msys-clone). However, this defeats the purpose of this action.

/cc @ericsciple

Ref #249 #240 #239 #217 #226

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions