summaryrefslogtreecommitdiff
path: root/git-gui/lib/browser.tcl
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-09-30 11:06:22 -0700
committerJunio C Hamano <gitster@pobox.com>2022-09-30 11:13:51 -0700
commite288b3de35eaaf3febe07cd56565d8e8af17fb1e (patch)
tree6079d7a861d099c4ff3936db8b8e98a2ea0c2d26 /git-gui/lib/browser.tcl
parent88b7be68a4bf9f39b84ed438d8d776c0d752b316 (diff)
branch: do not fail a no-op --edit-desc
Imagine running "git branch --edit-description" while on a branch without the branch description, and then exit the editor after emptying the edit buffer, which is the way to tell the command that you changed your mind and you do not want the description after all. The command should just happily oblige, adding no branch description for the current branch, and exit successfully. But it fails to do so: $ git init -b main $ git commit --allow-empty -m commit $ GIT_EDITOR=: git branch --edit-description fatal: could not unset 'branch.main.description' The end result is OK in that the configuration variable does not exist in the resulting repository, but we should do better. If we know we didn't have a description, and if we are asked not to have a description by the editor, we can just return doing nothing. This of course introduces TOCTOU. If you add a branch description to the same branch from another window, while you had the editor open to edit the description, and then exit the editor without writing anything there, we'd end up not removing the description you added in the other window. But you are fooling yourself in your own repository at that point, and if it hurts, you'd be better off not doing so ;-). Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-gui/lib/browser.tcl')
0 files changed, 0 insertions, 0 deletions