+/* git tools match /path/to/repo against /path/to/repo.git when the former
+ * doesn't exist and the latter does. repo_shell addresses this by stripping
+ * the .git prefix off all repopath's read in from .gitacls and the SSH comand
+ * line. This mimics the expected git tool behavior except when /path/to/repo
+ * and /path/to/repo.git both exist. This case shouldn't ever be seen anyway.
+ */
+static char *strip_repo(const char *repo_name)
+{
+ if (!repo_name)
+ return NULL;
+ else {
+ char *dot = rindex(repo_name, '.');
+
+ if (dot && !strcmp(dot, ".git"))
+ return xstrndup(repo_name, dot - repo_name);
+ else
+ return xstrdup(repo_name);
+ }
+}
+