diff options
author | Mark Ruvald Pedersen <mped@demant.com> | 2023-08-10 18:34:59 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-08-10 19:12:29 +0200 |
commit | 7481d2bfca7fd36f63fd437508be2bca338c9477 (patch) | |
tree | 673f3341b56bd8f1ed432ef5bd626c2425f096ea /git-compat-util.h | |
parent | Merge branch 'jk/redact-h2h3-headers-fix' into maint-2.41 (diff) | |
download | git-7481d2bfca7fd36f63fd437508be2bca338c9477.tar.xz git-7481d2bfca7fd36f63fd437508be2bca338c9477.zip |
sequencer: truncate labels to accommodate loose refs
Some commits may have unusually long subject lines. When those subject
lines are used as labels in the `--rebase-merges` mode of `git rebase`,
they can cause errors when writing the corresponding loose refs because
most file systems have a maximal file name length of 255 (`NAME_MAX`).
The symptom looks like this:
$ git rebase --continue
error: cannot lock ref 'refs/rewritten/SANITIZED-SUBJECT': Unable to create '.git/refs/rewritten/SANITIZED-SUBJECT.lock': File name too long - where SANITIZED-SUBJECT is very long
Let's accommodate this situation by truncating the labels.
Care must be taken in case the subject line contains multi-byte
characters so as not to truncate in the middle of a character.
Signed-off-by: Mark Ruvald Pedersen <mped@demant.com>
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r-- | git-compat-util.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index 5b2b99c17c..e1f7e15d9e 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -422,6 +422,10 @@ char *gitdirname(char *); #define PATH_MAX 4096 #endif +#ifndef NAME_MAX +#define NAME_MAX 255 +#endif + typedef uintmax_t timestamp_t; #define PRItime PRIuMAX #define parse_timestamp strtoumax |