Skip to content

Commit abca668

Browse files
committed
Merge branch 'sg/lock-file-commit-error' into maint
Cosmetic improvement to lock-file error messages. * sg/lock-file-commit-error: Make error message after failing commit_lock_file() less confusing
2 parents 7605881 + 08a3651 commit abca668

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

config.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,7 +2144,8 @@ int git_config_set_multivar_in_file(const char *config_filename,
21442144
}
21452145

21462146
if (commit_lock_file(lock) < 0) {
2147-
error("could not commit config file %s", config_filename);
2147+
error("could not write config file %s: %s", config_filename,
2148+
strerror(errno));
21482149
ret = CONFIG_NO_WRITE;
21492150
lock = NULL;
21502151
goto out_free;
@@ -2330,7 +2331,8 @@ int git_config_rename_section_in_file(const char *config_filename,
23302331
fclose(config_file);
23312332
unlock_and_out:
23322333
if (commit_lock_file(lock) < 0)
2333-
ret = error("could not commit config file %s", config_filename);
2334+
ret = error("could not write config file %s: %s",
2335+
config_filename, strerror(errno));
23342336
out:
23352337
free(filename_buf);
23362338
return ret;

credential-store.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ static void rewrite_credential_file(const char *fn, struct credential *c,
6464
print_line(extra);
6565
parse_credential_file(fn, c, NULL, print_line);
6666
if (commit_lock_file(&credential_lock) < 0)
67-
die_errno("unable to commit credential store");
67+
die_errno("unable to write credential store: %s",
68+
strerror(errno));
6869
}
6970

7071
static void store_credential_file(const char *fn, struct credential *c)

fast-import.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,7 @@ static void dump_marks(void)
18211821

18221822
dump_marks_helper(f, 0, marks);
18231823
if (commit_lock_file(&mark_lock)) {
1824-
failure |= error("Unable to commit marks file %s: %s",
1824+
failure |= error("Unable to write file %s: %s",
18251825
export_marks_file, strerror(errno));
18261826
return;
18271827
}

refs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4643,7 +4643,7 @@ int reflog_expire(const char *refname, const unsigned char *sha1,
46434643
get_lock_file_path(lock->lk));
46444644
rollback_lock_file(&reflog_lock);
46454645
} else if (commit_lock_file(&reflog_lock)) {
4646-
status |= error("unable to commit reflog '%s' (%s)",
4646+
status |= error("unable to write reflog %s: %s",
46474647
log_file, strerror(errno));
46484648
} else if (update && commit_ref(lock)) {
46494649
status |= error("couldn't set %s", lock->ref_name);

0 commit comments

Comments
 (0)