Skip to content
Snippets Groups Projects

Changes necessary for JDime wrapper script

Merged Florian Heck requested to merge heckflor/GitWrapper:master into master
1 file
+ 13
0
Compare changes
  • Side-by-side
  • Inline
@@ -2,6 +2,7 @@ package de.uni_passau.fim.gitwrapper;
import de.uni_passau.fim.processexecutor.ProcessExecutor;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
@@ -126,6 +127,18 @@ public abstract class Reference {
return revList.map(toParentsList);
}
/**
* Checks whether this {@link Reference} contains the specified file.
*
* @param file
* the (repository relative) path to the file to look for in this {@link Reference}
* @return {@code true} iff this {@link Reference} contains the file
*/
public Optional<Boolean> hasFile(Path file) {
Optional<ProcessExecutor.ExecRes> result = git.exec(repo.getDir(), "cat-file", "-e", id + ":" + file);
return result.map(ProcessExecutor.ExecRes::succeeded);
}
@Override
public final boolean equals(Object o) {
if (this == o) {
Loading