Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
328 views
in Technique[技术] by (71.8m points)

git repack: segregating by file type & configuring packs by group?

Is there a way to tell Git to create packfiles based on file types, and to specify the delta-ification and zlib compression for those classes / types?

I have a rather large repository, much of which is composed of image assets and translation files (.po), the latter actually being the largest fraction of the working copy and the repository data.

  • For the image assets, neither delta nor zlib compression are useful: the images are already compress (so they don't compress well under zlib) and delta compression does nothing useful when small changes tend to cascade through the compressed image (and are rare anyway, usually once the asset is committed it's either left alone forever or replaced wholesale).
  • For the PO files, while they're technically text files I would expect them to delta-compress very badly for this specific repository: the historical generator / exporter would export the translations in essentially random order so from one export to the next it's as if the entire file has been rewritten.

As a result, when the repository is repacked I'd like to try packing the images together neither delta-compress nor zlib-compress them, and the PO files together and zlib-compress them (at the maximum possible level) but not delta-compress them. This way they ought not waste cycles on useless compression work, and should avoid polluting the compression of more "normal" code files.

However my previous experiments in packfiles did not go well. Is there builtin support for this sort of segregation & configuration which I missed, or would I need to build the packs by hand using low-level commands or even libgit2 directly?

question from:https://stackoverflow.com/questions/65881273/git-repack-segregating-by-file-type-configuring-packs-by-group

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Alas, no: the controls available are only the following:

  • core.bigFileThreshold: files that exceed this size are not packed, merely zlib-compressed.

  • pack.island and several related settings: these set up so-called delta islands, as described in the git pack-objects documentation.

These do not come anywhere close to what you want. (Note: there is also core.compression and two related items, but these are strictly global, not per-object.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...