summaryrefslogtreecommitdiff
path: root/builtin/checkout.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-07-11 13:04:33 -0700
committerJunio C Hamano <gitster@pobox.com>2013-07-11 13:04:33 -0700
commit6af984043f121d2f80aeb837c0b2259ad254a829 (patch)
tree892790852e26db212da6ec26f816795a74de5b97 /builtin/checkout.c
parent3b8d2765c794ef1f1c7b39a90f72c4e61ce26fbd (diff)
parent3bed291a3b121408b4de83f4fa3cc0f1d98c676e (diff)
downloadgit-6af984043f121d2f80aeb837c0b2259ad254a829.tar.gz
Merge branch 'rr/rebase-checkout-reflog'
Invocations of "git checkout" used internally by "git rebase" were counted as "checkout", and affected later "git checkout -" to the the user to an unexpected place. * rr/rebase-checkout-reflog: checkout: respect GIT_REFLOG_ACTION status: do not depend on rebase reflog messages t/t2021-checkout-last: "checkout -" should work after a rebase finishes wt-status: remove unused field in grab_1st_switch_cbdata t7512: test "detached from" as well
Diffstat (limited to 'builtin/checkout.c')
-rw-r--r--builtin/checkout.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 3be0018821..7fe0bffaf8 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -587,7 +587,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
struct branch_info *new)
{
struct strbuf msg = STRBUF_INIT;
- const char *old_desc;
+ const char *old_desc, *reflog_msg;
if (opts->new_branch) {
if (opts->new_orphan_branch) {
if (opts->new_branch_log && !log_all_ref_updates) {
@@ -620,8 +620,13 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
old_desc = old->name;
if (!old_desc && old->commit)
old_desc = sha1_to_hex(old->commit->object.sha1);
- strbuf_addf(&msg, "checkout: moving from %s to %s",
- old_desc ? old_desc : "(invalid)", new->name);
+
+ reflog_msg = getenv("GIT_REFLOG_ACTION");
+ if (!reflog_msg)
+ strbuf_addf(&msg, "checkout: moving from %s to %s",
+ old_desc ? old_desc : "(invalid)", new->name);
+ else
+ strbuf_insert(&msg, 0, reflog_msg, strlen(reflog_msg));
if (!strcmp(new->name, "HEAD") && !new->path && !opts->force_detach) {
/* Nothing to do. */