Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Ruvald Pedersen <mped@demant.com>2023-08-10 19:34:59 +0300
committerJunio C Hamano <gitster@pobox.com>2023-08-10 20:12:29 +0300
commit7481d2bfca7fd36f63fd437508be2bca338c9477 (patch)
tree673f3341b56bd8f1ed432ef5bd626c2425f096ea /git-compat-util.h
parentfb7d80edcae482f4fa5d4be0227dc3054734e5f3 (diff)
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.h4
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