Re: [PATCH v6 04/20] reftable: utility functions
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Apr 13, 2021, 13:14 UTC
- Message-ID
- <87r1je2up2.fsf@evledraar.gmail.com>
- In-Reply-To
- <df8003cb9a7d9e017d358251a2d22c0e72454e03.1618255552.git.gitgitgadget@gmail.com>
On Mon, Apr 12 2021, Han-Wen Nienhuys via GitGitGadget wrote:
Show 36 quoted lines
> diff --git a/reftable/system.h b/reftable/system.h > new file mode 100644 > index 000000000000..07277ca06273 > --- /dev/null > +++ b/reftable/system.h > @@ -0,0 +1,32 @@ > +/* > +Copyright 2020 Google LLC > + > +Use of this source code is governed by a BSD-style > +license that can be found in the LICENSE file or at > +https://developers.google.com/open-source/licenses/bsd > +*/ > + > +#ifndef SYSTEM_H > +#define SYSTEM_H > + > +#include "git-compat-util.h" > +#include "strbuf.h" > + > +#include <zlib.h> > + > +struct strbuf; > +/* In git, this is declared in dir.h */ > +int remove_dir_recursively(struct strbuf *path, int flags); > + > +#define SHA1_ID 0x73686131 > +#define SHA256_ID 0x73323536 > +#define SHA1_SIZE 20 > +#define SHA256_SIZE 32 > + > +/* This is uncompress2, which is only available in zlib as of 2017. > + */ > +int uncompress_return_consumed(Bytef *dest, uLongf *destLen, > + const Bytef *source, uLong *sourceLen); > +int hash_size(uint32_t id);
Related to the comment in http://lore.kernel.org/git/87a6q2egvy.fsf@evledraar.gmail.com
I'd think that rather than duplicating magic constants & one thing in dir.h we'd be better off having some leading patches splitting off the relevant parts of object-file.c & dir.h, maybe THAT_NAME_minimal.h?
Or: why not simply include dir.h and object.h etc? The compiler/linker will discard the unused functions, and if the worry is overuse of git.git functions creeping in I'd think that would be better done via some test/CI job that checks what objects were used.