[csw-devel] SF.net SVN: opencsw:[541] gar-wrapper/mgar

skayser at users.sourceforge.net skayser at users.sourceforge.net
Wed Sep 21 14:11:59 CEST 2011


Revision: 541
          http://opencsw.svn.sourceforge.net/opencsw/?rev=541&view=rev
Author:   skayser
Date:     2011-09-21 12:11:59 +0000 (Wed, 21 Sep 2011)
Log Message:
-----------
mgar: fix vcs metadata lookup, lives at the working copy root

Modified Paths:
--------------
    gar-wrapper/mgar

Modified: gar-wrapper/mgar
===================================================================
--- gar-wrapper/mgar	2011-09-19 21:52:02 UTC (rev 540)
+++ gar-wrapper/mgar	2011-09-21 12:11:59 UTC (rev 541)
@@ -162,22 +162,32 @@
   exit 2
 }
 
+function get_vcstype {
+  local __dir=`get_absolute_dirname "$1"`
+  while :; do
+    [ -d "${__dir}/.svn" ] && { echo "svn"; return; }
+    [ -d "${__dir}/.git" ] && { echo "git"; return; }
+    [ "${__dir}" == "/" ] && return
+    __dir=`dirname ${__dir}`
+  done
+}
+
 # Makes mgar fail gracefully in case of unexpected svn/git hickups like
 # the ones introduced with the backwards-incompatible svn 1.7pre3 release.
 # svn: E155036: Working copy [...] too old (format 10, created by Subversion 1.6
 function assert_vcsdir_valid {
   local __dir="$1"
-  local __vcstype=""
+  local __vcstype=`get_vcstype "${__dir}"`
   local __out=""
 
   # Temporarily disable the global set -e to handle exit codes != 0
   set +e
-  [ -d "${__dir}/.svn" ] && __vcstype="svn"
-  [ -d "${__dir}/.git" ] && __vcstype="git"
   case ${__vcstype} in
     svn) __out=`svn status "${__dir}" 2>&1`;;
     git) __out=`git status "${__dir}" 2>&1`;;
-    *) __out="Directory neither contains .svn or .git"; /bin/false;;
+    *) __out="Directory not versioned? No VCS metadata found upwards til /."
+       /bin/false
+       ;;
   esac
   [ $? -eq 0 ] || die_vcsdir_invalid "${__dir}" "${__out}"
   set -e

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list