I can do this in GitBash:
$ git diff --name-only v01...HEAD -- *.sql
which gives:
Components/1/Database/Stored Procedures/spDC1.sql
Components/1/Database/Stored Procedures/spDC2.sql
I can't see how I would do this in LibGit2Sharp. Any ideas? Thanks
Here is an example from one of my projects that get a
ICommitLog
collection between two commits (current HEAD vs. the master branch):Once you have your
ICommitLog
collection of all the commits within the range that you need, you can cycle through each commit to get a list of the files that were effected within that commit (of course you would need to add filtering of the filename via your "*.sql" requirements):I think SushiHangover's answer to this is pretty correct. Just a couple of amendments / updates. (P.S. Yeah I know this question's relatively old, but a complete answer would have helped me if I'd found it today, so putting one here for future peeps).
This bit should be an amendment comment, but I can't comment yet (low rep):
First, I think that in Sushi's example, master and head.Tip are the wrong way around. Until excludes a commit from the results and excludes its ancestors. So if you put head.Tip in there it'll exclude basically the entire history tree.
So AFAIK it should read more like this:
It's also SUPER important to realise that the order you give them in matters. If you just switch them around you'll get nothing back.
(Also note that Sushi's original example had a bad ',' after "head.Tip".
This bit's the update:
Also worth noting that the libgit2sharp library has been updated recently. Replacing "Since" and "Until" with "IncludeReachableFrom" and "ExcludeReachableFrom" respectively.
The names aren't particularly helpful until you realise that they're just way more verbose about what they're doing.
The comment for Exclude, for example, reads:
So the latest implementation would look more like:
Tested this out in LINQPad and it seems to work. Might have missed something though as it was a quick draft. If so let me know.
Things to note: master and Head are actually properties of a Repository, I couldn't see that coming from anywhere in the old example but it may just be a version difference with the old version.