From: Liu Yubao <yubao.liu@gmail•com>
To: git@vger•kernel.org
Subject: [PATCH] clear error message for clone a gitweb URL
Date: Wed, 08 Nov 2006 15:25:01 +0800 [thread overview]
Message-ID: <4551864D.3010301@gmail.com> (raw)
When clone a gitweb URL, git reports "Can't lock ref", it's not clear for users,
this patch adds clear error message for this case.
diff --git a/fetch.c b/fetch.c
index c426c04..40c5183 100644
--- a/fetch.c
+++ b/fetch.c
@@ -266,6 +266,14 @@ int pull(int targets, char **target, con
if (!write_ref || !write_ref[i])
continue;
+ if (*write_ref[i] == '\0') {
+ if (strncmp(write_ref_log_details, "http", 4) == 0)
+ error("Can't feed empty ref, seems you are fetching from a gitweb URL, "
+ "check it in web browser for git URL.");
+ else
+ error("Can't feed empty ref");
+ goto unlock_and_fail;
+ }
lock[i] = lock_ref_sha1(write_ref[i], NULL);
if (!lock[i]) {
error("Can't lock ref %s", write_ref[i]);
diff --git a/git-clone.sh b/git-clone.sh
index 3f006d1..c8274e0 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -55,6 +55,10 @@ Perhaps git-update-server-info needs to
else
tname=$name
fi
+ if [ -z "$tname" -o -z "$name" ]; then
+ die "Cannot feed empty ref or commit-id, seems you are fetching
+from a gitweb URL, check it in web browser for git URL."
+ fi
git-http-fetch -v -a -w "$tname" "$name" "$1/" || exit 1
done <"$clone_tmp/refs"
next reply other threads:[~2006-11-08 7:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-08 7:25 Liu Yubao [this message]
2006-11-08 20:42 ` [PATCH] clear error message for clone a gitweb URL Junio C Hamano
2006-11-09 1:49 ` Liu Yubao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4551864D.3010301@gmail.com \
--to=yubao.liu@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox