diff options
| author | Vicent Marti <tanoku@gmail.com> | 2011-02-05 12:42:41 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2011-02-05 12:42:41 +0200 |
| commit | f725931b4865317b58c1f1600724cb36e586c332 (patch) | |
| tree | 571497dd0b831f683ffa6326014db2549e5a9a21 /src/odb_loose.c | |
| parent | c836c332f17ff2da8bdf6d18fb3d59eac2586ca9 (diff) | |
| download | libgit2-f725931b4865317b58c1f1600724cb36e586c332.tar.gz | |
Fix directory/path manipulation methods
The `dirname` and `dirbase` methods have been replaced with the Android
implementation, which is actually compilant to some kind of standard.
A new method `topdir` has been added, which returns the topmost
directory in a path.
These changes fix issue #49:
`gitfo_prettify_dir_path` converts "./.git/" to ".git/", so
the code at src/repository.c:190 goes out of bounds when
trying to find the topmost directory.
The new `git__topdir` method handles this gracefully, and the
fixed `git__dirname` now returns the proper value for the
repository's working dir.
E.g.
/repo/.git/ ==> working dir '/repo/'
.git/ ==> working dir '.'
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/odb_loose.c')
| -rw-r--r-- | src/odb_loose.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/odb_loose.c b/src/odb_loose.c index b031bde3f..f89eb71ff 100644 --- a/src/odb_loose.c +++ b/src/odb_loose.c @@ -59,7 +59,7 @@ static int make_temp_file(git_file *fd, char *tmp, size_t n, char *file) size_t tmplen = strlen(template); int dirlen; - if ((dirlen = git__dirname(tmp, n, file)) < 0) + if ((dirlen = git__dirname_r(tmp, n, file)) < 0) return GIT_ERROR; if ((dirlen + tmplen) >= n) |
