Skip to content
Snippets Groups Projects
Commit bc0bdc33 authored by Jonas Schrottenbaum's avatar Jonas Schrottenbaum
Browse files

hasFile now returns an optional.

parent 3c28c521
No related branches found
No related tags found
1 merge request!4Add hasFile(Commit) Method
......@@ -133,10 +133,10 @@ public abstract class Reference {
* @param file The file to check the {@link Commit} for existence.
* @return {@code True} if the {@link Commit} contains the file, {@code False} otherwise.
*/
public boolean hasFile(Path file) {
public Optional<Boolean> hasFile(Path file) {
Optional<ProcessExecutor.ExecRes> result = git.exec(repo.getDir(), "cat-file",
"-e", id + ":" + file);
return result.get().succeeded();
return result.map(ProcessExecutor.ExecRes::succeeded);
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment