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

Re: Clone fails on a repo with too many heads/tags

From
ITIvan Todoroski <grnch_lists@gmx.net>
Date
Mar 24, 2012, 20:49 UTC
Message-ID
<4F6E3373.7090500@gmx.net>
In-Reply-To
<20120321201722.GA15021@sigill.intra.peff.net>
On 21.03.2012 21:17, Jeff King wrote:
Show 26 quoted lines
> On Wed, Mar 21, 2012 at 09:02:13PM +0100, Ivan Todoroski wrote:
> 
>>> Something in me feels slightly uncomfortable with that, just because
>>> simple newline-delimited formats make it easy for people to hack on the
>>> tool and feed input from unexpected sources.
>> I understand what you mean. How about this:
>>
>> If both --stdin and --stateless-rpc are specified to fetch-pack, it
>> will use pkt-line to read the refs from stdin before handing off
>> stdin to get_remote_heads().
>>
>> However, if only --stdin is specified, it will read refs from stdin
>> in a script-friendly newline delimited format, one ref per line. This
>> is okay because when --stateless-rpc is not specified
>> get_remote_heads() reads from an fd different from stdin so there is
>> no issue with residual buffers in this case.
>>
>> This way you preserve scriptability for any other callers who don't
>> use --stateless-rpc.
>>
>> How does this sound?
> 
> I think that sounds quite reasonable, and shouldn't be more than a few
> extra lines to implement.
> 
> -Peff

