mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-18 13:32:10 +01:00
cleanup and update tests
This commit is contained in:
@@ -392,27 +392,39 @@ public final class GitUtil
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param repository
|
||||
* @param ref
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @since 2.5.0
|
||||
*/
|
||||
public static Long getTagTime(org.eclipse.jgit.lib.Repository repository, Ref ref) throws IOException {
|
||||
try (RevWalk walk = new RevWalk(repository)) {
|
||||
return GitUtil.getTagTime(repository, walk, ref);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
* @param repository
|
||||
* @param revWalk
|
||||
* @param ref
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
*
|
||||
* @since 2.5.0
|
||||
*/
|
||||
public static Long getTagTime(org.eclipse.jgit.lib.Repository repository,
|
||||
RevWalk revWalk, Ref ref)
|
||||
throws IOException
|
||||
{
|
||||
RevWalk revWalk, Ref ref)
|
||||
throws IOException {
|
||||
if (ref == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ObjectId id = ref.getObjectId();
|
||||
|
||||
if (id != null)
|
||||
{
|
||||
if (revWalk == null)
|
||||
{
|
||||
if (id != null) {
|
||||
if (revWalk == null) {
|
||||
revWalk = new RevWalk(repository);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ public class GitHookTagProvider implements HookTagProvider {
|
||||
LOG.debug("received ref name {} is not a tag", refName);
|
||||
} else {
|
||||
Long tagTime = null;
|
||||
try (RevWalk walk = new RevWalk(repository)) {
|
||||
tagTime = GitUtil.getTagTime(repository, walk, rc.getRef());
|
||||
try {
|
||||
tagTime = GitUtil.getTagTime(repository, rc.getRef());
|
||||
} catch (IOException e) {
|
||||
LOG.error("Could not read tag time", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user