Re: [PATCH v3 5/5] submodule: error out if gitdir name is too long
- From
Adrian Ratiu <adrian.ratiu@collabora.com>
- Date
- Oct 21, 2025, 13:13 UTC
- Message-ID
- <871pmwqtxb.fsf@collabora.com>
- In-Reply-To
- <aPc-79_XLyTjA_w0@pks.im>
On Tue, 21 Oct 2025, Patrick Steinhardt <ps@pks.im> wrote:
Show 9 quoted lines
> On Mon, Oct 06, 2025 at 02:25:18PM +0300, Adrian Ratiu wrote: >> diff --git a/compat/posix.h b/compat/posix.h index >> 067a00f33b..aa050fd58c 100644 --- a/compat/posix.h +++ >> b/compat/posix.h @@ -250,6 +250,14 @@ char *gitdirname(char *); >> #define NAME_MAX 255 #endif >> +#ifdef NO_PATHCONF +#ifndef _PC_NAME_MAX +#define _PC_NAME_MAX >> 1 /* dummy value, only used for git_pathconf */ > > Are there platforms that have pathconf(3) but not _PC_NAME_MAX?
AFAIK no, because they're both part of POSIX and in all known implementations they are both defined.
Show 15 quoted lines
> >> +#endif +#define pathconf(a,b) git_pathconf(a,b) +long >> git_pathconf(const char *path, int name); +#endif + >> typedef uintmax_t timestamp_t; #define PRItime PRIuMAX #define >> parse_timestamp strtoumax > > Let's adapt this to our coding guidelines to make this easier to > parse: > > - Nested C preprocessor directives are indented after the hash > by one > space per nesting level. > > #if FOO # include <foo.h> # if BAR # include <bar.h> # > endif #endif
Thanks, however I'm inclining towards dropping this commit in v4 as Junio and Peff suggested, since it doesn't add anything other than the nice error message, so we can let each OS fail with its own message like they did before this patch.
We could bring it back when/if we decide to implement sharding / trimming, i.e. to address the TODO in the patch, that way it's more useful.