diff options
| author | Edward Thomson <ethomson@github.com> | 2016-04-02 16:52:53 -0400 |
|---|---|---|
| committer | Edward Thomson <ethomson@github.com> | 2016-04-02 16:52:53 -0400 |
| commit | 7018e3b747de0e753bcbc6cbae8ca687cf8ebf4c (patch) | |
| tree | 518081177e5e6913a33b531855390c14465617dd /src | |
| parent | 36fc25572ca042372b1a58f07bc721b2b827e8be (diff) | |
| parent | d364dc8b39095061ba930e713335d4398cc4d977 (diff) | |
| download | libgit2-7018e3b747de0e753bcbc6cbae8ca687cf8ebf4c.tar.gz | |
Merge pull request #3723 from libgit2/cmn/ignore-symlink
ignore: don't use realpath to canonicalize path
Diffstat (limited to 'src')
| -rw-r--r-- | src/ignore.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ignore.c b/src/ignore.c index aedc1401e..ac2af4f58 100644 --- a/src/ignore.c +++ b/src/ignore.c @@ -263,10 +263,18 @@ int git_ignore__for_path( goto cleanup; /* given a unrooted path in a non-bare repo, resolve it */ - if (workdir && git_path_root(path) < 0) - error = git_path_find_dir(&ignores->dir, path, workdir); - else + if (workdir && git_path_root(path) < 0) { + git_buf local = GIT_BUF_INIT; + + if ((error = git_path_dirname_r(&local, path)) < 0 || + (error = git_path_resolve_relative(&local, 0)) < 0 || + (error = git_path_to_dir(&local)) < 0 || + (error = git_buf_joinpath(&ignores->dir, workdir, local.ptr)) < 0) + {;} /* Nothing, we just want to stop on the first error */ + git_buf_free(&local); + } else { error = git_buf_joinpath(&ignores->dir, path, ""); + } if (error < 0) goto cleanup; |
