Thread (9 messages) 9 messages, 7 authors, 2016-06-15

Re: Can I fetch an arbitrary commit by sha1?

From: Duy Nguyen <hidden>
Date: 2016-06-15 23:02:39
Subsystem: the rest · Maintainer: Linus Torvalds

On Tue, Oct 07, 2014 at 07:34:36PM +0700, Duy Nguyen wrote:
If we can verify the asked sha-1 is reachable from the visible ref
set, then we should allow it. With pack bitmaps, it's getting much
cheaper to do such a test. If pack bitmaps are not used, we could
set a default/configurable limit, like not traversing more than 1000
commits from any ref for this reachability test).
Hmm.. Junio already did most of the work in 051e400 (helping
smart-http/stateless-rpc fetch race - 2011-08-05), so all we need to
do is enable uploadpack.allowtipsha1inwant and apply this patch

-- 8< --
diff --git a/upload-pack.c b/upload-pack.c
index c789ec0..493f8ee 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -454,10 +454,6 @@ static void check_non_tip(void)
 	char namebuf[42]; /* ^ + SHA-1 + LF */
 	int i;
 
-	/* In the normal in-process case non-tip request can never happen */
-	if (!stateless_rpc)
-		goto error;
-
 	cmd.argv = argv;
 	cmd.git_cmd = 1;
 	cmd.no_stderr = 1;
-- 8< --
If we already let smart-http do this, I don't see any harm in letting
git protocol do the same (even though it's the the original reason why
this code exists).
--
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help