Skip to content

Commit

Permalink
Work around relative/absolute path stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
robrix committed Mar 6, 2015
1 parent 84b0a3d commit e1fdaae
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ObjectiveGit/GTFilterList.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ - (NSData *)applyToPath:(NSString *)relativePath inRepository:(GTRepository *)re
NSParameterAssert(repository != nil);

git_buf output = GIT_BUF_INIT_CONST(0, NULL);
int gitError = git_filter_list_apply_to_file(&output, self.git_filter_list, repository.git_repository, relativePath.UTF8String);
// fixme: This is a workaround for an issue where `git_filter_list_apply_to_file`
// will not resolve relative paths against the worktree. It should be reverted when
// libgit2 has been updated to resolve that.
NSString *absolutePath = relativePath.absolutePath ? relativePath : [repository.fileURL URLByAppendingPathComponent:relativePath].path;
int gitError = git_filter_list_apply_to_file(&output, self.git_filter_list, repository.git_repository, absolutePath.UTF8String);

if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to apply filter list to %@", relativePath];
Expand Down

0 comments on commit e1fdaae

Please sign in to comment.