diff options
| author | Vicent Marti <tanoku@gmail.com> | 2011-02-09 12:43:19 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2011-02-09 12:43:19 +0200 |
| commit | 995f9c34a580bc17be577d807f9a3bcfd417a748 (patch) | |
| tree | d8039db19889dce3ce99eb525367083030335bbe /src/index.c | |
| parent | 772c7e762363d6d5b5627941057775ba06886bb6 (diff) | |
| download | libgit2-995f9c34a580bc17be577d807f9a3bcfd417a748.tar.gz | |
Use the new git__joinpath to build paths in methods
The `git__joinpath` function has been changed to use a statically
allocated buffer; we assume the buffer to be 4096 bytes, because fuck
you.
The new method also supports an arbritrary number of paths to join,
which may come in handy in the future.
Some methods which were manually joining paths with `strcpy` now use the
new function, namely those in `index.c` and `refs.c`.
Based on Emeric Fermas' original patch, which was using the old
`git__joinpath` because I'm stupid. Thanks!
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/index.c')
| -rw-r--r-- | src/index.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/index.c b/src/index.c index 6fdb46e18..0e77105b8 100644 --- a/src/index.c +++ b/src/index.c @@ -289,8 +289,7 @@ int git_index_add(git_index *index, const char *rel_path, int stage) if (index->repository == NULL) return GIT_EBAREINDEX; - strcpy(full_path, index->repository->path_workdir); - strcat(full_path, rel_path); + git__joinpath(full_path, index->repository->path_workdir, rel_path); if (gitfo_exists(full_path) < 0) return GIT_ENOTFOUND; |
