diff options
author | Malf Furious <m@lfurio.us> | 2017-04-28 01:39:38 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2017-04-28 01:39:38 -0400 |
commit | c9c0749416f848d07f33feb2b37bc09c97caf73d (patch) | |
tree | d96f8fc5f2e5e06c499146e85756de4033b8560c | |
parent | 9ada601ecdbe5b03b15385e9e65d98ad3aad7ff7 (diff) | |
download | systrunk-c9c0749416f848d07f33feb2b37bc09c97caf73d.tar.gz systrunk-c9c0749416f848d07f33feb2b37bc09c97caf73d.zip |
Add init module
-rw-r--r-- | init.sh | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -0,0 +1,39 @@ +## +# init_wktree <unused> <unused> [<remote>] <path> +# +# Assert that the repository at <path> 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 +} |