Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GitWrapper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Georg Seibt
GitWrapper
Commits
e3d5ec6d
Commit
e3d5ec6d
authored
6 years ago
by
Georg Seibt
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into 'master'
Add hasFile(Commit) Method See merge request
!4
parents
202b5b5d
1a9aa119
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!4
Add hasFile(Commit) Method
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/de/uni_passau/fim/gitwrapper/Reference.java
+13
-0
13 additions, 0 deletions
src/de/uni_passau/fim/gitwrapper/Reference.java
with
13 additions
and
0 deletions
src/de/uni_passau/fim/gitwrapper/Reference.java
+
13
−
0
View file @
e3d5ec6d
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
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment