git-fat icon indicating copy to clipboard operation
git-fat copied to clipboard

Print filenames for objects in `status` output with '--filenames' option

Open jmurty opened this issue 10 years ago • 2 comments

The '--filenames' option makes it easy to view the filename represented by a git-fat object reference, at the cost of a slight performance and memory hit compared to the plain git-fat status command.

This option is most helpful when you are thinking about running git-fat gc to clean up some garbage/unreferenced objects, so you can check what you are about to delete.

  • Add referenced_objects_with_filenames() method that (optionally) stores file name data while looking up git-fat referenced objects.
  • Refactor referenced_objects() method to use the above method while providing existing interface.
  • If '--filenames' option is given to the status command, print filename(s) next to git-fat object hash values.

jmurty avatar Jun 26 '14 22:06 jmurty

Hey @jmurty, I did something similar to this in our fork with git fat list.

Your solution of storing hash->filename strings in a dict is the one I tried first too, but you quickly run out of memory for medium to large sized repositories. The way we implemented it is running through rev-list twice which isn't ideal, but better than nothing at all.

abraithwaite avatar Jun 27 '14 16:06 abraithwaite

Thanks for the feedback @abraithwaite.

I have just added a small improvement to the proposed feature to clear out uninteresting filenames during processing, which should massively reduce the memory consumption. Or at least use no more memory than is really necessary to store all the filenames of interest.

Are you able to test this improvement against a medium- or large-size repository to see if it survives?

jmurty avatar Jun 29 '14 14:06 jmurty