2

I have a binary file that can be deserialized into a text representation along with some supporting image files.

Can I use smudge and clean to do this conversion from 1 file to many, and then back again?

Eg:

The binary file:

  • Demo.bin

Would deserialize to:

  • Demo.txt (important to be able to do diffs on this file)
  • Demo.Picture1.bmp
  • Demo.Picture2.gif
ThunderFrame
  • 9,352
  • 2
  • 29
  • 60
  • If you are only interested in diffing, you could write a script that extracts the txt portion out, and use a gitattributes file similar to [this](https://stackoverflow.com/a/17106035/1615903). – 1615903 Sep 12 '17 at 04:16
  • @1615903 lol - that's the exact answer that my original Googling found. – ThunderFrame Sep 12 '17 at 05:25

1 Answers1

2

The short answer is "no". The longer answer is more complicated: sure, you can write such files into the work-tree all you want. You cannot make them wind up in the index, though, so by definition they will be untracked files. You could try to overwrite existing index files but that would be fraught with peril.

(Both the old style filter-driver and the new-style filter-as-process are expected / assumed (by Git) to work on one specified path at a time. Using the process method, you could perhaps delay touching the index until your filter is terminated, which will be just before Git assumes it is done with whatever it is doing—whether that requires smudging or cleaning.)

torek
  • 448,244
  • 59
  • 642
  • 775