[prev in list] [next in list] [prev in thread] [next in thread]
List: git
Subject: [PATCH/RFC v2 6/6] branch: don't copy or rename config when same branch name
From: Sahil Dua <sahildua2305 () gmail ! com>
Date: 2017-05-31 23:35:12
Message-ID: 0102015c60dcf6cf-b17cfda3-0d72-4271-a5ba-63e5db0af952-000000 () eu-west-1 ! amazonses ! com
[Download RAW message or body]
It doesn't make sense to trigger config section copy or rename method if
both the branch names are same.
For example - git branch -C a a
In such a case, it shouldn't try to copy or rename the git config
section.
Signed-off-by: Sahil Dua <sahildua2305@gmail.com>
---
builtin/branch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index f3cd180e8d4cb..df82f196a4bba 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -502,7 +502,7 @@ static void copy_or_rename_branch(const char *oldname, const char \
*newname, int strbuf_release(&oldref);
strbuf_addf(&newsection, "branch.%s", newref.buf + 11);
strbuf_release(&newref);
- if (git_config_copy_or_rename_section(oldsection.buf, newsection.buf, copy) < 0)
+ if (strcmp(oldname, newname) && git_config_copy_or_rename_section(oldsection.buf, \
newsection.buf, copy) < 0) die(_("Branch is %s, but update of config-file failed"),
(copy ? "copied" : "renamed"));
strbuf_release(&oldsection);
--
https://github.com/git/git/pull/363
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic