tSupport comparison with .git suffix as well. - git-restrict - simple utility for git repo permission management HTML git clone https://git.parazyd.org/git-restrict DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- DIR commit e89e577c47a2c5077cd32ecb5a67769b776fa804 DIR parent 2cdc1aaee457c45e8943c80f9a5ab7fa17e5da77 HTML Author: parazyd <parazyd@dyne.org> Date: Wed, 31 Mar 2021 03:57:23 +0200 Support comparison with .git suffix as well. Diffstat: M git-restrict.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- DIR diff --git a/git-restrict.c b/git-restrict.c t@@ -22,7 +22,7 @@ int main(int argc, char *argv[]) { - char *orig_cmd, *cmd, *repo; + char *orig_cmd, *cmd, *repo, *buf; int i, authorized = 0; if (argc < 2) { t@@ -49,10 +49,16 @@ int main(int argc, char *argv[]) repo++; repo[strlen(repo)-1] = 0; for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], repo)) { + buf = malloc(strlen(repo)+4); + sprintf(buf, "%s.git", argv[i]); + + if (!strcmp(argv[i], repo) || !strcmp(buf, repo)) { authorized = 1; + free(buf); break; } + + free(buf); } if (authorized)