mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-12-02 04:46:41 -05:00
fix: give tagless Debian snapshots a numeric version
Use 0~git.<commit-count>.<hash> so tagless snapshots sort in ancestry order and accept hashes beginning with a letter. A shallow checkout without a reachable tag must supply a version rather than compare unreliable history depths. Preserve explicit and tag-derived versions.
This commit is contained in:
parent
c9d34cdff9
commit
8d93e29ad8
1 changed files with 13 additions and 3 deletions
|
|
@ -30,7 +30,9 @@ Generated debian/changelog from git log
|
|||
|
||||
Options:
|
||||
--name NAME Name of package (required)
|
||||
--version VERSION Place in git history to include upto (default: ::guess::)
|
||||
--version VERSION Package version (default: infer from Git). If it names
|
||||
a tag, end the changelog there; otherwise use HEAD.
|
||||
Required in shallow clones with no reachable tag.
|
||||
--distro DISTRO Distribution name (default: ::guess::)
|
||||
--codename NAME Distribution codename (default: ::guess::)
|
||||
--urgency URGENCY Urgency (default: medium)
|
||||
|
|
@ -98,7 +100,15 @@ git_author_and_time() {
|
|||
|
||||
# Function to get git version
|
||||
git_version() {
|
||||
git describe --always --tags --dirty 2>/dev/null || echo "unknown"
|
||||
git describe --tags --dirty 2>/dev/null || {
|
||||
commit=$(git describe --always --dirty) || return 1
|
||||
if [ "$(git rev-parse --is-shallow-repository)" != false ]; then
|
||||
echo "Error: tagless snapshots need full history; fetch it or specify --version" >&2
|
||||
return 1
|
||||
fi
|
||||
count=$(git rev-list --count HEAD) || return 1
|
||||
printf '0~git.%s.%s\n' "$count" "$commit"
|
||||
}
|
||||
}
|
||||
|
||||
# Function to guess distribution
|
||||
|
|
@ -129,7 +139,7 @@ if [ "$CODENAME" = "::guess::" ]; then
|
|||
fi
|
||||
|
||||
if [ "$VERSION" = "::guess::" ]; then
|
||||
VERSION=$(git_version)
|
||||
VERSION=$(git_version) || exit 1
|
||||
fi
|
||||
|
||||
# Version suffix
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue