Skip to content

Commit a5c1efd

Browse files
pcloudsgitster
authored andcommitted
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>
1 parent e9dcc30 commit a5c1efd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

refs/files-backend.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2510,7 +2510,7 @@ static int files_delete_refs(struct ref_store *ref_store,
25102510
* IOW, to avoid cross device rename errors, the temporary renamed log must
25112511
* live into logs/refs.
25122512
*/
2513-
#define TMP_RENAMED_LOG "logs/refs/.tmp-renamed-log"
2513+
#define TMP_RENAMED_LOG "refs/.tmp-renamed-log"
25142514

25152515
struct rename_cb {
25162516
const char *tmp_renamed_log;
@@ -2546,7 +2546,7 @@ static int rename_tmp_log(const char *newrefname)
25462546
int ret;
25472547

25482548
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);
25502550
cb.tmp_renamed_log = tmp.buf;
25512551
ret = raceproof_create_file(path.buf, rename_tmp_log_callback, &cb);
25522552
if (ret) {
@@ -2608,7 +2608,7 @@ static int files_rename_ref(struct ref_store *ref_store,
26082608

26092609
strbuf_git_path(&sb_oldref, "logs/%s", oldrefname);
26102610
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);
26122612

26132613
log = !lstat(sb_oldref.buf, &loginfo);
26142614
if (log && S_ISLNK(loginfo.st_mode)) {
@@ -2633,7 +2633,7 @@ static int files_rename_ref(struct ref_store *ref_store,
26332633
}
26342634

26352635
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",
26372637
oldrefname, strerror(errno));
26382638
goto out;
26392639
}
@@ -2719,7 +2719,7 @@ static int files_rename_ref(struct ref_store *ref_store,
27192719
oldrefname, newrefname, strerror(errno));
27202720
if (!logmoved && log &&
27212721
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",
27232723
oldrefname, strerror(errno));
27242724
ret = 1;
27252725
out:

0 commit comments

Comments
 (0)