summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/utils/RefLogUtils.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-03-03 20:37:54 -0600
committerJames Moger <james.moger@gitblit.com>2014-03-03 20:37:54 -0600
commitacaa2a2765c4864ef001ae1097285c4f5cf2987d (patch)
tree98b4f516d59833b5a8c1ccbcd45672e5b9f3add2 /src/main/java/com/gitblit/utils/RefLogUtils.java
parent94e12c168f5eec300fd23d0de25c7dc93a96c429 (diff)
parent5e3521f8496511db4df45f011ea72f25623ad90f (diff)
downloadgitblit-acaa2a2765c4864ef001ae1097285c4f5cf2987d.tar.gz
gitblit-acaa2a2765c4864ef001ae1097285c4f5cf2987d.zip
Merged #1 "Ticket tracker with patchset contributions"
Diffstat (limited to 'src/main/java/com/gitblit/utils/RefLogUtils.java')
-rw-r--r--src/main/java/com/gitblit/utils/RefLogUtils.java40
1 files changed, 34 insertions, 6 deletions
diff --git a/src/main/java/com/gitblit/utils/RefLogUtils.java b/src/main/java/com/gitblit/utils/RefLogUtils.java
index d19e892a..4c082d05 100644
--- a/src/main/java/com/gitblit/utils/RefLogUtils.java
+++ b/src/main/java/com/gitblit/utils/RefLogUtils.java
@@ -213,6 +213,22 @@ public class RefLogUtils {
*/
public static boolean updateRefLog(UserModel user, Repository repository,
Collection<ReceiveCommand> commands) {
+
+ // only track branches and tags
+ List<ReceiveCommand> filteredCommands = new ArrayList<ReceiveCommand>();
+ for (ReceiveCommand cmd : commands) {
+ if (!cmd.getRefName().startsWith(Constants.R_HEADS)
+ && !cmd.getRefName().startsWith(Constants.R_TAGS)) {
+ continue;
+ }
+ filteredCommands.add(cmd);
+ }
+
+ if (filteredCommands.isEmpty()) {
+ // nothing to log
+ return true;
+ }
+
RefModel reflogBranch = getRefLogBranch(repository);
if (reflogBranch == null) {
JGitUtils.createOrphanBranch(repository, GB_REFLOG, null);
@@ -443,7 +459,15 @@ public class RefLogUtils {
Date date = push.getAuthorIdent().getWhen();
RefLogEntry log = new RefLogEntry(repositoryName, date, user);
- List<PathChangeModel> changedRefs = JGitUtils.getFilesInCommit(repository, push);
+
+ // only report HEADS and TAGS for now
+ List<PathChangeModel> changedRefs = new ArrayList<PathChangeModel>();
+ for (PathChangeModel refChange : JGitUtils.getFilesInCommit(repository, push)) {
+ if (refChange.path.startsWith(Constants.R_HEADS)
+ || refChange.path.startsWith(Constants.R_TAGS)) {
+ changedRefs.add(refChange);
+ }
+ }
if (changedRefs.isEmpty()) {
// skip empty commits
continue;
@@ -466,12 +490,16 @@ public class RefLogUtils {
// ref deletion
continue;
}
- List<RevCommit> pushedCommits = JGitUtils.getRevLog(repository, oldId, newId);
- for (RevCommit pushedCommit : pushedCommits) {
- RepositoryCommit repoCommit = log.addCommit(change.path, pushedCommit);
- if (repoCommit != null) {
- repoCommit.setRefs(allRefs.get(pushedCommit.getId()));
+ try {
+ List<RevCommit> pushedCommits = JGitUtils.getRevLog(repository, oldId, newId);
+ for (RevCommit pushedCommit : pushedCommits) {
+ RepositoryCommit repoCommit = log.addCommit(change.path, pushedCommit);
+ if (repoCommit != null) {
+ repoCommit.setRefs(allRefs.get(pushedCommit.getId()));
+ }
}
+ } catch (Exception e) {
+
}
}
}