This adds a command line option "-git-rev=<commit[..commit]>". When it is
used, only one filename is accepted. The file in its version in the specified
revision is compared against the current version (or the one in the second
revision if given). Note that this calls git checkout in the current
directory.
Details
- Reviewers
arphaman
Diff Detail
- Build Status
Buildable 9275 Build 9275: arc lint + arc unit
Event Timeline
It might be useful to have both source and destination in a different revision. Maybe something like -src-git-rev and -dst-git-rev?
Then I'd rather have a revision range such as -git-revs <commit>..<commit>
and if there is only one specified, then <commit>..HEAD is implied
maybe a different name for the argument
The whole thing is a bit of a hack - if the HEAD is dirty then the checkout fails and the program exits.
I want to change it so it does not interfere with the state of the repository. I can checkout the revisions in a temporary repository and then patch the paths in the compilation database.
That would be nice. Temporary checkouts are a way to solve the problem. But they might not work for all projects, like when some translation unit includes a file that's not in git using a relative path.
Another solution is to use virtual file systems. A custom vfs could load the files that are in a particular git revision. Then, an overlay fs can be used to combine both the git vfs and the real fs. That overlay should be somehow passed into the AST producer. I don't think it's worth doing this right now because of time constraints, so temporary checkouts is probably the better solution for the time being.