diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-06-06 11:23:04 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-06 11:23:04 -0700 |
commit | f7f349e1383077fb9e1c03335a372b52a19ab2f0 (patch) | |
tree | af7577da1619d7d056b967f480c1c371d666488b /builtin | |
parent | 43eb7cb260cb17e28dda12e8dc1eb5554e650841 (diff) | |
parent | 482b8f3208e797f00db58edd7ff0d67275e898f5 (diff) | |
download | git-f7f349e1383077fb9e1c03335a372b52a19ab2f0.tar.gz git-f7f349e1383077fb9e1c03335a372b52a19ab2f0.tar.xz |
Merge branch 'rs/reflog-exists'
* rs/reflog-exists:
checkout.c: use ref_exists instead of file_exist
refs.c: add new functions reflog_exists and delete_reflog
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/checkout.c | 8 | ||||
-rw-r--r-- | builtin/reflog.c | 2 |
2 files changed, 3 insertions, 7 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c index ff4492162..f1dc56e55 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -651,12 +651,8 @@ 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]; - - 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 (!ref_exists(old->path) && reflog_exists(old->path)) + delete_reflog(old->path); } } remove_branch_state(); diff --git a/builtin/reflog.c b/builtin/reflog.c index c12a9784e..e8a8fb13b 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); |