Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-10-20 09:48:16 +0400
committerJunio C Hamano <junkio@cox.net>2005-10-20 09:49:31 +0400
commit6e1c6c103c522d01829f3a63992a023ff031e851 (patch)
tree50f9bed9a78e1f51178ebf6be3cd9c20b2ffcb0b /sha1_name.c
parentf1f0a2be9fe6e6734d900381de189c56e023be7e (diff)
Make sure we barf on ref^{type} failure.
Martin Langhoff noticed that ref^0 barfed correctly when we did not have the commit in a broken repository, but ref^{commit} didn't. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sha1_name.c b/sha1_name.c
index 75c688ecf2..cc320d3d7f 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -323,6 +323,8 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
return -1;
if (!type_string) {
o = deref_tag(o);
+ if (!o || (!o->parsed && !parse_object(o->sha1)))
+ return -1;
memcpy(sha1, o->sha1, 20);
}
else {
@@ -332,7 +334,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
*/
while (1) {
- if (!o)
+ if (!o || (!o->parsed && !parse_object(o->sha1)))
return -1;
if (o->type == type_string) {
memcpy(sha1, o->sha1, 20);