summaryrefslogtreecommitdiffstats
path: root/repo-access.sh
diff options
context:
space:
mode:
Diffstat (limited to 'repo-access.sh')
-rw-r--r--repo-access.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/repo-access.sh b/repo-access.sh
index 2b6a5cc..b599dc8 100644
--- a/repo-access.sh
+++ b/repo-access.sh
@@ -1,4 +1,21 @@
##
+# systr_repo_check [<path>=PATH]
+#
+# Assert that the local repository path exists and is valid.
+##
+function systr_repo_check
+{
+ if [ $# -gt 0 ]; then
+ path="$1"
+ fi
+
+ if [ ! -f "$path/refs/HEAD" ]; then
+ echo "Fatal: $path is not a repository" >&2
+ exit 1
+ fi
+}
+
+##
# systr_repo_resolve_reference <ref>
#
# Resolve a revision name to a commit ID. The result is printed to