diff --git a/git-cvs2git.sh b/git-cvs2git.sh index 58495f7..cfcd298 100755 --- a/git-cvs2git.sh +++ b/git-cvs2git.sh @@ -48,7 +48,7 @@ while read -r line || [[ -n "$line" ]]; do fi fi done < "$inifilename" -DEBUG=false +DEBUG= if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi if [ $DEBUG ] ; then echo "************found ini file: $inifilename" ; fi @@ -57,7 +57,7 @@ QUIET="-q" curlsilent="-s" if [ $DEBUG ] ; then QUIET= - curlsilent= + curlsilent="-v" fi # Make this null to get curl to check ssl cert checkSSL="-k" @@ -142,14 +142,6 @@ cd $CVSFiles # if there at all if [ -d "$1" ] ; then if [ $DEBUG ] ; then echo "************Deleting local CVS files" ; fi -# cd $CVSFiles/$1 - # Delete all files, links and directories -# find . -maxdepth 999 -xtype l -delete -# find . -maxdepth 999 -type f -delete - # we seem to need this as well -# find . -xtype l -exec rm -f {} + -# find . -maxdepth 999 -type d -delete -# cd $CVSFiles rm -Rf $CVSFiles/$1 fi @@ -219,25 +211,19 @@ cd $GITFiles # Delete the local first if [ -d "$1" ] ; then if [ $DEBUG ] ; then echo "************Deleting local GIT files" ; fi -# cd $GITFiles/$1 -# find . -maxdepth 999 -xtype l -delete -# find . -maxdepth 999 -type f -delete - # we seem to need this as well -# find . -xtype l -exec rm -f {} + -# find . -maxdepth 999 -type d -delete -# cd $GITFiles -# rmdir $1 rm -Rf $GITFiles/$1 fi # See if it exists on the Gitea host REPO_NAME=$1 -RESPONSE=$(curl "$checkSSL" -s -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME") +if [ $DEBUG ] ; then echo "curl $checkSSL $curlsilent -o /dev/null -w %{http_code} $GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME" +RESPONSE=$(curl $checkSSL $curlsilent -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME") if [ "$RESPONSE" == "200" ]; then if [ $DEBUG ] ; then echo "************Repository for $1 already exists!" ; fi # If so, clone it (just want the README.md) # And Clone it + if [ $DEBUG ] ; then echo "git clone $GITEAHOST/$ORGGITEA/$1.git" ; fi cd $GITFiles git clone "$GITEAHOST/$ORGGITEA/$1.git" #GIT_SSL_NO_VERIFY=true git clone "$GITEAHOST/$ORGGITEA/$1.git" @@ -261,13 +247,7 @@ if [ -d "$1" ] ; then if [ $DEBUG ] ; then echo "************Saved README: $READMECONTENTS" ; fi # Delete all files, links and directories if [ $DEBUG ] ; then echo "************Deleting local GIT files" ; fi -# find . -maxdepth 999 -xtype l -delete -# find . -maxdepth 999 -type f -delete - # we seem to need this as well -# find . -xtype l -exec rm -f {} + -# find . -maxdepth 999 -type d -delete cd $GITFiles -# rmdir $1 rm -Rf $GITFiles/$1 fi @@ -276,12 +256,14 @@ cd $GITFiles #git init $QUIET $1 # Now delete the remote repo and re-create it and clone it in to local +if [ $DEBUG ] ; then echo "Delete $ORGGITEA/$1" ; fi curl "$checkSSL" "$curlsilent" -X 'DELETE' \ "$GITEAHOST/api/v1/repos/$ORGGITEA/$1" \ -H 'accept: application/json' \ -H "Authorization: token $GITEAACCESSTOKEN" # and check if it is here. +if [ $DEBUG ] ; then echo "Check if $ORGGITEA/$1 is there!" ; fi RESPONSE=$(curl $curlsilent -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$1") if [ "$RESPONSE" == "200" ]; then if [ $DEBUG ] ; then echo "************Repository for $1 exists!" ; fi