I wrote the code for this and went to write the test cases, but the test suite is not cooperating. :(

I'll send just the code changes for comments while I'm figuring out the test suite. I'll include the test cases along with better commit messages in the next version of the patches.

So, back to the test suite problem. To get familiar with it I first ran the test suite against the vanilla "maint" branch without any of my changes, just to see what I should expect on properly running code.

Unfortunately it failed, and to make matters worse it failed exactly on the parts dealing with smart HTTP, which is what I need to test in the first place. Talk about Murphy's law...

Is it failing for anyone else on the vanilla "maint" branch? I would appreciate any help I could get here.

My machine is CentOS 5.8 with latest updates and I have the httpd package installed. Here is the command that is failing (you can find the full output in the attachment):

$ GIT_TEST_HTTPD=yes ./t5551-http-fetch.sh -i -v [... skip successful tests ...] ok 5 - used upload-pack service

expecting success:
         git clone $HTTPD_URL/smart-redir-perm/repo.git --quiet repo-p

error: RPC failed; result=22, HTTP code = 405 fatal: The remote end hung up unexpectedly not ok - 6 follow redirects (301) # # git clone $HTTPD_URL/smart-redir-perm/repo.git --quiet repo-p #

Initialized empty Git repository in /home/itodoroski/git/t/trash directory.t5551-http-fetch/.git/
expecting success: 
	echo content >file &&
	git add file &&
	git commit -m one
[master (root-commit) ba36540] one
 Author: A U Thor <author@example.com>
 1 file changed, 1 insertion(+)
 create mode 100644 file
ok 1 - setup repository
expecting success: 
	mkdir "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
	(cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
	 git --bare init
	) &&
	git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
	git push public master:master
Initialized empty Git repository in /home/itodoroski/git/t/trash directory.t5551-http-fetch/httpd/www/repo.git/
To /home/itodoroski/git/t/trash directory.t5551-http-fetch/httpd/www/repo.git
 * [new branch]      master -> master
ok 2 - create http-accessible bare repository
expecting success: 
	GIT_CURL_VERBOSE=1 git clone --quiet $HTTPD_URL/smart/repo.git clone 2>err &&
	test_cmp file clone/file &&
	tr '\015' Q <err |
	sed -e "
		s/Q\$//
		/^[*] /d
		/^$/d
		/^< $/d
		/^[^><]/{
			s/^/> /
		}
		/^> User-Agent: /d
		/^> Host: /d
		/^> POST /,$ {
			/^> Accept: [*]\\/[*]/d
		}
		s/^> Content-Length: .*/> Content-Length: xxx/
		/^> 00..want /d
		/^> 00.*done/d
		/^< Server: /d
		/^< Expires: /d
		/^< Date: /d
		/^< Content-Length: /d
		/^< Transfer-Encoding: /d
	" >act &&
	test_cmp exp act
ok 3 - clone http repository
expecting success: 
	echo content >>file &&
	git commit -a -m two &&
	git push public
	(cd clone && git pull) &&
	test_cmp file clone/file
[master ace4881] two
 Author: A U Thor <author@example.com>
 1 file changed, 1 insertion(+)
To /home/itodoroski/git/t/trash directory.t5551-http-fetch/httpd/www/repo.git
   ba36540..ace4881  master -> master
From http://127.0.0.1:5551/smart/repo
   ba36540..ace4881  master     -> origin/master
Updating ba36540..ace4881
Fast-forward
 file |    1 +
 1 file changed, 1 insertion(+)
ok 4 - fetch changes via http
expecting success: 
	sed -e "
		s/^.* \"//
		s/\"//
		s/ [1-9][0-9]*\$//
		s/^GET /GET  /
	" >act <"$HTTPD_ROOT_PATH"/access.log &&
	test_cmp exp act
ok 5 - used upload-pack service
expecting success: 
	git clone $HTTPD_URL/smart-redir-perm/repo.git --quiet repo-p

error: RPC failed; result=22, HTTP code = 405 fatal: The remote end hung up unexpectedly not ok - 6 follow redirects (301) # # git clone $HTTPD_URL/smart-redir-perm/repo.git --quiet repo-p #

Previous: Jeff KingNext: Jeff King
Message 19 of 54 in “Clone fails on a repo with too many heads/tags”
  1. Ivan TodoroskiMar 18, 2012
  2. Ivan TodoroskiMar 18, 2012
  3. Nguyen Thai Ngoc DuyMar 18, 2012
  4. Jakub NarebskiMar 18, 2012
  5. Jeff KingMar 18, 2012
  6. Jakub NarebskiMar 18, 2012
  7. Jeff KingMar 19, 2012
  8. Nguyen Thai Ngoc DuyMar 19, 2012
  9. Jeff KingMar 19, 2012
  10. Ivan TodoroskiMar 19, 2012
  11. Nguyen Thai Ngoc DuyMar 19, 2012
  12. Jeff KingMar 19, 2012
  13. Ivan TodoroskiMar 21, 2012
  14. Shawn PearceMar 21, 2012
  15. Jeff KingMar 21, 2012
  16. Jakub NarebskiMar 21, 2012
  17. Ivan TodoroskiMar 21, 2012
  18. Jeff KingMar 21, 2012
  19. Ivan TodoroskiMar 24, 2012
  20. Jeff KingMar 25, 2012
  21. Jeff KingMar 25, 2012
  22. Ivan TodoroskiMar 25, 2012
  23. Ivan TodoroskiMar 25, 2012
  24. Jeff KingMar 26, 2012
  25. Ivan TodoroskiMar 27, 2012
  26. Ivan TodoroskiMar 25, 2012
  27. 1/2 fetch-pack: new option to read refs from stdinIvan Todoroski, Mar 24, 2012
  28. Jeff KingMar 25, 2012
  29. Ivan TodoroskiMar 25, 2012
  30. Ivan TodoroskiMar 25, 2012
  31. Ivan TodoroskiMar 25, 2012
  32. Jeff KingMar 26, 2012
  33. Ivan TodoroskiMar 26, 2012
  34. Jeff KingMar 26, 2012
  35. 2/2 remote-curl: send the refs to fetch-pack on stdinIvan Todoroski, Mar 24, 2012
  36. Jeff KingMar 25, 2012
  37. Ivan TodoroskiMar 25, 2012
  38. Jeff KingMar 26, 2012
  39. 0/4 Fix fetch-pack command line overflow during cloneIvan Todoroski, Mar 27, 2012
  40. 1/4 fetch-pack: new --stdin option to read refs from stdinIvan Todoroski, Mar 27, 2012
  41. Junio C HamanoMar 27, 2012
  42. Ivan TodoroskiMar 27, 2012
  43. Junio C HamanoMar 27, 2012
  44. Ivan TodoroskiMar 27, 2012
  45. 2/4 remote-curl: send the refs to fetch-pack on stdinIvan Todoroski, Mar 27, 2012
  46. Junio C HamanoMar 27, 2012
  47. Ivan TodoroskiMar 27, 2012
  48. 3/4 fetch-pack: test cases for the new --stdin optionIvan Todoroski, Mar 27, 2012
  49. Junio C HamanoMar 27, 2012
  50. Ivan TodoroskiMar 27, 2012
  51. Junio C HamanoMar 27, 2012
  52. Ivan TodoroskiMar 28, 2012
  53. 4/4 remote-curl: main test case for the OS command line overflowIvan Todoroski, Mar 27, 2012
  54. Junio C HamanoMar 27, 2012

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.