Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes: >> @@ -827,8 +827,11 @@ static int checkout_up_to_date(struct rebase_options *options) >> getenv(GIT_REFLOG_ACTION_ENVIRONMENT), >> options->switch_to); >> ropts.oid = &options->orig_head; >> - ropts.branch = options->head_name; >> ropts.flags = RESET_HEAD_RUN_POST_CHECKOUT_HOOK; >> + if (options->head_name) >> + ropts.branch = options->head_name; >> + else >> + ropts.flags |= RESET_HEAD_DETACH; >> ropts.head_msg = buf.buf; >> if (reset_head(the_repository, &ropts) < 0) >> ret = error(_("could not switch to %s"), options->switch_to); > > In this case a smaller change of: > > if (!ropts.branch) > ropts.flags |= RESET_HEAD_DETACH; > > will do the same. Thanks. That is much easier to read and simpler to follow. > I wonder if just converting it to a designated initializer while we're > at it (or a pre-cleanup commit) would be better, i.e.: I do not think it easier to follow than even the original or the improvement above, especially the part that computes .flags member.