Added more pub-git commands

This commit is contained in:
Austen Adler 2015-12-31 12:55:30 -05:00
parent 8a08e483f5
commit f3af0da923

View File

@ -237,22 +237,44 @@ function rc(){
}
function pub-git-init(){
# Get the project name
branch=$(git remote -v | ag '^origin\s+' | sed -e 's/^origin\s*//' | cut -d\ -f1 | sed -e 's/^.\+\///' -e 's/\.git$//' | head -n1)
branch=$(git remote -v | ag '^origin\s+' | sed -e 's/^origin\s*//' | cut -d\ -f1 | sed -r -e 's/^.+\///' -e 's/#.+$//' -e 's/\.git$//' | head -n1)
echo "Branch: $branch"
# Get the hashed project name
enc_branch=$("$branch" | sha512sum | cut -d\ -f1)
git remote add local "git@localhost:$branch"
enc_branch=$(echo "$branch" | sha512sum | cut -d\ -f1)
git remote add local "gcrypt::git@localhost:stonewareslord/79a79b1a6e37813d9226872c6428aca29eec9f6111558109861cb0dcd2f0ffc8198deea4e361f84e170989212452fdfb21e0ef690da2ad399c03ce308d79dcfe#$enc_branch"
git remote add ncsu "gcrypt::git@github.ncsu.edu:agadler/a86a0f8757772be2ec617b395a0716679bfce51c1bfdeb8da6127feebd84facde645e9e30188318344eb458f5834e3d86800.git#$enc_branch"
git remote add gitlab "gcrypt::git@gitlab.com:stonewareslord/e6e03ea006d55de0970a28bcb7fcf65f4c66f98f50830bd69b50c5dc502bdf1a4e4172187cfb5fcef8c32bd7fb316bdc67d7d86713ebfe232f97eb303ac316ae.git#$enc_branch"
git config remote.ncsu.gcrypt-participants "CCDFE3F1"
git config remote.gitlab.gcrypt-participants "CCDFE3F1"
}
function pub-git-rm(){
if (( $# = 0 )) ; then
git remote rm local
git remote rm ncsu
git remote rm gitlab
fi
while (( $# > 0 )) ; do
git remote rm "$1"
shift
done
}
function pub-git-push(){
if (( $# = 0 )) ; then
git push local --all && git push local --tags
git push ncsu --all && git push ncsu --tags
git push gitlab --all && git push gitlab --tags
fi
while (( $# > 0 )) ; do
git push "$1" --all && git push "$1" --tags
shift
done
}
function pub-git-clone(){
case $1 in
ncsu) remote="gcrypt::git@github.ncsu.edu:agadler/a86a0f8757772be2ec617b395a0716679bfce51c1bfdeb8da6127feebd84facde645e9e30188318344eb458f5834e3d86800.git#" ;;
gitlab) remote="gcrypt::git@gitlab.com:stonewareslord/e6e03ea006d55de0970a28bcb7fcf65f4c66f98f50830bd69b50c5dc502bdf1a4e4172187cfb5fcef8c32bd7fb316bdc67d7d86713ebfe232f97eb303ac316ae.git#" ;;
#TODO: Fix enc_branch
local) remote="git@localhost:" ;;
*) echo "Opts: ncsu gitlab local" ; return 1
local) remote="gcrypt::git@localhost:stonewareslord/79a79b1a6e37813d9226872c6428aca29eec9f6111558109861cb0dcd2f0ffc8198deea4e361f84e170989212452fdfb21e0ef690da2ad399c03ce308d79dcfe#" ;;
*) echo "Opts: local ncsu gitlab" ; return 1
esac
shift
if [ -z "$1" ] ; then
@ -332,3 +354,6 @@ echo -ne '[##### ]\r'
antigen apply
echo -ne '[######]\r'
echo
# OPAM configuration
. /home/stonewareslord/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true