Merge branch 'sg/lock-file-commit-error'
authorJunio C Hamano <gitster@pobox.com>
Fri, 11 Dec 2015 18:40:54 +0000 (10:40 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 11 Dec 2015 18:40:55 +0000 (10:40 -0800)
Cosmetic improvement to lock-file error messages.

* sg/lock-file-commit-error:
Make error message after failing commit_lock_file() less confusing

config.c
credential-store.c
fast-import.c
refs/files-backend.c
index 248a21ab94116fabba95e01a8571a458efa99f76..86a5eb2571fb282a1d7bad9e6d097b2374b550dc 100644 (file)
--- a/config.c
+++ b/config.c
@@ -2144,7 +2144,8 @@ int git_config_set_multivar_in_file(const char *config_filename,
        }
 
        if (commit_lock_file(lock) < 0) {
-               error("could not commit config file %s", config_filename);
+               error("could not write config file %s: %s", config_filename,
+                     strerror(errno));
                ret = CONFIG_NO_WRITE;
                lock = NULL;
                goto out_free;
@@ -2330,7 +2331,8 @@ int git_config_rename_section_in_file(const char *config_filename,
        fclose(config_file);
 unlock_and_out:
        if (commit_lock_file(lock) < 0)
-               ret = error("could not commit config file %s", config_filename);
+               ret = error("could not write config file %s: %s",
+                           config_filename, strerror(errno));
 out:
        free(filename_buf);
        return ret;
index 00aea3aa304f2731da070c447f694591b3021bc9..fc67d16c10882bf543bd521d2f6dfee8d3c4d213 100644 (file)
@@ -64,7 +64,8 @@ static void rewrite_credential_file(const char *fn, struct credential *c,
                print_line(extra);
        parse_credential_file(fn, c, NULL, print_line);
        if (commit_lock_file(&credential_lock) < 0)
-               die_errno("unable to commit credential store");
+               die_errno("unable to write credential store: %s",
+                         strerror(errno));
 }
 
 static void store_credential_file(const char *fn, struct credential *c)
index e3b421d5149bc3a2ad58ca8df98fdf2c924ed7c0..3c65edb5c44e1fa57beef851d56a9674a5be1b72 100644 (file)
@@ -1824,7 +1824,7 @@ static void dump_marks(void)
 
        dump_marks_helper(f, 0, marks);
        if (commit_lock_file(&mark_lock)) {
-               failure |= error("Unable to commit marks file %s: %s",
+               failure |= error("Unable to write file %s: %s",
                        export_marks_file, strerror(errno));
                return;
        }
index 4db3e36f89c57c5f2d37cf92d331659a001394f8..c648b5e853c347f0978d835cb057a9a2831bf0dd 100644 (file)
@@ -3494,7 +3494,7 @@ int reflog_expire(const char *refname, const unsigned char *sha1,
                                        get_lock_file_path(lock->lk));
                        rollback_lock_file(&reflog_lock);
                } else if (commit_lock_file(&reflog_lock)) {
-                       status |= error("unable to commit reflog '%s' (%s)",
+                       status |= error("unable to write reflog '%s' (%s)",
                                        log_file, strerror(errno));
                } else if (update && commit_ref(lock)) {
                        status |= error("couldn't set %s", lock->ref_name);