x-motemen / git-pr-release

Release pull request generator
https://rubygems.org/gems/git-pr-release
MIT License
689 stars 76 forks source link

unshallow if a shallow repository #88

Closed Songmu closed 2 years ago

Songmu commented 2 years ago

git-pr-release requires git history. However, in many CI services in recent years, the shallow clone is used by default for speed. e.g., https://github.com/actions/checkout

It requires users to write additional settings such as fetch-depth: 0, which is a pitfall for beginners.

To make it easier to use, I add behavior to determine if a repository is a shallow repository and, if so, unshallow it.

It may be controversial whether this behavior is also applied when --no-fetch is specified. Still, I added this behavior uniformly since git-pr-release does not work correctly with a shallow clone.

git fetch --unshallow is available git 1.8.3 or later, and git rev-parse --is-shallow-repository is also 2.15. These are old enough, and in recent years, users have been using the newer git client for security reasons, so I do not check the git version compatibility.