summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-01-01 02:49:21 +0100
committerAki <please@ignore.pl>2024-01-01 02:49:21 +0100
commit1b5c9e71c96a8711b9b254a2025a19d2b5601ab0 (patch)
treeee23d00052ec37e86dd53da4be3fda6223f9aeb7
parent1d831d8194e2965162695188879de185b400e703 (diff)
downloadmirror-1b5c9e71c96a8711b9b254a2025a19d2b5601ab0.zip
mirror-1b5c9e71c96a8711b9b254a2025a19d2b5601ab0.tar.gz
mirror-1b5c9e71c96a8711b9b254a2025a19d2b5601ab0.tar.bz2
Fixed weird edge case in day revision part
-rw-r--r--mirror.12
-rw-r--r--mirror.52
-rwxr-xr-xversion14
3 files changed, 10 insertions, 8 deletions
diff --git a/mirror.1 b/mirror.1
index d595da6..361f256 100644
--- a/mirror.1
+++ b/mirror.1
@@ -1,4 +1,4 @@
-.TH mirror 1 "2023-12-01"
+.TH mirror 1 "2024-01-01"
.SH NAME
mirror \- copies remote git repositories in bulk
.SH SYNOPSIS
diff --git a/mirror.5 b/mirror.5
index 0e8fef3..0bef2d9 100644
--- a/mirror.5
+++ b/mirror.5
@@ -1,4 +1,4 @@
-.TH mirror 5 "2023-12-01"
+.TH mirror 5 "2024-01-01"
.SH NAME
mirror \- file format for listing sources for git repository mirrors
.SH SYNTAX
diff --git a/version b/version
index b967060..e7c6cb3 100755
--- a/version
+++ b/version
@@ -15,13 +15,15 @@ try_tag() {
if ! version=$(try_tag); then
fmt=%Y%m%d
- set -- $(git rev-list --date=format:${fmt} --pretty=%ad --no-commit-header --since=yesterday HEAD)
- if [ $# -gt 0 ]; then
- suffix=$#
- git diff-index --quiet HEAD -- || suffix=$(( $# + 1 ))
- version="$1.${suffix}"
+ if git diff-index --quiet HEAD --; then
+ latest="$(git rev-list -1 --date=format:${fmt} --pretty=%ad --no-commit-header HEAD)"
+ modified=0
else
- version="$(date +${fmt}).1"
+ latest="$(date +${fmt})"
+ modified=1
fi
+ count=$(git rev-list --date=format:${fmt} --pretty=%ad --no-commit-header HEAD | sed -n /${latest}/p | wc -l)
+ count=$(( ${count} + ${modified} ))
+ version="${latest}.${count}"
fi
echo "${version}"