summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/checkout.c7
-rw-r--r--builtin/reflog.c2
2 files changed, 4 insertions, 5 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 07cf555309..d3fc3a8532 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -651,12 +651,11 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
}
}
if (old->path && old->name) {
- char log_file[PATH_MAX], ref_file[PATH_MAX];
+ char ref_file[PATH_MAX];
- git_snpath(log_file, sizeof(log_file), "logs/%s", old->path);
git_snpath(ref_file, sizeof(ref_file), "%s", old->path);
- if (!file_exists(ref_file) && file_exists(log_file))
- remove_path(log_file);
+ if (!file_exists(ref_file) && reflog_exists(old->path))
+ delete_reflog(old->path);
}
}
remove_branch_state();
diff --git a/builtin/reflog.c b/builtin/reflog.c
index c12a9784e6..e8a8fb13b9 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -369,7 +369,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
if (!lock)
return error("cannot lock ref '%s'", ref);
log_file = git_pathdup("logs/%s", ref);
- if (!file_exists(log_file))
+ if (!reflog_exists(ref))
goto finish;
if (!cmd->dry_run) {
newlog_path = git_pathdup("logs/%s.lock", ref);