files-backend: move "logs/" out of TMP_RENAMED_LOG

This makes reflog path building consistent, always in the form of strbuf_git_path(sb, "logs/%s", refname); It reduces the mental workload a bit in the next patch when that function call is converted. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Mar 26, 2017 at 09:42 UTC a5c1efd693a09bd7d058e1370869e061f94b61ed
1 file changed +5 -5
refs/files-backend.c
+5 -5
@@ -2510,7 +2510,7 @@ out:
2510 * IOW, to avoid cross device rename errors, the temporary renamed log must
2511 * live into logs/refs.
2512 */
2513 -#define TMP_RENAMED_LOG "logs/refs/.tmp-renamed-log"
2513 +#define TMP_RENAMED_LOG "refs/.tmp-renamed-log"
2514
2515 struct rename_cb {
2516 const char *tmp_renamed_log;
@@ -2546,7 +2546,7 @@ static int rename_tmp_log(const char *newrefname)
2546 int ret;
2547
2548 strbuf_git_path(&path, "logs/%s", newrefname);
2549 - strbuf_git_path(&tmp, TMP_RENAMED_LOG);
2549 + strbuf_git_path(&tmp, "logs/%s", TMP_RENAMED_LOG);
2550 cb.tmp_renamed_log = tmp.buf;
2551 ret = raceproof_create_file(path.buf, rename_tmp_log_callback, &cb);
2552 if (ret) {
@@ -2608,7 +2608,7 @@ static int files_rename_ref(struct ref_store *ref_store,
2608
2609 strbuf_git_path(&sb_oldref, "logs/%s", oldrefname);
2610 strbuf_git_path(&sb_newref, "logs/%s", newrefname);
2611 - strbuf_git_path(&tmp_renamed_log, TMP_RENAMED_LOG);
2611 + strbuf_git_path(&tmp_renamed_log, "logs/%s", TMP_RENAMED_LOG);
2612
2613 log = !lstat(sb_oldref.buf, &loginfo);
2614 if (log && S_ISLNK(loginfo.st_mode)) {
@@ -2633,7 +2633,7 @@ static int files_rename_ref(struct ref_store *ref_store,
2633 }
2634
2635 if (log && rename(sb_oldref.buf, tmp_renamed_log.buf)) {
2636 - ret = error("unable to move logfile logs/%s to "TMP_RENAMED_LOG": %s",
2636 + ret = error("unable to move logfile logs/%s to logs/"TMP_RENAMED_LOG": %s",
2637 oldrefname, strerror(errno));
2638 goto out;
2639 }
@@ -2719,7 +2719,7 @@ static int files_rename_ref(struct ref_store *ref_store,
2719 oldrefname, newrefname, strerror(errno));
2720 if (!logmoved && log &&
2721 rename(tmp_renamed_log.buf, sb_oldref.buf))
2722 - error("unable to restore logfile %s from "TMP_RENAMED_LOG": %s",
2722 + error("unable to restore logfile %s from logs/"TMP_RENAMED_LOG": %s",
2723 oldrefname, strerror(errno));
2724 ret = 1;
2725 out: