Skip to content

Commit e1fdaae

Browse files
author
Rob Rix
committed
Work around relative/absolute path stuff.
1 parent 84b0a3d commit e1fdaae

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ObjectiveGit/GTFilterList.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ - (NSData *)applyToPath:(NSString *)relativePath inRepository:(GTRepository *)re
6565
NSParameterAssert(repository != nil);
6666

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

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

0 commit comments

Comments
 (0)