Background:
I want to retrieve a file from a specific revision in Git. Previously I used the git show
command using the method described in this thread: How to retrieve a single file from specific revision in Git? meaning:
git show HEAD2:file.txt
However, based on the problem explained in my other post: Read both binary and text from process output I couldn't read binary data from git show
's output. Following the suggestion of SO users, I moved to JGit as a native implementation of Java. I found this thread on SO which describes how to retireve a file from a specific revision using JGit API. How to "cat" a file in JGit?
Question:
Performance is very much crucial for my project. Thus, I'm looking for the best way to retrieve the file. The API method described above seems to navigate through tree and get the right revision. Considering I could use a single command in Git to retrieve the file, I'm not sure which one is faster.
- Should I use the method described for JGit or should I go with the
git show
command? - Is there a better solution for JGit?