]> granicus.if.org Git - postgis/commitdiff
Automatically use GIT if a .git directory exists locally
authorSandro Santilli <strk@keybit.net>
Tue, 1 Mar 2016 18:14:30 +0000 (18:14 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 1 Mar 2016 18:14:30 +0000 (18:14 +0000)
See #3482

git-svn-id: http://svn.osgeo.org/postgis/trunk@14732 b70326c6-7e19-0410-871a-916f4a2858ee

make_dist.sh

index 68b0e424f9379a8169bbb38d31c3d07851037acd..c267ad5dbbc6cce9e003baea8386e2a8a6946a60 100755 (executable)
 
 tag=trunk
 version=dev
+git=no
+
+[ -d ".git" ] && git=yes
+[ "$git" = "yes" ] && tag=svn-$tag
 
 if [ -n "$1" ]; then
   if [ "$1" = "-b" ]; then
     shift
     tag="branches/$1"
+    [ "$git" = "yes" ] && tag=svn-$1
+    branch=yes
   else
     version="$1"
     tag="tags/$version"
+    [ "$git" = "yes" ] && tag=$1
   fi
 fi
 
@@ -36,11 +43,18 @@ if [ -d "$outdir" ]; then
        exit 1
 fi
 
-echo "Exporting tag $tag"
-svnurl="http://svn.osgeo.org/postgis/$tag"
-svn export $svnurl "$outdir"
-if [ $? -gt 0 ]; then
-       exit 1
+if [ "$git" = "no" ]; then
+  echo "Exporting tag $tag"
+  svnurl="http://svn.osgeo.org/postgis/$tag"
+  svn export $svnurl "$outdir"
+  if [ $? -gt 0 ]; then
+    exit 1
+  fi
+else
+  git clone -b $tag . $outdir || exit 1
+  #cd $outdir
+  #git checkout $tag || exit 1
+  #cd -
 fi
 
 echo "Removing ignore files, make_dist.sh and HOWTO_RELEASE"
@@ -77,6 +91,10 @@ echo "Running make distclean"
 owd="$PWD"
 cd "$outdir"
 make distclean
+if [ "$git" = "yes" ]; then
+  echo "Removing .git dir"
+  rm -rf .git
+fi
 cd "$owd"
 
 # Find a better version name when fetching