/
githubmirror
/
mpfr
Обзор
Документация
Войти
/
githubmirror
/
mpfr
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tools/export-release
38 строк
911 B
Brian Gladman
changes from master
06 июн 2022, 00:01
06 июн 2022, 00:01
fb7532c
Код
Авторство
О чём код?
#!/bin/sh # Export some release identified by a Git tag in order to get a tarball. set -e if [ $# -ne 2 ]; then echo "Usage: $0 <tag> <dir>" >&2 exit 1 fi tag=$1 dir="$2/mpfr-$tag" # Make sure that the upstream repository is up-to-date by getting # the commit id associated with the tag from it. url="https://gitlab.inria.fr/mpfr/mpfr.git" lsr=$(git ls-remote --tags "$url" "refs/tags/$tag^{}") if [ -z "$lsr" ]; then echo "$0: tag '$tag' doesn't exist" exit 2 fi id=${lsr%%[[:space:]]*} echo "commit id: $id" # https://stackoverflow.com/a/163769/3782797 mkdir "$dir" git archive --format=tar "$id" | tar -x -C "$dir" # Fix the timestamps so that each file or directory has a timestamp # corresponding to its last change. # https://stackoverflow.com/a/36243002/3782797 for f in $(git ls-tree -r -t --name-only "$id") do touch -d $(git log --pretty=format:%cI -1 "$id" -- "$f") "$dir/$f" done