mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-06 13:35:44 +01:00
fix bug with git repositories without head
This commit is contained in:
@@ -35,6 +35,7 @@ package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.eclipse.jgit.diff.DiffFormatter;
|
||||
import org.eclipse.jgit.lib.Constants;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.Ref;
|
||||
@@ -55,7 +56,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.Map;
|
||||
import org.eclipse.jgit.diff.DiffFormatter;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -94,12 +94,6 @@ public class GitUtil
|
||||
repo.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static void release(DiffFormatter formatter){
|
||||
if ( formatter != null ){
|
||||
formatter.release();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
@@ -118,6 +112,20 @@ public class GitUtil
|
||||
FS.DETECTED), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param formatter
|
||||
*/
|
||||
public static void release(DiffFormatter formatter)
|
||||
{
|
||||
if (formatter != null)
|
||||
{
|
||||
formatter.release();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -233,7 +241,7 @@ public class GitUtil
|
||||
}
|
||||
else
|
||||
{
|
||||
revId = repo.resolve(Constants.HEAD);
|
||||
revId = getRepositoryHead(repo);
|
||||
}
|
||||
|
||||
return revId;
|
||||
|
||||
Reference in New Issue
Block a user