]> source.dussan.org Git - jgit.git/commit
DirCacheCheckout#getContent: also take InputStream supplier 46/195446/7
authorHan-Wen Nienhuys <hanwen@google.com>
Tue, 30 Aug 2022 08:07:21 +0000 (10:07 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Tue, 6 Sep 2022 12:38:41 +0000 (14:38 +0200)
commit6d2bcb6043c1f32dc7fd7029a29d671babf271cf
treefedbe3ac5b51b45ba5c015ccc9f4ab20ec660443
parent2778bb2cc9bf7bdfb2ed7b3a99dd931d6d3fbbfa
DirCacheCheckout#getContent: also take InputStream supplier

This lets us use DirCacheCheckout for routines that want to write
files in the worktree that aren't available as a git object.

DirCacheCheckout#getContent takes a InputStream supplier rather than
InputStream: if filtering fails with IOException, the data is placed
unfiltered in the checkout. This means that the stream has to be read
again, from the start.

Use it in this way in ApplyCommand. This use is incorrect, though: the
same InputStream is returned twice, so if the read to be retried, the
stream will return 0 bytes. It doesn't really matter, because in
either case, the SHA1 will not match up, and the patch fails.

Change-Id: I2efa9a6da06806ff79b155032fe4b34be8fec09e
org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java