mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Fix ticket #84: disable commit view for bare repos
This commit is contained in:
committed by
Johannes Gilger
parent
64dfd99089
commit
82b6efc1d7
@@ -38,6 +38,7 @@ extern NSString* PBGitRepositoryErrorDomain;
|
||||
|
||||
- (NSString *)workingDirectory;
|
||||
- (NSString *)gitIgnoreFilename;
|
||||
- (BOOL)isBareRepository;
|
||||
|
||||
- (BOOL) reloadRefs;
|
||||
- (void) addRef:(PBGitRef *)ref fromParameters:(NSArray *)params;
|
||||
|
||||
@@ -161,6 +161,11 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
|
||||
return [[self workingDirectory] stringByAppendingPathComponent:@".gitignore"];
|
||||
}
|
||||
|
||||
- (BOOL)isBareRepository
|
||||
{
|
||||
return [PBGitRepository isBareRepository:[self fileURL].path];
|
||||
}
|
||||
|
||||
// Overridden to create our custom window controller
|
||||
- (void)makeWindowControllers
|
||||
{
|
||||
|
||||
@@ -41,6 +41,14 @@
|
||||
[commitViewController removeView];
|
||||
}
|
||||
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
|
||||
{
|
||||
if ([menuItem action] == @selector(showCommitView:) || [menuItem action] == @selector(showHistoryView:)) {
|
||||
return ![repository isBareRepository];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) setSelectedViewIndex: (int) i
|
||||
{
|
||||
selectedViewIndex = i;
|
||||
@@ -120,6 +128,7 @@
|
||||
}
|
||||
}
|
||||
[item bind:@"selectedIndex" toObject:self withKeyPath:@"selectedViewIndex" options:0];
|
||||
[item setEnabled: ![repository isBareRepository]];
|
||||
|
||||
[self.window setToolbar:toolbar];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user