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
d387515a
Commit
d387515a
authored
8 years ago
by
Georg Seibt
Browse files
Options
Downloads
Patches
Plain Diff
move checkAncestry method up
parent
fa236ada
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/de/uni_passau/fim/seibt/gitwrapper/repo/Commit.java
+13
-13
13 additions, 13 deletions
src/de/uni_passau/fim/seibt/gitwrapper/repo/Commit.java
with
13 additions
and
13 deletions
src/de/uni_passau/fim/seibt/gitwrapper/repo/Commit.java
+
13
−
13
View file @
d387515a
...
@@ -43,6 +43,19 @@ public class Commit extends Reference {
...
@@ -43,6 +43,19 @@ public class Commit extends Reference {
super
(
repo
,
id
);
super
(
repo
,
id
);
}
}
/**
* Checks if the given {@link Commit} is an ancestor of this commit.
*
* @param ancestor
* the {@link Commit} to check
* @return optionally <code>true</code>, if the given commit is in the history before this commit,
* <code>false</code>, if not and an {@link Optional#EMPTY empty optional}, if an error occurred.
*/
public
Optional
<
Boolean
>
checkAncestry
(
Commit
ancestor
)
{
return
git
.
exec
(
repo
.
getDir
(),
" merge-base"
,
"--is-ancestor"
,
ancestor
.
getId
(),
id
).
map
(
execRes
->
execRes
.
exitCode
==
0
?
Boolean
.
TRUE
:
execRes
.
exitCode
==
1
?
Boolean
.
FALSE
:
null
);
}
/**
/**
* Returns the author of this commit.
* Returns the author of this commit.
*
*
...
@@ -246,17 +259,4 @@ public class Commit extends Reference {
...
@@ -246,17 +259,4 @@ public class Commit extends Reference {
}
}
});
});
}
}
/**
* Checks if the given {@link Commit} is an ancestor of this commit.
*
* @param ancestor
* the {@link Commit} to check
* @return optionally <code>true</code>, if the given commit is in the history before this commit,
* <code>false</code>, if not and an {@link Optional#EMPTY empty optional}, if an error occurred.
*/
public
Optional
<
Boolean
>
checkAncestry
(
Commit
ancestor
)
{
return
git
.
exec
(
repo
.
getDir
(),
" merge-base"
,
"--is-ancestor"
,
ancestor
.
getId
(),
id
).
map
(
execRes
->
execRes
.
exitCode
==
0
?
Boolean
.
TRUE
:
execRes
.
exitCode
==
1
?
Boolean
.
FALSE
:
null
);
}
}
}
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