mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Enable arguments to be passed to executeHook.
Some hooks, such as commit-msg and prepare-commit-msg require at least one argument. This allows executeHook to take an array of arguments to be passed on to the hook.
This commit is contained in:
committed by
Pieter de Bie
parent
897c80f8a7
commit
a93740a3a7
@@ -36,6 +36,7 @@ extern NSString* PBGitRepositoryErrorDomain;
|
||||
- (NSString *)outputInWorkdirForArguments:(NSArray*) arguments;
|
||||
- (NSString *)outputInWorkdirForArguments:(NSArray*) arguments retValue:(int *)ret;
|
||||
- (BOOL)executeHook:(NSString *)name output:(NSString **)output;
|
||||
- (BOOL)executeHook:(NSString *)name withArgs:(NSArray*) arguments output:(NSString **)output;
|
||||
|
||||
- (NSString *)workingDirectory;
|
||||
- (NSString *)gitIgnoreFilename;
|
||||
|
||||
+7
-2
@@ -377,15 +377,20 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
|
||||
}
|
||||
|
||||
- (BOOL)executeHook:(NSString *)name output:(NSString **)output
|
||||
{
|
||||
return [self executeHook:name withArgs:[NSArray array] output:output];
|
||||
}
|
||||
|
||||
- (BOOL)executeHook:(NSString *)name withArgs:(NSArray *)arguments output:(NSString **)output
|
||||
{
|
||||
NSString* hookPath = [[[[self fileURL] path] stringByAppendingPathComponent:@"hooks"] stringByAppendingPathComponent:name];
|
||||
if (![[NSFileManager defaultManager] isExecutableFileAtPath:hookPath])
|
||||
return TRUE;
|
||||
int ret = 1;
|
||||
if (output)
|
||||
*output = [PBEasyPipe outputForCommand:hookPath withArgs:[NSArray array] inDir:[self workingDirectory] retValue:&ret];
|
||||
*output = [PBEasyPipe outputForCommand:hookPath withArgs:arguments inDir:[self workingDirectory] retValue:&ret];
|
||||
else
|
||||
[PBEasyPipe outputForCommand:hookPath withArgs:[NSArray array] inDir:[self workingDirectory] retValue:&ret];
|
||||
[PBEasyPipe outputForCommand:hookPath withArgs:arguments inDir:[self workingDirectory] retValue:&ret];
|
||||
|
||||
return ret == 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user