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

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git@...>, <junkio@...>
Cc: Martin Langhoff <martin@...>
Date: Wednesday, April 11, 2007 - 6:05 pm

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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] git-clone: Error meaningfully on failed HTTP fetches..., Martin Langhoff, (Wed Apr 11, 6:05 pm)