Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use HEAD as default reference for git archive.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 14 Jun 2013 10:58:39 +0000 (12:58 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 14 Jun 2013 11:01:43 +0000 (13:01 +0200)
The default branch may be undefined.

tools/check_dist_archive

index 53b1d1f..d282149 100755 (executable)
@@ -13,7 +13,7 @@ fi
 
 if [ $# -lt 1 -o $# -gt 3 ]; then
     cat <<EOF
 
 if [ $# -lt 1 -o $# -gt 3 ]; then
     cat <<EOF
-Usage: $0 [-batch] archive.tar.gz [git_url [git_branch]]
+Usage: $0 [-batch] archive.tar.gz [git_url [git_reference]]
 EOF
     exit 1
 fi
 EOF
     exit 1
 fi
@@ -26,10 +26,10 @@ fi
 
 if [ $# -ge 2 ]; then
     giturl=$2
 
 if [ $# -ge 2 ]; then
     giturl=$2
-    gitbranch=${3:-master}
+    gitref=${3:-master}
 else
     giturl=$(git rev-parse --show-toplevel)
 else
     giturl=$(git rev-parse --show-toplevel)
-    gitbranch=$(git branch | sed -n '/^\*/{s/^..//;p;}')
+    gitref=HEAD
 fi
 
 tmpdir=$(mktemp -d)
 fi
 
 tmpdir=$(mktemp -d)
@@ -60,8 +60,8 @@ tar --directory "$tmpdir" \
     --transform 's!^[^/]*!a!' \
     --extract --gunzip --file "$archive"
 
     --transform 's!^[^/]*!a!' \
     --extract --gunzip --file "$archive"
 
-echo "Copying git repository: $giturl/$gitbranch -> $git_dir"
-git archive --format=tar --prefix="b/" --remote="$giturl" "$gitbranch" \
+echo "Copying git repository: $giturl/$gitref -> $git_dir"
+git archive --format=tar --prefix="b/" --remote="$giturl" "$gitref" \
     | tar --directory "$tmpdir" --extract --file -
 
 fa=from_tgz
     | tar --directory "$tmpdir" --extract --file -
 
 fa=from_tgz