diff --git a/devel/git/Makefile b/devel/git/Makefile index 2cc91a945560..00ee79e12d91 100644 --- a/devel/git/Makefile +++ b/devel/git/Makefile @@ -2,7 +2,7 @@ PORTNAME= git DISTVERSION= 2.32.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MASTER_SITES= KERNEL_ORG/software/scm/git DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \ diff --git a/devel/git/files/patch-builtin__checkout--worker.c b/devel/git/files/patch-builtin__checkout--worker.c new file mode 100644 index 000000000000..d96fff9736a4 --- /dev/null +++ b/devel/git/files/patch-builtin__checkout--worker.c @@ -0,0 +1,46 @@ +diff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c +index fb9fd13b73..61ba39402a 100644 +--- builtin/checkout--worker.c ++++ builtin/checkout--worker.c +@@ -9,7 +9,7 @@ static void packet_to_pc_item(const char *buffer, int len, + struct parallel_checkout_item *pc_item) + { + const struct pc_item_fixed_portion *fixed_portion; +- const char *variant; ++ const char *variant, *ident_action; + char *encoding; + + if (len < sizeof(struct pc_item_fixed_portion)) +@@ -19,7 +19,8 @@ static void packet_to_pc_item(const char *buffer, int len, + fixed_portion = (struct pc_item_fixed_portion *)buffer; + + if (len - sizeof(struct pc_item_fixed_portion) != +- fixed_portion->name_len + fixed_portion->working_tree_encoding_len) ++ fixed_portion->name_len + fixed_portion->working_tree_encoding_len + ++ fixed_portion->ident_action_len) + BUG("checkout worker received corrupted item"); + + variant = buffer + sizeof(struct pc_item_fixed_portion); +@@ -43,11 +44,21 @@ static void packet_to_pc_item(const char *buffer, int len, + pc_item->ce->ce_namelen = fixed_portion->name_len; + pc_item->ce->ce_mode = fixed_portion->ce_mode; + memcpy(pc_item->ce->name, variant, pc_item->ce->ce_namelen); ++ variant += pc_item->ce->ce_namelen; + oidcpy(&pc_item->ce->oid, &fixed_portion->oid); + ++ if (fixed_portion->ident_action_len) { ++ ident_action = xmemdupz(variant, ++ fixed_portion->ident_action_len); ++ variant += fixed_portion->ident_action_len; ++ } else { ++ ident_action = NULL; ++ } ++ + pc_item->id = fixed_portion->id; + pc_item->ca.crlf_action = fixed_portion->crlf_action; +- pc_item->ca.ident = fixed_portion->ident; ++ pc_item->ca.ident_action.id = ident_action; ++ pc_item->ca.ident_action.id_len = fixed_portion->ident_action_len; + pc_item->ca.working_tree_encoding = encoding; + } + diff --git a/devel/git/files/patch-convert.c b/devel/git/files/patch-convert.c new file mode 100644 index 000000000000..8040d1090250 --- /dev/null +++ b/devel/git/files/patch-convert.c @@ -0,0 +1,304 @@ +--- convert.c.orig 2021-06-06 05:13:45.000000000 -0700 ++++ convert.c 2021-08-20 11:05:22.792030000 -0700 +@@ -1054,7 +1054,12 @@ + return 0; + } + +-static int count_ident(const char *cp, unsigned long size) ++#define ID_STR "Id" ++ ++#define GIT_MAX_IDENT_LEN 255 ++ ++static int count_ident(const char *cp, unsigned long size, ++ const struct ident_action *idact) + { + /* + * "$Id: 0000000000000000000000000000000000000000 $" <=> "$Id$" +@@ -1067,13 +1072,13 @@ + size--; + if (ch != '$') + continue; +- if (size < 3) ++ if (size < idact->id_len + 1) + break; +- if (memcmp("Id", cp, 2)) ++ if (memcmp(idact->id, cp, idact->id_len)) + continue; +- ch = cp[2]; +- cp += 3; +- size -= 3; ++ ch = cp[idact->id_len]; ++ cp += idact->id_len + 1; ++ size -= idact->id_len + 1; + if (ch == '$') + cnt++; /* $Id$ */ + if (ch != ':') +@@ -1097,11 +1102,11 @@ + } + + static int ident_to_git(const char *src, size_t len, +- struct strbuf *buf, int ident) ++ struct strbuf *buf, const struct ident_action *idact) + { + char *dst, *dollar; + +- if (!ident || (src && !count_ident(src, len))) ++ if (!idact->id || (src && !count_ident(src, len, idact))) + return 0; + + if (!buf) +@@ -1120,17 +1125,18 @@ + len -= dollar + 1 - src; + src = dollar + 1; + +- if (len > 3 && !memcmp(src, "Id:", 3)) { +- dollar = memchr(src + 3, '$', len - 3); ++ if (len > idact->id_len + 1 && !memcmp(src, idact->id, idact->id_len) && src[idact->id_len + 1] == ':') { ++ dollar = memchr(src + idact->id_len + 1, '$', len - (idact->id_len + 1)); + if (!dollar) + break; +- if (memchr(src + 3, '\n', dollar - src - 3)) { ++ if (memchr(src + idact->id_len + 1, '\n', dollar - src - (idact->id_len + 1))) { + /* Line break before the next dollar. */ + continue; + } + +- memcpy(dst, "Id$", 3); +- dst += 3; ++ memcpy(dst, idact->id, idact->id_len); ++ dst[idact->id_len] = '$'; ++ dst += idact->id_len + 1; + len -= dollar + 1 - src; + src = dollar + 1; + } +@@ -1141,16 +1147,16 @@ + } + + static int ident_to_worktree(const char *src, size_t len, +- struct strbuf *buf, int ident) ++ struct strbuf *buf, const struct ident_action *idact) + { + struct object_id oid; + char *to_free = NULL, *dollar, *spc; + int cnt; + +- if (!ident) ++ if (!idact->id) + return 0; + +- cnt = count_ident(src, len); ++ cnt = count_ident(src, len, idact); + if (!cnt) + return 0; + +@@ -1159,7 +1165,7 @@ + to_free = strbuf_detach(buf, NULL); + hash_object_file(the_hash_algo, src, len, "blob", &oid); + +- strbuf_grow(buf, len + cnt * (the_hash_algo->hexsz + 3)); ++ strbuf_grow(buf, len + cnt * (the_hash_algo->hexsz + idact->id_len + 1)); + for (;;) { + /* step 1: run to the next '$' */ + dollar = memchr(src, '$', len); +@@ -1170,14 +1176,14 @@ + src = dollar + 1; + + /* step 2: does it looks like a bit like Id:xxx$ or Id$ ? */ +- if (len < 3 || memcmp("Id", src, 2)) ++ if (len < idact->id_len + 1 || memcmp(idact->id, src, idact->id_len)) + continue; + + /* step 3: skip over Id$ or Id:xxxxx$ */ +- if (src[2] == '$') { +- src += 3; +- len -= 3; +- } else if (src[2] == ':') { ++ if (src[idact->id_len] == '$') { ++ src += idact->id_len + 1; ++ len -= idact->id_len + 1; ++ } else if (src[idact->id_len] == ':') { + /* + * It's possible that an expanded Id has crept its way into the + * repository, we cope with that by stripping the expansion out. +@@ -1185,18 +1191,18 @@ + * on checkout, which won't go away by stash, but let's keep it + * for git-style ids. + */ +- dollar = memchr(src + 3, '$', len - 3); ++ dollar = memchr(src + idact->id_len + 1, '$', len - (idact->id_len + 1)); + if (!dollar) { + /* incomplete keyword, no more '$', so just quit the loop */ + break; + } + +- if (memchr(src + 3, '\n', dollar - src - 3)) { ++ if (memchr(src + idact->id_len + 1, '\n', dollar - src - (idact->id_len + 1))) { + /* Line break before the next dollar. */ + continue; + } + +- spc = memchr(src + 4, ' ', dollar - src - 4); ++ spc = memchr(src + idact->id_len + 2, ' ', dollar - src - (idact->id_len + 2)); + if (spc && spc < dollar-1) { + /* There are spaces in unexpected places. + * This is probably an id from some other +@@ -1213,7 +1219,8 @@ + } + + /* step 4: substitute */ +- strbuf_addstr(buf, "Id: "); ++ strbuf_addstr(buf, idact->id); ++ strbuf_addstr(buf, ": "); + strbuf_addstr(buf, oid_to_hex(&oid)); + strbuf_addstr(buf, " $"); + } +@@ -1284,11 +1291,21 @@ + return NULL; + } + +-static int git_path_check_ident(struct attr_check_item *check) ++static struct ident_action git_path_check_ident(struct attr_check_item *check) + { ++ struct ident_action idact = {.id = NULL, .id_len = 0}; + const char *value = check->value; + +- return !!ATTR_TRUE(value); ++ if (!ATTR_UNSET(value) && !ATTR_FALSE(value)) { ++ if (ATTR_TRUE(value)) ++ idact.id = ID_STR; ++ else ++ idact.id = value; ++ idact.id_len = strlen(idact.id); ++ if (idact.id_len > GIT_MAX_IDENT_LEN) ++ die(_("ident value length exceeds GIT_MAX_IDENT_LEN")); ++ } ++ return idact; + } + + static struct attr_check *check; +@@ -1311,7 +1328,7 @@ + ca->crlf_action = git_path_check_crlf(ccheck + 4); + if (ca->crlf_action == CRLF_UNDEFINED) + ca->crlf_action = git_path_check_crlf(ccheck + 0); +- ca->ident = git_path_check_ident(ccheck + 1); ++ ca->ident_action = git_path_check_ident(ccheck + 1); + ca->drv = git_path_check_convert(ccheck + 2); + if (ca->crlf_action != CRLF_BINARY) { + enum eol eol_attr = git_path_check_eol(ccheck + 3); +@@ -1431,7 +1448,7 @@ + len = dst->len; + } + } +- return ret | ident_to_git(src, len, dst, ca.ident); ++ return ret | ident_to_git(src, len, dst, &ca.ident_action); + } + + void convert_to_git_filter_fd(struct index_state *istate, +@@ -1448,7 +1465,7 @@ + + encode_to_git(path, dst->buf, dst->len, dst, ca.working_tree_encoding, conv_flags); + crlf_to_git(istate, path, dst->buf, dst->len, dst, ca.crlf_action, conv_flags); +- ident_to_git(dst->buf, dst->len, dst, ca.ident); ++ ident_to_git(dst->buf, dst->len, dst, &ca.ident_action); + } + + static int convert_to_working_tree_ca_internal(const struct conv_attrs *ca, +@@ -1460,7 +1477,7 @@ + { + int ret = 0, ret_filter = 0; + +- ret |= ident_to_worktree(src, len, dst, ca->ident); ++ ret |= ident_to_worktree(src, len, dst, &(ca->ident_action)); + if (ret) { + src = dst->buf; + len = dst->len; +@@ -1808,7 +1825,8 @@ + struct stream_filter filter; + struct strbuf left; + int state; +- char ident[GIT_MAX_HEXSZ + 5]; /* ": x40 $" */ ++ const struct ident_action *idact; ++ char ident[GIT_MAX_HEXSZ + GIT_MAX_IDENT_LEN + 3]; /* ": x40 $" */ + }; + + static int is_foreign_ident(const char *str) +@@ -1845,13 +1863,16 @@ + char *output, size_t *osize_p) + { + struct ident_filter *ident = (struct ident_filter *)filter; +- static const char head[] = "$Id"; ++ const struct ident_action *idact = ident->idact; + + if (!input) { + /* drain upon eof */ + switch (ident->state) { + default: +- strbuf_add(&ident->left, head, ident->state); ++ if (ident->state > 0) ++ strbuf_addch(&ident->left, '$'); ++ if (ident->state > 1) ++ strbuf_add(&ident->left, idact->id, ident->state - 1); + /* fallthrough */ + case IDENT_SKIPPING: + /* fallthrough */ +@@ -1883,22 +1904,26 @@ + if (ch != '\n' && ch != '$') + continue; + if (ch == '$' && !is_foreign_ident(ident->left.buf)) { +- strbuf_setlen(&ident->left, sizeof(head) - 1); ++ strbuf_setlen(&ident->left, idact->id_len + 1); + strbuf_addstr(&ident->left, ident->ident); + } + ident->state = IDENT_DRAINING; + continue; + } + +- if (ident->state < sizeof(head) && +- head[ident->state] == ch) { ++ if ((ident->state == 0 && ch == '$') || ++ (ident->state > 0 && ident->state < idact->id_len + 1 && ++ idact->id[ident->state - 1] == ch)) { + ident->state++; + continue; + } + +- if (ident->state) +- strbuf_add(&ident->left, head, ident->state); +- if (ident->state == sizeof(head) - 1) { ++ if (ident->state) { ++ strbuf_addch(&ident->left, '$'); ++ if (ident->state > 1) ++ strbuf_add(&ident->left, idact->id, ident->state - 1); ++ } ++ if (ident->state == idact->id_len + 1) { + if (ch != ':' && ch != '$') { + strbuf_addch(&ident->left, ch); + ident->state = 0; +@@ -1933,7 +1958,7 @@ + ident_free_fn, + }; + +-static struct stream_filter *ident_filter(const struct object_id *oid) ++static struct stream_filter *ident_filter(const struct object_id *oid, const struct ident_action *idact) + { + struct ident_filter *ident = xmalloc(sizeof(*ident)); + +@@ -1942,6 +1967,7 @@ + strbuf_init(&ident->left, 0); + ident->filter.vtbl = &ident_vtbl; + ident->state = 0; ++ ident->idact = idact; + return (struct stream_filter *)ident; + } + +@@ -1961,8 +1987,8 @@ + if (classify_conv_attrs(ca) != CA_CLASS_STREAMABLE) + return NULL; + +- if (ca->ident) +- filter = ident_filter(oid); ++ if (ca->ident_action.id) ++ filter = ident_filter(oid, &(ca->ident_action)); + + if (output_eol(ca->crlf_action) == EOL_CRLF) + filter = cascade_filter(filter, lf_to_crlf_filter()); diff --git a/devel/git/files/patch-convert.h b/devel/git/files/patch-convert.h new file mode 100644 index 000000000000..fef1bd40105f --- /dev/null +++ b/devel/git/files/patch-convert.h @@ -0,0 +1,20 @@ +--- convert.h 2021/08/20 18:01:30 1.1 ++++ convert.h 2021/08/20 18:03:07 +@@ -76,11 +76,16 @@ + + struct convert_driver; + ++struct ident_action { ++ const char *id; ++ int id_len; ++}; ++ + struct conv_attrs { + struct convert_driver *drv; + enum convert_crlf_action attr_action; /* What attr says */ + enum convert_crlf_action crlf_action; /* When no attr is set, use core.autocrlf */ +- int ident; ++ struct ident_action ident_action; /* What ident says */ + const char *working_tree_encoding; /* Supported encoding or default encoding if NULL */ + }; + diff --git a/devel/git/files/patch-parallel-checkout.c b/devel/git/files/patch-parallel-checkout.c new file mode 100644 index 000000000000..4a6826dc7bbe --- /dev/null +++ b/devel/git/files/patch-parallel-checkout.c @@ -0,0 +1,40 @@ +--- parallel-checkout.c.orig 2021-06-06 05:13:45.000000000 -0700 ++++ parallel-checkout.c 2021-08-21 15:01:06.622636000 -0700 +@@ -403,13 +403,15 @@ + size_t name_len = pc_item->ce->ce_namelen; + size_t working_tree_encoding_len = working_tree_encoding ? + strlen(working_tree_encoding) : 0; ++ const char *ident_action_id = pc_item->ca.ident_action.id; ++ size_t ident_action_len = pc_item->ca.ident_action.id_len; + + /* + * Any changes in the calculation of the message size must also be made + * in is_eligible_for_parallel_checkout(). + */ + len_data = sizeof(struct pc_item_fixed_portion) + name_len + +- working_tree_encoding_len; ++ working_tree_encoding_len + ident_action_len; + + data = xcalloc(1, len_data); + +@@ -417,7 +419,7 @@ + fixed_portion->id = pc_item->id; + fixed_portion->ce_mode = pc_item->ce->ce_mode; + fixed_portion->crlf_action = pc_item->ca.crlf_action; +- fixed_portion->ident = pc_item->ca.ident; ++ fixed_portion->ident_action_len = ident_action_len; + fixed_portion->name_len = name_len; + fixed_portion->working_tree_encoding_len = working_tree_encoding_len; + /* +@@ -435,6 +437,11 @@ + variant += working_tree_encoding_len; + } + memcpy(variant, pc_item->ce->name, name_len); ++ variant += name_len; ++ if (ident_action_len) { ++ memcpy(variant, ident_action_id, ident_action_len); ++ variant += ident_action_len; ++ } + + packet_write(fd, data, len_data); + diff --git a/devel/git/files/patch-parallel-checkout.h b/devel/git/files/patch-parallel-checkout.h new file mode 100644 index 000000000000..b5821473ba52 --- /dev/null +++ b/devel/git/files/patch-parallel-checkout.h @@ -0,0 +1,24 @@ +--- parallel-checkout.h 2021/08/20 18:16:10 1.1 ++++ parallel-checkout.h 2021/08/20 18:21:18 +@@ -76,9 +76,9 @@ + + /* + * The fixed-size portion of `struct parallel_checkout_item` that is sent to the +- * workers. Following this will be 2 strings: ca.working_tree_encoding and +- * ce.name; These are NOT null terminated, since we have the size in the fixed +- * portion. ++ * workers. Following this will be 3 strings: ca.working_tree_encoding, ca.name ++ * and ca.ident_action.id; These are NOT null terminated, since we have the size ++ * in the fixed portion. + * + * Note that not all fields of conv_attrs and cache_entry are passed, only the + * ones that will be required by the workers to smudge and write the entry. +@@ -88,7 +88,7 @@ + struct object_id oid; + unsigned int ce_mode; + enum convert_crlf_action crlf_action; +- int ident; ++ size_t ident_action_len; + size_t working_tree_encoding_len; + size_t name_len; + };