Skip to content

Commit 5032098

Browse files
committed
Merge branch 'jc/revision-range-unpeel' into maint
"git log --left-right A...B" lost the "leftness" of commits reachable from A when A is a tag as a side effect of a recent bugfix. This is a regression in 1.8.4.x series. * jc/revision-range-unpeel: revision: propagate flag bits from tags to pointees revision: mark contents of an uninteresting tree uninteresting
2 parents c337684 + a743528 commit 5032098

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

revision.c

+16-12
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,12 @@ static void mark_blob_uninteresting(struct blob *blob)
104104
blob->object.flags |= UNINTERESTING;
105105
}
106106

107-
void mark_tree_uninteresting(struct tree *tree)
107+
static void mark_tree_contents_uninteresting(struct tree *tree)
108108
{
109109
struct tree_desc desc;
110110
struct name_entry entry;
111111
struct object *obj = &tree->object;
112112

113-
if (!tree)
114-
return;
115-
if (obj->flags & UNINTERESTING)
116-
return;
117-
obj->flags |= UNINTERESTING;
118113
if (!has_sha1_file(obj->sha1))
119114
return;
120115
if (parse_tree(tree) < 0)
@@ -142,6 +137,18 @@ void mark_tree_uninteresting(struct tree *tree)
142137
free_tree_buffer(tree);
143138
}
144139

140+
void mark_tree_uninteresting(struct tree *tree)
141+
{
142+
struct object *obj = &tree->object;
143+
144+
if (!tree)
145+
return;
146+
if (obj->flags & UNINTERESTING)
147+
return;
148+
obj->flags |= UNINTERESTING;
149+
mark_tree_contents_uninteresting(tree);
150+
}
151+
145152
void mark_parents_uninteresting(struct commit *commit)
146153
{
147154
struct commit_list *parents = NULL, *l;
@@ -276,6 +283,7 @@ static struct commit *handle_commit(struct rev_info *revs,
276283
return NULL;
277284
die("bad object %s", sha1_to_hex(tag->tagged->sha1));
278285
}
286+
object->flags |= flags;
279287
}
280288

281289
/*
@@ -287,7 +295,6 @@ static struct commit *handle_commit(struct rev_info *revs,
287295
if (parse_commit(commit) < 0)
288296
die("unable to parse commit %s", name);
289297
if (flags & UNINTERESTING) {
290-
commit->object.flags |= UNINTERESTING;
291298
mark_parents_uninteresting(commit);
292299
revs->limited = 1;
293300
}
@@ -305,7 +312,7 @@ static struct commit *handle_commit(struct rev_info *revs,
305312
if (!revs->tree_objects)
306313
return NULL;
307314
if (flags & UNINTERESTING) {
308-
mark_tree_uninteresting(tree);
315+
mark_tree_contents_uninteresting(tree);
309316
return NULL;
310317
}
311318
add_pending_object(revs, object, "");
@@ -316,13 +323,10 @@ static struct commit *handle_commit(struct rev_info *revs,
316323
* Blob object? You know the drill by now..
317324
*/
318325
if (object->type == OBJ_BLOB) {
319-
struct blob *blob = (struct blob *)object;
320326
if (!revs->blob_objects)
321327
return NULL;
322-
if (flags & UNINTERESTING) {
323-
mark_blob_uninteresting(blob);
328+
if (flags & UNINTERESTING)
324329
return NULL;
325-
}
326330
add_pending_object(revs, object, "");
327331
return NULL;
328332
}

t/t6000-rev-list-misc.sh

+17
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,21 @@ test_expect_success 'rev-list A..B and rev-list ^A B are the same' '
5656
test_cmp expect actual
5757
'
5858

59+
test_expect_success 'propagate uninteresting flag down correctly' '
60+
git rev-list --objects ^HEAD^{tree} HEAD^{tree} >actual &&
61+
>expect &&
62+
test_cmp expect actual
63+
'
64+
65+
test_expect_success 'symleft flag bit is propagated down from tag' '
66+
git log --format="%m %s" --left-right v1.0...master >actual &&
67+
cat >expect <<-\EOF &&
68+
> two
69+
> one
70+
< another
71+
< that
72+
EOF
73+
test_cmp expect actual
74+
'
75+
5976
test_done

0 commit comments

Comments
 (0)