]> scripts.mit.edu Git - wizard.git/blobdiff - bin/gct
Have gct properly change ownership instead of 777, add null argument testing.
[wizard.git] / bin / gct
diff --git a/bin/gct b/bin/gct
index bdc2ca81ad1bf78ec0ad13f76dea6f662d16e128..e3da5a8645529781967bb4f3792555bf02c1c086 100755 (executable)
--- a/bin/gct
+++ b/bin/gct
@@ -1,4 +1,12 @@
-#!/bin/sh
+#!/bin/bash
+set -e
+if [ -z "$1" ]
+then
+    echo "Usage: gct FILE"
+    exit 1
+fi
+OWNER=$(stat -c "%u:%g" "$1")
+set -x
 git checkout --theirs "$1"
-chmod 0777 "$1"
+chown "$OWNER" "$1"
 git add "$1"