Reputation: 83421
I want to retrieve a list of paths, permissions, and content hashes for files for revision in a set of paths, excluding some paths.
git ls-tree
seems perfect. For example, in the Git repo,
$ git ls-tree -r v2.2.2 -- Documentation ':!Documentation/RelNotes'
100644 blob ddb030137d54ef3fb0ee01d973ec5cee4bb2b2b3 Documentation/.gitattributes
100644 blob 2c8b2d612ee0d6c1f687bfa062bb7fe6471d9280 Documentation/.gitignore
100644 blob 894546dd75416fcf09542096a67b2f22a7d0de7a Documentation/CodingGuidelines
100644 blob 2f6b6aabd74a24abdb3ac189118095fcee19f8d2 Documentation/Makefile
100644 blob fa71b5f0b62f43483d02c24d809e6282fa49576a Documentation/SubmittingPatches
100644 blob 2c16c536ba830ec12bbf335d09f689d23e325197 Documentation/asciidoc.conf
100644 blob 0cebc4f6927211ffbc013de9368f03f480dba65d Documentation/blame-options.txt
100755 blob ba4205e0302a267a5da6bef504f3e69eb0c4aa6d Documentation/build-docdep.perl
100755 blob 87437f8a95768595e040b8c4c1d48e5c29ada087 Documentation/cat-texi.perl
But this was removed in 2.3.0, with the message
ls-tree: disable negative pathspec because it's not supported
Well that's circular ;)
What is the new, "correct" way to do this in git 2.3.0 and later?
Upvotes: 2
Views: 235
Reputation: 295954
Piping through
awk '$4 !~ /Documentation\/RelNotes/ { print }'
...is the obvious approach. To make this a bit more generic:
s='Documentation/RelNotes'
awk -v exclusion_re="$s" '$4 !~ exclusion_re { print }
Upvotes: 1