summaryrefslogtreecommitdiff
path: root/builtin/checkout.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-02-03 11:25:19 -0800
committerJunio C Hamano <gitster@pobox.com>2017-02-03 11:25:19 -0800
commitfafca0f72a11bc03263e6f97d07d6f27ea61de48 (patch)
tree0498cf6b916a833d71ac540c4eec85212ee6ac94 /builtin/checkout.c
parent74dee5cfae1250693447349f3f6bbc26201c5524 (diff)
parent67c70bd930538890d8eccace72fb0e0a0e565447 (diff)
downloadgit-fafca0f72a11bc03263e6f97d07d6f27ea61de48.tar.gz
Merge branch 'cw/log-updates-for-all-refs-really'
The "core.logAllRefUpdates" that used to be boolean has been enhanced to take 'always' as well, to record ref updates to refs other than the ones that are expected to be updated (i.e. branches, remote-tracking branches and notes). * cw/log-updates-for-all-refs-really: doc: add note about ignoring '--no-create-reflog' update-ref: add test cases for bare repository refs: add option core.logAllRefUpdates = always config: add markup to core.logAllRefUpdates doc
Diffstat (limited to 'builtin/checkout.c')
-rw-r--r--builtin/checkout.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 80d5e38981..f174f50303 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -612,22 +612,25 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
const char *old_desc, *reflog_msg;
if (opts->new_branch) {
if (opts->new_orphan_branch) {
- if (opts->new_branch_log && !log_all_ref_updates) {
+ char *refname;
+
+ refname = mkpathdup("refs/heads/%s", opts->new_orphan_branch);
+ if (opts->new_branch_log &&
+ !should_autocreate_reflog(refname)) {
int ret;
- char *refname;
struct strbuf err = STRBUF_INIT;
- refname = mkpathdup("refs/heads/%s", opts->new_orphan_branch);
ret = safe_create_reflog(refname, 1, &err);
- free(refname);
if (ret) {
fprintf(stderr, _("Can not do reflog for '%s': %s\n"),
opts->new_orphan_branch, err.buf);
strbuf_release(&err);
+ free(refname);
return;
}
strbuf_release(&err);
}
+ free(refname);
}
else
create_branch(opts->new_branch, new->name,