How does git transparently handle tar archives as directories?

I would like git to version a tar so that for a repository-related functions such as git-diff (and even complex git-merge conflict resolution), the file looks like a directory with included files that are regularly sent to git, except that when checking, you should again get a valid tar archive. Is this somehow achievable?

At first I thought about using smudge / clean filters , but they just let you change the contents of a saved git blob file.

So now I'm thinking about using hooks ( pre-commit and post-checkout , as suggested here , although I would like to have a pre-add filter ...), which would either simply convert between the file and the tar directory structure, or, to properly maintain metadata, directly using git objects (or, as a compromise, use an intermediate directory, but override metadata ). But before I start with this potentially insane job, are there

  • the best way to achieve this, or
  • an existing solution?



This has a lot to do with. Can git treat zip files as directories and files inside zip as blobs? , although I hope that due to tar files, which are just concatenation of files and metadata without compression, treating them might be easier.

+2
git tar archive
May 3 '16 at 9:47 a.m.
source share
1 answer

I would advise what was mentioned in one of the comments, namely to use textconv .

Instead of using it manually with cat you can just call the --textconv for git diff .

For merging, you can use the renormalize option or configure this by default with merge.renormalize .

I have never tested this, but I think it will work.

0
May 04 '16 at 18:26
source share



All Articles