]> oss.titaniummirror.com Git - repo_shell.git/blobdiff - acl_test.c
Code for supporting git ACLs. acl_test is useful.
[repo_shell.git] / acl_test.c
diff --git a/acl_test.c b/acl_test.c
new file mode 100644 (file)
index 0000000..f8d5f71
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2012, Titanium Mirror, Inc.
+ * All Rights Reserved.
+ *
+ * This document is the proprietary and confidential property of
+ * Titanium Mirror, Inc.  All use, distribution, reproduction or re-distribution
+ * is disallowed without the prior express written consent of
+ * Titanium Mirror, Inc.
+ */
+
+/*
+ * Test parsing of the git acl config file
+ *
+ * @author R. Steve McKown <rsmckown@gmail.com>
+ */
+
+#include <stdio.h>
+#include "git_acl.h"
+
+int main(int argc, char **argv)
+{
+  char *file = "git_acl.cfg.example";
+  perms_t p;
+
+  if (argc != 3)
+    die("usage: %s <username> <reponame>\n", argv[0]);
+
+  p = git_acl(argv[1], argv[2], file); /* file=NULL for default */
+
+  printf("config file %s\n"
+      "GITACL(%s@%s) = %s(%u)\n  via repoid='%s', userid='%s'\n",
+      file, argv[1], argv[2], git_acl_perms_as_str(p), p,
+      git_acl_last_repoid(), git_acl_last_userid());
+  return 0;
+}