Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • seibt/GitWrapper
1 result
Select Git revision
Show changes
Commits on Source (5)
package de.uni_passau.fim.gitwrapper; package de.uni_passau.fim.gitwrapper;
import java.nio.file.Path;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -126,6 +127,18 @@ public abstract class Reference { ...@@ -126,6 +127,18 @@ public abstract class Reference {
return revList.map(toParentsList); 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 @Override
public final boolean equals(Object o) { public final boolean equals(Object o) {
if (this == o) { if (this == o) {
......