Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2011-11-07 22:34:24 +0400
committerCarlos Martín Nieto <carlos@cmartin.tk>2011-11-07 23:34:27 +0400
commit0c49ec2d3b5bfc32d69d189b7dc69cc26beb6a92 (patch)
tree86fe3204cfbe9b2a09fcd4d22b1ddf24f51e7269 /src/posix.c
parent38068dc1d3cf4a0f0dc2ce8c488a1de4621c04b5 (diff)
Implement p_rename
Move the callers of git_futils_mv_atomic to use p_rename. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Diffstat (limited to 'src/posix.c')
-rw-r--r--src/posix.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/posix.c b/src/posix.c
index 7cd0749b6..8c19588ee 100644
--- a/src/posix.c
+++ b/src/posix.c
@@ -39,6 +39,20 @@ int p_getcwd(char *buffer_out, size_t size)
return GIT_SUCCESS;
}
+int p_rename(const char *from, const char *to)
+{
+ if (!link(from, to)) {
+ p_unlink(from);
+ return GIT_SUCCESS;
+ }
+
+ if (!rename(from, to))
+ return GIT_SUCCESS;
+
+ return GIT_ERROR;
+
+}
+
#endif
int p_read(git_file fd, void *buf, size_t cnt)