Skip to content

Commit

Permalink
revision: propagate flag bits from tags to pointees
Browse files Browse the repository at this point in the history
With the previous fix 895c5ba (revision: do not peel tags used in
range notation, 2013-09-19), handle_revision_arg() that processes
command line arguments for the "git log" family of commands no
longer directly places the object pointed by the tag in the pending
object array when it sees a tag object.  We used to place pointee
there after copying the flag bits like UNINTERESTING and
SYMMETRIC_LEFT.

This change meant that any flag that is relevant to later history
traversal must now be propagated to the pointed objects (most often
these are commits) while starting the traversal, which is partly
done by handle_commit() that is called from prepare_revision_walk().
We did propagate UNINTERESTING, but did not do so for others, most
notably SYMMETRIC_LEFT.  This caused "git log --left-right v1.0..."
(where "v1.0" is a tag) to start losing the "leftness" from the
commit the tag points at.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Jan 15, 2014
1 parent 2ac5e44 commit a743528
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
8 changes: 2 additions & 6 deletions revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object
return NULL;
die("bad object %s", sha1_to_hex(tag->tagged->sha1));
}
object->flags |= flags;
}

/*
Expand All @@ -284,7 +285,6 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object
if (parse_commit(commit) < 0)
die("unable to parse commit %s", name);
if (flags & UNINTERESTING) {
commit->object.flags |= UNINTERESTING;
mark_parents_uninteresting(commit);
revs->limited = 1;
}
Expand All @@ -302,7 +302,6 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object
if (!revs->tree_objects)
return NULL;
if (flags & UNINTERESTING) {
tree->object.flags |= UNINTERESTING;
mark_tree_contents_uninteresting(tree);
return NULL;
}
Expand All @@ -314,13 +313,10 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object
* Blob object? You know the drill by now..
*/
if (object->type == OBJ_BLOB) {
struct blob *blob = (struct blob *)object;
if (!revs->blob_objects)
return NULL;
if (flags & UNINTERESTING) {
blob->object.flags |= UNINTERESTING;
if (flags & UNINTERESTING)
return NULL;
}
add_pending_object(revs, object, "");
return NULL;
}
Expand Down
11 changes: 11 additions & 0 deletions t/t6000-rev-list-misc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,15 @@ test_expect_success 'propagate uninteresting flag down correctly' '
test_cmp expect actual
'

test_expect_success 'symleft flag bit is propagated down from tag' '
git log --format="%m %s" --left-right v1.0...master >actual &&
cat >expect <<-\EOF &&
> two
> one
< another
< that
EOF
test_cmp expect actual
'

test_done

0 comments on commit a743528

Please sign in to comment.