diff --git a/PBGitRepository.h b/PBGitRepository.h
index c636e79..9d743d9 100644
--- a/PBGitRepository.h
+++ b/PBGitRepository.h
@@ -37,6 +37,7 @@ extern NSString* PBGitRepositoryErrorDomain;
- (void) addRef:(PBGitRef *)ref fromParameters:(NSArray *)params;
- (BOOL) removeRef:(NSString *)ref;
- (void) lazyReload;
+- (PBGitRevSpecifier*) headRef;
- (void) readCurrentBranch;
- (PBGitRevSpecifier*) addBranch: (PBGitRevSpecifier*) rev;
diff --git a/PBGitRevisionCell.m b/PBGitRevisionCell.m
index 536036c..0ba1e9f 100644
--- a/PBGitRevisionCell.m
+++ b/PBGitRevisionCell.m
@@ -109,14 +109,20 @@
[path stroke];
}
-- (NSMutableDictionary*) attributesForRefLabelSelected: (BOOL) selected
+- (NSMutableDictionary*) attributesForRefLabelSelected: (BOOL) selected isCurrentBranch: (BOOL) curBranch
{
NSMutableDictionary *attributes = [[[NSMutableDictionary alloc] initWithCapacity:2] autorelease];
NSMutableParagraphStyle* style = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
+ NSString *fontName;
+
+ if(curBranch)
+ fontName = @"Helvetica-Bold";
+ else
+ fontName = @"Helvetica";
[style setAlignment:NSCenterTextAlignment];
[attributes setObject:style forKey:NSParagraphStyleAttributeName];
- [attributes setObject:[NSFont fontWithName:@"Helvetica" size:9] forKey:NSFontAttributeName];
+ [attributes setObject:[NSFont fontWithName:fontName size:9] forKey:NSFontAttributeName];
//if (selected)
// [attributes setObject:[NSColor alternateSelectedControlTextColor] forKey:NSForegroundColorAttributeName];
@@ -149,9 +155,11 @@
int index;
for (index = 0; index < [refs count]; ++index) {
- PBGitRef* ref = [refs objectAtIndex:index];
+ PBGitRef *ref = [refs objectAtIndex:index];
+ BOOL isCurBranch = [ref.ref isEqualToString:[[[controller repository] headRef] simpleRef]];
- NSMutableDictionary* attributes = [self attributesForRefLabelSelected:[self isHighlighted]];
+ NSMutableDictionary* attributes = [self attributesForRefLabelSelected:[self isHighlighted]
+ isCurrentBranch:isCurBranch];
NSSize refSize = [[ref shortName] sizeWithAttributes:attributes];
refRect.size.width = refSize.width + ref_padding;
diff --git a/PBWebHistoryController.m b/PBWebHistoryController.m
index cf725ad..3cb52e6 100644
--- a/PBWebHistoryController.m
+++ b/PBWebHistoryController.m
@@ -49,6 +49,7 @@
id script = [view windowScriptObject];
[script setValue: content forKey:@"CommitObject"];
+ [script setValue:[[[historyController repository] headRef] simpleRef] forKey:@"CurrentBranch"];
// The sha is the same, but refs may have changed.. reload it lazy
if ([currentSha isEqualToString: content.sha])
diff --git a/html/commit.js b/html/commit.js
index 05cb596..5d1f757 100644
--- a/html/commit.js
+++ b/html/commit.js
@@ -108,7 +108,8 @@ var showRefs = function() {
$('refs').parentNode.style.display = "";
$('refs').innerHTML = "";
$A(commit.refs).each(function(ref) {
- $('refs').innerHTML += '' + ref.shortName() + '';
+ curBranch = "";
+ $('refs').innerHTML += '' + ref.shortName() + '';
});
} else
$('refs').parentNode.style.display = "none";
diff --git a/html/commits.css b/html/commits.css
index a3cba7f..9a9a2f4 100644
--- a/html/commits.css
+++ b/html/commits.css
@@ -81,3 +81,6 @@ a.showdiff {
background-color: #fced4f;
}
+.refs.currentBranch {
+ font-weight: bold;
+}
\ No newline at end of file