Add gitweb.linkDrafts to control if gitweb links are shown on drafts

If gitweb is hosted on a second server and only public references
are replicated, links to draft patch sets in the panel don't go
anywhere useful.

Default behavior remains the same, to provide links on all patch sets,
regardless of draft status.

Change-Id: Ia26f08b4fd4e480a89b84ff5602603c3fcc8eee6
This commit is contained in:
Chad Horohoe
2013-04-12 14:52:56 -04:00
parent eeed4976d0
commit 1dfe36c9b2
5 changed files with 38 additions and 1 deletions

View File

@@ -35,6 +35,16 @@ public class GitwebLink {
type = link.type;
}
/**
* Can we link to a patch set if it's a draft
*
* @param ps Patch set to check draft status
* @return true if it's not a draft, or we can link to drafts
*/
public boolean canLink(final PatchSet ps) {
return !ps.isDraft() || type.getLinkDrafts();
}
public String getLinkName() {
return "(" + type.getLinkName() + ")";
}