From c9c0749416f848d07f33feb2b37bc09c97caf73d Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Fri, 28 Apr 2017 01:39:38 -0400 Subject: Add init module --- init.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 init.sh (limited to 'init.sh') diff --git a/init.sh b/init.sh new file mode 100644 index 0000000..b772015 --- /dev/null +++ b/init.sh @@ -0,0 +1,39 @@ +## +# init_wktree [] +# +# Assert that the repository at exists, then setup the +# .systr directory at the CWD. +## +function init_wktree +{ + if [ $# -gt 3 ]; then + remote=$3 + shift + else + remote="" + fi + + path=$3 + + # local repository # + if [[ "$remote" == "" ]]; then + if [ ! -f "$path/HEAD" ]; then + echo "Error: $path is not a repository" + exit 1 + fi + + mkdir -p .systr/ + + echo "" >.systr/remote + echo "$path" >.systr/path + echo "NULL" >.systr/BASE + echo "NULL" >.systr/TRAC + + echo "Setup worktree at $(pwd)" + + # remote repository # + else + exit 1 + + fi +} -- cgit v1.2.3