git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/2] remote.c: reject 0-length branch names

From
Glen Choo via GitGitGadget <gitgitgadget@gmail.com>
Date
May 31, 2022, 23:12 UTC
Message-ID
<pull.1273.git.git.1654038754.gitgitgadget@gmail.com>

This fixes the regression reported in [1], where Git may fail if it encounters multiple "branch." keys with no subsection, e.g.

[branch ""] remote = foo merge = bar

Prior to 4a2dcb1a08 (remote: die if branch is not found in repository, 2021-11-17), we silently ignored such keys. But that commit had an inconsistency in how we read and write to the branches hash map, causing us to BUG() (see Patch 1/2 for more details).

This small series does two things
 * Fix the inconsistency in 4a2dcb1a08 that caused the bug.
 * Make Git fail if we find such keys (because we'll never use them anyway).
[1] https://lore.kernel.org/git/24f547-6285e280-59-40303580@48243747
Glen Choo (2):
  remote.c: don't BUG() on 0-length branch names
  remote.c: reject 0-length branch names
 remote.c              | 10 ++++++----
 t/t5516-fetch-push.sh | 20 ++++++++++++++++++++
 2 files changed, 26 insertions(+), 4 deletions(-)
base-commit: f9b95943b68b6b8ca5a6072f50a08411c6449b55
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1273%2Fchooglen%2Fremote%2Fhandle-0-length-branch-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1273/chooglen/remote/handle-0-length-branch-v1
Pull-Request: https://github.com/git/git/pull/1273
-- 
gitgitgadget
Next: Glen Choo via GitGitGadget
Message 1 of 8 in “remote.c: reject 0-length branch names”
  1. 0/2 remote.c: reject 0-length branch namesGlen Choo via GitGitGadget, May 31, 2022
  2. 1/2 remote.c: don't BUG() on 0-length branch namesGlen Choo via GitGitGadget, May 31, 2022
  3. Jeff KingJun 8, 2022
  4. 2/2 remote.c: reject 0-length branch namesGlen Choo via GitGitGadget, May 31, 2022
  5. Ævar Arnfjörð BjarmasonJun 1, 2022
  6. Glen ChooJun 1, 2022
  7. Junio C HamanoJun 1, 2022
  8. Jeff KingJun 8, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.