Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-10-26 03:11:37 +0300
committerJunio C Hamano <gitster@pobox.com>2022-10-26 03:11:37 +0300
commit1155c8efbb152ecb5fb9e1414245f4ab637f37ab (patch)
treef25778e7a1344b38e74e9ff40259c98ad5617829 /builtin
parent48b754ddc0b8fad69e032d05bf79cfcab9c28000 (diff)
parente288b3de35eaaf3febe07cd56565d8e8af17fb1e (diff)
Merge branch 'jc/branch-description-unset' into maint-2.38
"GIT_EDITOR=: git branch --edit-description" resulted in failure, which has been corrected. * jc/branch-description-unset: branch: do not fail a no-op --edit-desc
Diffstat (limited to 'builtin')
-rw-r--r--builtin/branch.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/branch.c b/builtin/branch.c
index 55cd9a6e99..c570fdb1ca 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -599,10 +599,11 @@ static GIT_PATH_FUNC(edit_description, "EDIT_DESCRIPTION")
static int edit_branch_description(const char *branch_name)
{
+ int exists;
struct strbuf buf = STRBUF_INIT;
struct strbuf name = STRBUF_INIT;
- read_branch_desc(&buf, branch_name);
+ exists = !read_branch_desc(&buf, branch_name);
if (!buf.len || buf.buf[buf.len-1] != '\n')
strbuf_addch(&buf, '\n');
strbuf_commented_addf(&buf,
@@ -619,7 +620,8 @@ static int edit_branch_description(const char *branch_name)
strbuf_stripspace(&buf, 1);
strbuf_addf(&name, "branch.%s.description", branch_name);
- git_config_set(name.buf, buf.len ? buf.buf : NULL);
+ if (buf.len || exists)
+ git_config_set(name.buf, buf.len ? buf.buf : NULL);
strbuf_release(&name);
strbuf_release(&buf);