diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2023-08-10 19:35:00 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-08-10 20:12:31 +0300 |
commit | ac300bda10a137be06b7ac7c41452dbf8864f134 (patch) | |
tree | e4dfb61663faf46a4b0cc9d707287d835913144c /sequencer.c | |
parent | 7481d2bfca7fd36f63fd437508be2bca338c9477 (diff) |
rebase: allow overriding the maximal length of the generated labels
With this change, users can override the compiled-in default for the
maximal length of the label names generated by `git rebase
--rebase-merges`.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Mark Ruvald Pedersen <mped@demant.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sequencer.c b/sequencer.c index c3e23a91f3..5b9b81ea87 100644 --- a/sequencer.c +++ b/sequencer.c @@ -5339,6 +5339,7 @@ struct label_state { struct oidmap commit2label; struct hashmap labels; struct strbuf buf; + int max_label_length; }; static const char *label_oid(struct object_id *oid, const char *label, @@ -5396,7 +5397,7 @@ static const char *label_oid(struct object_id *oid, const char *label, } else { struct strbuf *buf = &state->buf; int label_is_utf8 = 1; /* start with this assumption */ - size_t max_len = buf->len + GIT_MAX_LABEL_LENGTH; + size_t max_len = buf->len + state->max_label_length; /* * Sanitize labels by replacing non-alpha-numeric characters @@ -5494,7 +5495,8 @@ static int make_script_with_merges(struct pretty_print_context *pp, struct string_entry *entry; struct oidset interesting = OIDSET_INIT, child_seen = OIDSET_INIT, shown = OIDSET_INIT; - struct label_state state = { OIDMAP_INIT, { NULL }, STRBUF_INIT }; + struct label_state state = + { OIDMAP_INIT, { NULL }, STRBUF_INIT, GIT_MAX_LABEL_LENGTH }; int abbr = flags & TODO_LIST_ABBREVIATE_CMDS; const char *cmd_pick = abbr ? "p" : "pick", @@ -5502,6 +5504,8 @@ static int make_script_with_merges(struct pretty_print_context *pp, *cmd_reset = abbr ? "t" : "reset", *cmd_merge = abbr ? "m" : "merge"; + git_config_get_int("rebase.maxlabellength", &state.max_label_length); + oidmap_init(&commit2todo, 0); oidmap_init(&state.commit2label, 0); hashmap_init(&state.labels, labels_cmp, NULL, 0); |