All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Glen Choo via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Jeff King <peff@peff.net>,
	"Ing. Martin Prantl Ph.D." <perry@ntis.zcu.cz>,
	Glen Choo <chooglen@google.com>
Subject: [PATCH 0/2] remote.c: reject 0-length branch names
Date: Tue, 31 May 2022 23:12:32 +0000	[thread overview]
Message-ID: <pull.1273.git.git.1654038754.gitgitgadget@gmail.com> (raw)

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

             reply	other threads:[~2022-05-31 23:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31 23:12 Glen Choo via GitGitGadget [this message]
2022-05-31 23:12 ` [PATCH 1/2] remote.c: don't BUG() on 0-length branch names Glen Choo via GitGitGadget
2022-06-08 23:27   ` Jeff King
2022-05-31 23:12 ` [PATCH 2/2] remote.c: reject " Glen Choo via GitGitGadget
2022-06-01  7:30   ` Ævar Arnfjörð Bjarmason
2022-06-01 16:55     ` Glen Choo
2022-06-01 21:21       ` Junio C Hamano
2022-06-08 23:24       ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1273.git.git.1654038754.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=chooglen@google.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=perry@ntis.zcu.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.