[PATCH v2 3/4] bug: denyCurrentBranch and unborn branch with ref namespace
- From
- Hariom Verma via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Feb 22, 2020, 22:35 UTC
- Message-ID
- <b3e573d44a99a828e710f06b723942107189afeb.1582410908.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.535.v2.git.1582410908.gitgitgadget@gmail.com>
From: Hariom Verma <hariom18599@gmail.com>
git supports an interesting feature 'Git namespaces' that allows dividing the refs of a single repository into multiple namespaces, each of which has its own branches, tags, and HEAD. But unfortunately, there exists a bug in `denyCurrentBranch` which allows pushing into a non-bare repository using a ref namespace even if it does not have any commits
Here is a nice and short demonstration of that bug.
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Hariom Verma <hariom18599@gmail.com> --- t/t5509-fetch-push-namespaces.sh | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/t/t5509-fetch-push-namespaces.sh b/t/t5509-fetch-push-namespaces.sh index e3975bd21de..c89483fdba2 100755 --- a/t/t5509-fetch-push-namespaces.sh +++ b/t/t5509-fetch-push-namespaces.sh @@ -152,4 +152,13 @@ test_expect_success 'clone chooses correct HEAD (v2)' ' test_cmp expect actual ' +test_expect_failure 'denyCurrentBranch and unborn branch with ref namespace' ' + cd original && + git init unborn && + git remote add unborn-namespaced "ext::git --namespace=namespace %s unborn" && + test_must_fail git push unborn-namespaced HEAD:master && + test_config -C unborn receive.denyCurrentBranch updateInstead && + git push unborn-namespaced HEAD:master +' + test_done
-- gitgitgadget