git-restrict

simple utility for git repo permission management
git clone https://git.parazyd.org/git-restrict
Log | Files | Refs | README | LICENSE

commit e89e577c47a2c5077cd32ecb5a67769b776fa804
parent 2cdc1aaee457c45e8943c80f9a5ab7fa17e5da77
Author: parazyd <parazyd@dyne.org>
Date:   Wed, 31 Mar 2021 03:57:23 +0200

Support comparison with .git suffix as well.

Diffstat:
Mgit-restrict.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/git-restrict.c b/git-restrict.c @@ -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) { @@ -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)