add branch parameter

This commit is contained in:
Trevor Batley 2023-07-23 17:28:12 +10:00
parent 98eddc7b64
commit c6e57c9475

View File

@ -109,11 +109,17 @@ fi
# See if repo exits in git # See if repo exits in git
if [ $DEBUG ] ; then echo "check if $REPO_NAME in $ORG_NAME exists on $GITEAHOST" ; fi if [ $DEBUG ] ; then echo "check if $REPO_NAME in $ORG_NAME exists on $GITEAHOST" ; fi
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME") BRANCHES=
if [ $BRANCH ] ; then $BRANCHES="/branches/${BRANCH#*=}" ; file
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME$BRANCHES")
if [ "$RESPONSE" == "200" ]; then if [ "$RESPONSE" == "200" ]; then
if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME exists!" ; fi if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME exists!" ; fi
else else
if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME does not exist" ; fi if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME does not exist" ; fi
if [ $BRANCH ] ; then
echo "Can't find the ${BRANCH#*=} branch of $ORG_NAME/$REPO_NAME - exiting"
exit 1
else
while true; do while true; do
read -p "Do you wish to run git-cvs2git?(y/n) " yn read -p "Do you wish to run git-cvs2git?(y/n) " yn
case $yn in case $yn in
@ -126,9 +132,10 @@ else
* ) echo "Please answer yes or no.";; * ) echo "Please answer yes or no.";;
esac esac
done done
fi
# And check it is now there # And check it is now there
if [ $DEBUG ] ; then echo "check if $REPO_NAME in $ORG_NAME exists on $GITEAHOST" ; fi if [ $DEBUG ] ; then echo "check if $REPO_NAME in $ORG_NAME exists on $GITEAHOST" ; fi
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME") RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME$BRANCHES")
if [ "$RESPONSE" == "200" ]; then if [ "$RESPONSE" == "200" ]; then
if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME created sucessfully!" ; fi if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME created sucessfully!" ; fi
else else