diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-02-03 11:25:19 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-02-03 11:25:19 -0800 |
commit | fafca0f72a11bc03263e6f97d07d6f27ea61de48 (patch) | |
tree | 0498cf6b916a833d71ac540c4eec85212ee6ac94 /builtin | |
parent | Merge branch 'pl/complete-diff-submodule-diff' (diff) | |
parent | doc: add note about ignoring '--no-create-reflog' (diff) | |
download | tgif-fafca0f72a11bc03263e6f97d07d6f27ea61de48.tar.xz |
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')
-rw-r--r-- | builtin/checkout.c | 11 | ||||
-rw-r--r-- | builtin/init-db.c | 2 |
2 files changed, 8 insertions, 5 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, diff --git a/builtin/init-db.c b/builtin/init-db.c index 76d68fad00..1d4d6a0078 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -262,7 +262,7 @@ static int create_default_files(const char *template_path, const char *work_tree = get_git_work_tree(); git_config_set("core.bare", "false"); /* allow template config file to override the default */ - if (log_all_ref_updates == -1) + if (log_all_ref_updates == LOG_REFS_UNSET) git_config_set("core.logallrefupdates", "true"); if (needs_work_tree_config(original_git_dir, work_tree)) git_config_set("core.worktree", work_tree); |