diff options
author | Vincent Ambo <mail@tazj.in> | 2021-09-21T10·03+0300 |
---|---|---|
committer | Vincent Ambo <mail@tazj.in> | 2021-09-21T11·29+0300 |
commit | 43b1791ec601732ac31195df96781a848360a9ac (patch) | |
tree | daae8d638343295d2f1f7da955e556ef4c958864 /third_party/git/t/helper/test-regex.c | |
parent | 2d8e7dc9d9c38127ec4ebd13aee8e8f586a43318 (diff) |
chore(3p/git): Unvendor git and track patches instead r/2903
This was vendored a long time ago under the expectation that keeping it in sync with cgit would be easier this way, but it has proven not to be a big issue. On the other hand, a vendored copy of git is an annoying maintenance burden. It is much easier to rebase the single (dottime) patch that we have. This removes the vendored copy of git and instead passes the git source code to cgit via `pkgs.srcOnly`, which includes the applied patch so that cgit can continue rendering dottime. Change-Id: If31f62dea7ce688fd1b9050204e9378019775f2b
Diffstat (limited to 'third_party/git/t/helper/test-regex.c')
-rw-r--r-- | third_party/git/t/helper/test-regex.c | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/third_party/git/t/helper/test-regex.c b/third_party/git/t/helper/test-regex.c deleted file mode 100644 index d6f28ca8d148..000000000000 --- a/third_party/git/t/helper/test-regex.c +++ /dev/null @@ -1,114 +0,0 @@ -#include "test-tool.h" -#include "gettext.h" - -struct reg_flag { - const char *name; - int flag; -}; - -static struct reg_flag reg_flags[] = { - { "EXTENDED", REG_EXTENDED }, - { "NEWLINE", REG_NEWLINE }, - { "ICASE", REG_ICASE }, - { "NOTBOL", REG_NOTBOL }, - { "NOTEOL", REG_NOTEOL }, -#ifdef REG_STARTEND - { "STARTEND", REG_STARTEND }, -#endif - { NULL, 0 } -}; - -static int test_regex_bug(void) -{ - char *pat = "[^={} \t]+"; - char *str = "={}\nfred"; - regex_t r; - regmatch_t m[1]; - - if (regcomp(&r, pat, REG_EXTENDED | REG_NEWLINE)) - die("failed regcomp() for pattern '%s'", pat); - if (regexec(&r, str, 1, m, 0)) - die("no match of pattern '%s' to string '%s'", pat, str); - - /* http://sourceware.org/bugzilla/show_bug.cgi?id=3957 */ - if (m[0].rm_so == 3) /* matches '\n' when it should not */ - die("regex bug confirmed: re-build git with NO_REGEX=1"); - - return 0; -} - -int cmd__regex(int argc, const char **argv) -{ - const char *pat; - const char *str; - int ret, silent = 0, flags = 0; - regex_t r; - regmatch_t m[1]; - char errbuf[64]; - - argv++; - argc--; - - if (!argc) - goto usage; - - if (!strcmp(*argv, "--bug")) { - if (argc == 1) - return test_regex_bug(); - else - goto usage; - } - if (!strcmp(*argv, "--silent")) { - silent = 1; - argv++; - argc--; - } - if (!argc) - goto usage; - - pat = *argv++; - if (argc == 1) - str = NULL; - else { - str = *argv++; - while (*argv) { - struct reg_flag *rf; - for (rf = reg_flags; rf->name; rf++) - if (!strcmp(*argv, rf->name)) { - flags |= rf->flag; - break; - } - if (!rf->name) - die("do not recognize flag %s", *argv); - argv++; - } - } - git_setup_gettext(); - - ret = regcomp(&r, pat, flags); - if (ret) { - if (silent) - return ret; - - regerror(ret, &r, errbuf, sizeof(errbuf)); - die("failed regcomp() for pattern '%s' (%s)", pat, errbuf); - } - if (!str) - return 0; - - ret = regexec(&r, str, 1, m, 0); - if (ret) { - if (silent || ret == REG_NOMATCH) - return ret; - - regerror(ret, &r, errbuf, sizeof(errbuf)); - die("failed regexec() for subject '%s' (%s)", str, errbuf); - } - - return 0; -usage: - usage("\ttest-tool regex --bug\n" - "\ttest-tool regex [--silent] <pattern>\n" - "\ttest-tool regex [--silent] <pattern> <string> [<options>]"); - return -1; -} |