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

[PATCH] git-clone: Error meaningfully on failed HTTP fetches of HEAD

From
MLMartin Langhoff <martin@catalyst.net.nz>
Date
Apr 11, 2007, 22:05 UTC
Message-ID
<11763291192402-git-send-email-martin@catalyst.net.nz>

A common problem when cloning over http is that the repo has a symlink for HEAD, and apache refuses to serve symlinks by default.

Without this patch, the clone succeeds as a "bare" and "HEADless" clone, but does not give any indication that things have gone wrong.

A bare clone that fails to fetch HEAD will still complete "successfully". I'm not sure if that's expected/desired. Is a HEADless repo valid in any situation?

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
---
 git-clone.sh |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/git-clone.sh b/git-clone.sh
index 513b574..ef8cd26 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -65,6 +65,11 @@ Perhaps git-update-server-info needs to be run there?"
 	rm -fr "$clone_tmp"
 	http_fetch "$1/HEAD" "$GIT_DIR/REMOTE_HEAD" ||
 	rm -f "$GIT_DIR/REMOTE_HEAD"
+
+	if test -z "$bare" && test ! -f "$GIT_DIR/REMOTE_HEAD"
+	then
+		die "Could not retrieve $1/HEAD - perhaps it is a symlink?"
+	fi
 }
 
 quiet=
-- 
1.5.1.106.ga32037
Next: Junio C Hamano
Message 1 of 4 in “git-clone: Error meaningfully on failed HTTP fetches of HEAD”
  1. git-clone: Error meaningfully on failed HTTP fetches of HEADMartin Langhoff, Apr 11, 2007
  2. Junio C HamanoApr 12, 2007
  3. Martin LanghoffApr 12, 2007
  4. Junio C HamanoApr 12, 2007

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.