I am writing a small test suite that runs a testing tool through a bunch of input files. For each input file, the tool is created by the corresponding output file (both are in XML). Input and output files are checked on the Git repository.
The output files bear the time that the tool was compiled, so the output files were undoubtedly modified after they were recreated by the tool under test.
To quickly see if the result has changed (when I changed the sources of the tool), I would like to check if the contents of the node OutputFingerprint (a simple hash over the contents of the corresponding parts of the output file).
Reading the manual for git-diff , I found that the -G option exists:
-G <regular expression>
Find the differences whose added or deleted row matches the given <regex>.
Unfortunately, they do not contain examples of using the -G option.
My first thought was to just write
git diff -GOutputFingerprint
but this is wrong:
> git diff -GOutputFingerprint error: invalid option: -GOutputFingerprint
The next thought was to put the regular expression in slashes, which also failed:
> git diff -G/OutputFingerprint/ error: invalid option: -GC:/Program Files/Git/OutputFingerprint/
In addition, simply placing a space between -G and OutputFingerprint does not work:
> git diff -G OutputFingerprint fatal: ambiguous argument 'OutputFingerprint': unknown revision or path not in the working tree. Use '--' to separate paths from revisions
When I call git diff without any parameters, I get a modification:
- <OutputFingerprint>e45807ca76fc5bb78e9e928c6fb7eed6</OutputFingerprint> + <OutputFingerprint>d0846851bc9d52b37f7919def78660a2</OutputFingerprint>
Another thought was to use git diff -S".*OutputFingerprint.*" --pickaxe-regex , but that also failed.
git --version gives me git version 1.7.3.1.msysgit.0 , if that matters.
When I ask git diff --help , the provided manual shows me the -G option.
So, can someone provide me an example of how to use git diff -G correctly?