From 2ef5c0c8e476fb92a56cf05c72a327d47cbfbf3c Mon Sep 17 00:00:00 2001
From: Jeff Fein-Worton <jeff@fein-worton.com>
Date: Tue, 11 Mar 2014 22:47:27 -0700
Subject: [PATCH] Improved post-init-add-origin hook

Added better help text
Added error message if $GITURL unset
---
 doc/sample_hooks/post-init-add-origin | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/doc/sample_hooks/post-init-add-origin b/doc/sample_hooks/post-init-add-origin
index a3030d5..993f3c7 100755
--- a/doc/sample_hooks/post-init-add-origin
+++ b/doc/sample_hooks/post-init-add-origin
@@ -1,6 +1,18 @@
 #!/bin/sh
 
-# This adds a remote origin at $GITURL/dotfiles/$VCSH_DIRECTORY
-# Assumes $GITURL is set to the base of your remote repos.
+# This adds a remote origin at $GITURL/dotfiles/$VCSH_DIRECTORY which
+# is helpful for creating new dotfile repositories that you plan to
+# store on (e.g.) Github.
+#
+# You must set $GITURL in order to use this hook. For example, add the
+# following to your .bashrc (or equivalent for your shell), replacing
+# YOURUSERNAME with your github username:
+#
+# export GITURL="git@github.com:YOURUSERNAME"
+
+if [ -z $GITURL ]; then
+    echo "\$GITURL is not set; please see post-init-add-origin hook"
+    exit 1;
+fi
 
 vcsh $VCSH_DIRECTORY remote add origin $GITURL/dotfiles/$VCSH_DIRECTORY
-- 
GitLab