summaryrefslogtreecommitdiffstats
path: root/rerere.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-05-17 14:38:28 -0700
committerJunio C Hamano <gitster@pobox.com>2016-05-17 14:38:28 -0700
commit40cfc95856594ddd04ae6ef3bfd041346c4854ec (patch)
tree13f4a476ed02d287c34a3460341deacb2dcd6a53 /rerere.c
parent8648eacc1d45a7d25cb4d293549bbe6ae17cbd81 (diff)
parent1da045fb9db5db8f01eb5e7c6106880ca5274643 (diff)
downloadgit-40cfc95856594ddd04ae6ef3bfd041346c4854ec.tar.gz
git-40cfc95856594ddd04ae6ef3bfd041346c4854ec.tar.xz
Merge branch 'nd/error-errno'
The code for warning_errno/die_errno has been refactored and a new error_errno() reporting helper is introduced. * nd/error-errno: (41 commits) wrapper.c: use warning_errno() vcs-svn: use error_errno() upload-pack.c: use error_errno() unpack-trees.c: use error_errno() transport-helper.c: use error_errno() sha1_file.c: use {error,die,warning}_errno() server-info.c: use error_errno() sequencer.c: use error_errno() run-command.c: use error_errno() rerere.c: use error_errno() and warning_errno() reachable.c: use error_errno() mailmap.c: use error_errno() ident.c: use warning_errno() http.c: use error_errno() and warning_errno() grep.c: use error_errno() gpg-interface.c: use error_errno() fast-import.c: use error_errno() entry.c: use error_errno() editor.c: use error_errno() diff-no-index.c: use error_errno() ...
Diffstat (limited to 'rerere.c')
-rw-r--r--rerere.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/rerere.c b/rerere.c
index c8b9f4078..1810c040d 100644
--- a/rerere.c
+++ b/rerere.c
@@ -501,8 +501,7 @@ static int handle_file(const char *path, unsigned char *sha1, const char *output
error("There were errors while writing %s (%s)",
path, strerror(io.io.wrerror));
if (io.io.output && fclose(io.io.output))
- io.io.wrerror = error("Failed to flush %s: %s",
- path, strerror(errno));
+ io.io.wrerror = error_errno("Failed to flush %s", path);
if (hunk_no < 0) {
if (output)
@@ -684,20 +683,17 @@ static int merge(const struct rerere_id *id, const char *path)
* Mark that "postimage" was used to help gc.
*/
if (utime(rerere_path(id, "postimage"), NULL) < 0)
- warning("failed utime() on %s: %s",
- rerere_path(id, "postimage"),
- strerror(errno));
+ warning_errno("failed utime() on %s",
+ rerere_path(id, "postimage"));
/* Update "path" with the resolution */
f = fopen(path, "w");
if (!f)
- return error("Could not open %s: %s", path,
- strerror(errno));
+ return error_errno("Could not open %s", path);
if (fwrite(result.ptr, result.size, 1, f) != 1)
- error("Could not write %s: %s", path, strerror(errno));
+ error_errno("Could not write %s", path);
if (fclose(f))
- return error("Writing %s failed: %s", path,
- strerror(errno));
+ return error_errno("Writing %s failed", path);
out:
free(cur.ptr);
@@ -1071,7 +1067,7 @@ static int rerere_forget_one_path(const char *path, struct string_list *rr)
if (unlink(filename))
return (errno == ENOENT
? error("no remembered resolution for %s", path)
- : error("cannot unlink %s: %s", filename, strerror(errno)));
+ : error_errno("cannot unlink %s", filename));
/*
* Update the preimage so that the user can resolve the