| | |
| | | import org.eclipse.jgit.lib.Repository;
|
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.utils.DiffUtils;
|
| | | import com.gitblit.utils.DiffUtils.DiffOutputType;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | |
| | | Repository r = getRepository();
|
| | | RevCommit commit = getCommit();
|
| | |
|
| | | DiffOutputType diffType = DiffOutputType.forName(GitBlit.getString(Keys.web.diffStyle,
|
| | | DiffOutputType.GITBLIT.name()));
|
| | |
|
| | | String diff;
|
| | | if (StringUtils.isEmpty(baseObjectId)) {
|
| | | // use first parent
|
| | | diff = DiffUtils.getDiff(r, commit, blobPath, diffType);
|
| | | diff = DiffUtils.getDiff(r, commit, blobPath, DiffOutputType.HTML);
|
| | | add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class,
|
| | | WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
|
| | | } else {
|
| | | // base commit specified
|
| | | RevCommit baseCommit = JGitUtils.getCommit(r, baseObjectId);
|
| | | diff = DiffUtils.getDiff(r, baseCommit, commit, blobPath, diffType);
|
| | | diff = DiffUtils.getDiff(r, baseCommit, commit, blobPath, DiffOutputType.HTML);
|
| | | add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class,
|
| | | WicketUtils.newBlobDiffParameter(repositoryName, baseObjectId, objectId,
|
| | | blobPath)));
|