Skip to content
Snippets Groups Projects
Commit e3d5ec6d authored by Georg Seibt's avatar Georg Seibt :nerd:
Browse files

Merge branch 'master' into 'master'

Add hasFile(Commit) Method

See merge request !4
parents 202b5b5d 1a9aa119
No related branches found
No related tags found
1 merge request!4Add hasFile(Commit) Method
package de.uni_passau.fim.gitwrapper;
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) {
......
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