path: root/builtin/commit.c
diff options
authorNguyễn Thái Ngọc Duy <>2017-05-03 10:16:46 (GMT)
committerJunio C Hamano <>2017-05-26 03:33:55 (GMT)
commit23a9e0712d76a63c5af1caeb816943f466f0300e (patch)
tree1b065a078058d664ed353f6da0c77842381a5645 /builtin/commit.c
parentb0a642ac4624740187212aecec62b35a2eab38cb (diff)
use xfopen() in more places
xfopen() - provides error details - explains error on reading, or writing, or whatever operation - has l10n support - prints file name in the error Some of these are missing in the places that are replaced with xfopen(), which is a clear win. In some other places, it's just less code (not as clearly a win as the previous case but still is). The only slight regresssion is in remote-testsvn, where we don't report the file class (marks files) in the error messages anymore. But since this is a _test_ svn remote transport, I'm not too concerned. Signed-off-by: Nguyễn Thái Ngọc Duy <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/commit.c')
1 files changed, 1 insertions, 4 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 1d805f5..eda0d32 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1695,10 +1695,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
if (!reflog_msg)
reflog_msg = "commit (merge)";
pptr = commit_list_append(current_head, pptr);
- fp = fopen(git_path_merge_head(), "r");
- if (fp == NULL)
- die_errno(_("could not open '%s' for reading"),
- git_path_merge_head());
+ fp = xfopen(git_path_merge_head(), "r");
while (strbuf_getline_lf(&m, fp) != EOF) {
struct commit *parent;