summaryrefslogtreecommitdiff
path: root/builtin-rerere.c
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2008-02-25 14:24:48 -0500
committerJunio C Hamano <gitster@pobox.com>2008-02-25 13:06:49 -0800
commit1468bd47833c6ec3c85620d6af1d910e9378f714 (patch)
tree0a5e2d838f48d511f6552d525c821f9a41fc1ab5 /builtin-rerere.c
parented10d9aa3f771ad343df5aa50d9004945f7a4e56 (diff)
downloadgit-1468bd47833c6ec3c85620d6af1d910e9378f714.tar.gz
Use a single implementation and API for copy_file()
Originally by Kristian Hï¿œgsberg; I fixed the conversion of rerere, which had a different API. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-rerere.c')
-rw-r--r--builtin-rerere.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/builtin-rerere.c b/builtin-rerere.c
index a9e3ebc137..b2971f3445 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -267,23 +267,6 @@ static int diff_two(const char *file1, const char *label1,
return 0;
}
-static int copy_file(const char *src, const char *dest)
-{
- FILE *in, *out;
- char buffer[32768];
- int count;
-
- if (!(in = fopen(src, "r")))
- return error("Could not open %s", src);
- if (!(out = fopen(dest, "w")))
- return error("Could not open %s", dest);
- while ((count = fread(buffer, 1, sizeof(buffer), in)))
- fwrite(buffer, 1, count, out);
- fclose(in);
- fclose(out);
- return 0;
-}
-
static int do_plain_rerere(struct path_list *rr, int fd)
{
struct path_list conflict = { NULL, 0, 0, 1 };
@@ -343,7 +326,7 @@ static int do_plain_rerere(struct path_list *rr, int fd)
continue;
fprintf(stderr, "Recorded resolution for '%s'.\n", path);
- copy_file(path, rr_path(name, "postimage"));
+ copy_file(rr_path(name, "postimage"), path, 0666);
tail_optimization:
if (i < rr->nr - 1)
memmove(rr->items + i,