{"thread":{"id":"7625","subject":"[PATCH] git-clone: Better handling of failed fetches of HEAD over HTTP","startedAt":"2007-04-12T09:25:33Z","lastAt":"2007-04-12T11:38:30Z","messageCount":2,"participants":["Martin Langhoff","Karl Hasselström"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"39209","messageId":"11763699332101-git-send-email-martin@catalyst.net.nz","threadId":"7625","inReplyTo":null,"subject":"[PATCH] git-clone: Better handling of failed fetches of HEAD over HTTP","fromName":"Martin Langhoff","fromEmail":"martin@catalyst.net.nz","sentAt":"2007-04-12T09:25:33Z","receivedAt":"2007-04-12T09:25:33Z","isPatch":true,"sender":{"key":"martin@laptop.org","avatar":null},"body":"Junio said:\n> Why not default to 'master' (if found) and issue a warning?\n\nA common problem when cloning over http is that the repo has\na symlink for HEAD, and apache refuses to serve symlinks by\ndefault.\n\nWith this patch, the clone will fallback to trying to get\nrefs/heads/master -- which often works. If it cannot get\nHEAD or refs/heads/master, then it will die, aborting the clone.\n\nSigned-off-by: Martin Langhoff <martin@catalyst.net.nz>\n---\n git-clone.sh |    9 ++++++++-\n 1 files changed, 8 insertions(+), 1 deletions(-)\n\ndiff --git a/git-clone.sh b/git-clone.sh\nindex 513b574..e98e064 100755\n--- a/git-clone.sh\n+++ b/git-clone.sh\n@@ -64,7 +64,14 @@ Perhaps git-update-server-info needs to be run there?\"\n \tdone <\"$clone_tmp/refs\"\n \trm -fr \"$clone_tmp\"\n \thttp_fetch \"$1/HEAD\" \"$GIT_DIR/REMOTE_HEAD\" ||\n-\trm -f \"$GIT_DIR/REMOTE_HEAD\"\n+\t\t(echo \"Could not get \"$1/HEAD\", perhaps it is a symlink: trying with refs/heads/master\" &&\n+\t\thttp_fetch \"$1/refs/heads/master\" \"$GIT_DIR/REMOTE_HEAD\") ||\n+\t\trm -f \"$GIT_DIR/REMOTE_HEAD\"\n+\n+\tif test ! -f \"$GIT_DIR/REMOTE_HEAD\"\n+\tthen\n+\t\tdie \"Could not retrieve $1/HEAD nor $1/refs/heads/master .\"\n+\tfi\n }\n \n quiet=\n-- \n1.5.1.106.ga32037\n"},{"id":"39215","messageId":"20070412113830.GA26445@diana.vm.bytemark.co.uk","threadId":"7625","inReplyTo":"11763699332101-git-send-email-martin@catalyst.net.nz","subject":"Re: [PATCH] git-clone: Better handling of failed fetches of HEAD over HTTP","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-04-12T11:38:30Z","receivedAt":"2007-04-12T11:38:30Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-04-12 21:25:33 +1200, Martin Langhoff wrote:\n\n> +\t\tdie \"Could not retrieve $1/HEAD nor $1/refs/heads/master .\"\n\nThe \"nor\" should be just \"or\", I believe. Otherwise, this would have\nto be\n\n  Could retrieve neither foo nor bar.\n\nwhich sounds a bit too formal. But a native English speaker should\nprobably verify that my advice is correct.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"}]}