commit 6fe80b4ed5edb6951a5ae5b1e4156539d20c9d13
parent 44f0defb232ef82e60e6d72d3696dbb25054b615
Author: dsp <dsp@2f30.org>
Date:   Fri, 17 Apr 2015 12:10:07 -0600
now checks for the existance of the linked file before performing unmask
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gogithub b/gogithub
@@ -11,7 +11,9 @@
 
 checkexistence() {
 	localpkg=${1#*/}
-	if ! [ -e "$GOPATH/src/github.com/$1" ] || ! [ -e "$GOPATH/src/$localpkg" ]; then
+	if [ -L "$GOPATH/src/github.com/$1" ] && [ -e "$GOPATH/src/$localpkg" ]; then
+		echo "link found. already masked"
+	elif ! [ -e "$GOPATH/src/github.com/$1" ] || ! [ -e "$GOPATH/src/$localpkg" ]; then
 		echo "package with the same name not found under $GOPATH/src/github.com and $GOPATH/src"
 		exit 1
 	fi
@@ -19,13 +21,14 @@ checkexistence() {
 
 mask() {
 	echo "masking" $1
+	localpkg=${1#*/}
 	checkexistence $1
 	if [ -e "$GOPATH/src/github.com/$1-upstream" ]; then
 		echo "package has been already masked. resolve manually"
 		exit 1
 	fi
 	mv $GOPATH/src/github.com/$1 $GOPATH/src/github.com/$1-upstream
-	ln -s $GOPATH/src/localpkg $GOPATH/src/github.com/$1
+	ln -s $GOPATH/src/$localpkg $GOPATH/src/github.com/$1
 	exit 0
 }