From: "Johannes Löthberg" <johannes@kyriasis.com>
To: git@vger.kernel.org
Cc: "Johannes Löthberg" <johannes@kyriasis.com>
Subject: [PATCH v2] upload-pack: Fail if cloning empty namespace
Date: Sat, 13 Jun 2015 00:17:16 +0200 [thread overview]
Message-ID: <1434147436-21272-1-git-send-email-johannes@kyriasis.com> (raw)
In-Reply-To: <1434140115-3139-1-git-send-email-johannes@kyriasis.com>
Git should fail to clone if trying to clone from an non-existing
ref namespace, since it's the same as a non-existing repository
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
---
Changes since v1:
* Fixed the namespace check, since I apparently forgot to check with a
bare repo in my last test. D'oh.
Two other options for this would be to either add a
get_git_namespace_len() function and use that, or a is_namespaced()
functon. But since it's only used here for now at least it feels simpler
to not bloat the codabase with another function which has no other use.
upload-pack.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/upload-pack.c b/upload-pack.c
index 89e832b..99fb271 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -778,6 +778,10 @@ static void upload_pack(void)
head_ref_namespaced(find_symref, &symref);
+ if (strcmp(get_git_namespace(), "") && !symref.items) {
+ die("git upload-pack: tried to clone from empty namespace");
+ }
+
if (advertise_refs || !stateless_rpc) {
reset_timeout();
head_ref_namespaced(send_ref, &symref);
--
2.4.2
next prev parent reply other threads:[~2015-06-12 22:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-12 20:15 [PATCH/RFC] upload-pack: Fail if cloning empty namespace Johannes Löthberg
2015-06-12 21:01 ` Junio C Hamano
2015-06-12 22:17 ` Johannes Löthberg [this message]
2015-06-12 22:32 ` [PATCH v2] " Johannes Löthberg
2015-06-15 20:49 ` Junio C Hamano
2015-06-20 14:27 ` Johannes Löthberg
2015-06-20 18:06 ` Junio C Hamano
2015-06-20 18:13 ` Johannes Löthberg
2015-06-20 21:20 ` Junio C Hamano
2015-06-20 21:49 ` Johannes Löthberg
2015-06-21 18:43 ` Junio C Hamano
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=1434147436-21272-1-git-send-email-johannes@kyriasis.com \
--to=johannes@kyriasis.com \
--cc=git@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).