summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a3eb250)
raw | patch | inline | side by side (parent: a3eb250)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 11 Jul 2005 06:55:56 +0000 (23:55 -0700) | ||
committer | Linus Torvalds <torvalds@g5.osdl.org> | |
Mon, 11 Jul 2005 17:13:09 +0000 (10:13 -0700) |
When we allow a tag object in place of a commit object, we only
dereferenced the given tag once, which causes a tag that points at a tag
that points at a commit to be rejected. Instead, dereference tag
repeatedly until we get a non-tag.
This patch makes change to two functions:
- commit.c::lookup_commit_reference() is used by merge-base,
rev-tree and rev-parse to convert user supplied SHA1 to that of
a commit.
- rev-list uses its own get_commit_reference() to do the same.
Dereferencing tags this way helps both of these uses.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
dereferenced the given tag once, which causes a tag that points at a tag
that points at a commit to be rejected. Instead, dereference tag
repeatedly until we get a non-tag.
This patch makes change to two functions:
- commit.c::lookup_commit_reference() is used by merge-base,
rev-tree and rev-parse to convert user supplied SHA1 to that of
a commit.
- rev-list uses its own get_commit_reference() to do the same.
Dereferencing tags this way helps both of these uses.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
commit.c | patch | blob | history | |
rev-list.c | patch | blob | history |
diff --git a/commit.c b/commit.c
index 0bbfa2ab31917e2a7584b0267c04f3324fad28d9..caee5bc218f6db03ec4c8f16f39b892ebb7c762c 100644 (file)
--- a/commit.c
+++ b/commit.c
if (!obj)
return NULL;
- if (obj->type == tag_type)
- obj = ((struct tag *)obj)->tagged;
+ while (obj->type == tag_type)
+ obj = parse_object(((struct tag *)obj)->tagged->sha1);
+
return check_commit(obj, sha1);
}
diff --git a/rev-list.c b/rev-list.c
index 0c0bdc2fd87cb99aa988f2ed68621aaa1a392013..fdb531caf6db4944f0612258697670eb00bc55ce 100644 (file)
--- a/rev-list.c
+++ b/rev-list.c
@@ -367,12 +367,12 @@ static struct commit *get_commit_reference(const char *name, unsigned int flags)
/*
* Tag object? Look what it points to..
*/
- if (object->type == tag_type) {
+ while (object->type == tag_type) {
struct tag *tag = (struct tag *) object;
object->flags |= flags;
if (tag_objects && !(object->flags & UNINTERESTING))
add_pending_object(object, tag->tag);
- object = tag->tagged;
+ object = parse_object(tag->tagged->sha1);
}
/*