Permalink
Browse files

PBGitRepository: Specify environment when calling hooks

  • Loading branch information...
pieter committed Jun 11, 2009
1 parent 57168e1 commit b382b3411890efd19f2f00071578c0c3762c75ea
Showing with 11 additions and 4 deletions.
  1. +11 −4 PBGitRepository.m
View
@@ -400,14 +400,21 @@ - (BOOL)executeHook:(NSString *)name output:(NSString **)output
- (BOOL)executeHook:(NSString *)name withArgs:(NSArray *)arguments output:(NSString **)output
{
- NSString* hookPath = [[[[self fileURL] path] stringByAppendingPathComponent:@"hooks"] stringByAppendingPathComponent:name];
+ NSString *hookPath = [[[[self fileURL] path] stringByAppendingPathComponent:@"hooks"] stringByAppendingPathComponent:name];
if (![[NSFileManager defaultManager] isExecutableFileAtPath:hookPath])
return TRUE;
+
+ NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:
+ [self fileURL].path, @"GIT_DIR",
+ [[self fileURL].path stringByAppendingPathComponent:@"index"], @"GIT_INDEX_FILE",
+ nil
+ ];
+
int ret = 1;
+ NSString *_output = [PBEasyPipe outputForCommand:hookPath withArgs:arguments inDir:[self workingDirectory] byExtendingEnvironment:info inputString:nil retValue:&ret];
+
if (output)
- *output = [PBEasyPipe outputForCommand:hookPath withArgs:arguments inDir:[self workingDirectory] retValue:&ret];
- else
- [PBEasyPipe outputForCommand:hookPath withArgs:arguments inDir:[self workingDirectory] retValue:&ret];
+ *output = _output;
return ret == 0;
}

0 comments on commit b382b34

Please sign in to comment.