Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- branch.c | 48 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/branch.c b/branch.c index eccdaf9..d8facf7 100644 --- a/branch.c +++ b/branch.c @@ -74,25 +74,43 @@ void install_branch_config(int flag, const char *local, const char *origin, cons strbuf_addf(&key, "branch.%s.rebase", local); git_config_set(key.buf, "true"); } + strbuf_release(&key); if (flag & BRANCH_CONFIG_VERBOSE) { - strbuf_reset(&key); - - strbuf_addstr(&key, origin ? "remote" : "local"); - - /* Are we tracking a proper "branch"? */ - if (remote_is_branch) { - strbuf_addf(&key, " branch %s", shortname); - if (origin) - strbuf_addf(&key, " from %s", origin); + if (rebasing) { + if (remote_is_branch) { + if (origin) + printf("Branch %s set up to track remote branch %s from %s by rebasing.\n", + local, shortname, origin); + else + printf("Branch %s set up to track local branch %s by rebasing.\n", + local, shortname); + } else { + if (origin) + printf("Branch %s set up to track remote ref %s by rebasing.\n", + local, remote); + else + printf("Branch %s set up to track local ref %s by rebasing.\n", + local, remote); + } + } else { + if (remote_is_branch) { + if (origin) + printf("Branch %s set up to track remote branch %s from %s.\n", + local, shortname, origin); + else + printf("Branch %s set up to track local branch %s.\n", + local, shortname); + } else { + if (origin) + printf("Branch %s set up to track remote ref %s.\n", + local, remote); + else + printf("Branch %s set up to track local ref %s.\n", + local, remote); + } } - else - strbuf_addf(&key, " ref %s", remote); - printf("Branch %s set up to track %s%s.\n", - local, key.buf, - rebasing ? " by rebasing" : ""); } - strbuf_release(&key); } /* -- 1.7.10.2.549.g9354186 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html