Re: [PATCH v3] object-name: fix reversed ordering with ":/<PATTERN>" revisions
- From
René Scharfe <l.s.r@web.de>
- Date
- Dec 9, 2024, 11:47 UTC
- Message-ID
- <4c8604c2-4287-48dd-b1ec-78ba9c1401f0@web.de>
- In-Reply-To
- <20241206-pks-rev-parse-fix-reversed-list-v3-1-d934c17db168@pks.im>
Am 06.12.24 um 16:45 schrieb Patrick Steinhardt:
Show 6 quoted lines
> @@ -1423,7 +1423,7 @@ static int get_oid_oneline(struct repository *r,
>
> for (l = list; l; l = l->next) {
> l->item->object.flags |= ONELINE_SEEN;
> - commit_list_insert(l->item, ©);
> + copy_tail = &commit_list_insert(l->item, copy_tail)->next;OK. The following does the same while being clearer:
copy_tail = commit_list_append(l->item, copy_tail);
You could get the idea to do that replacement across the whole source tree. That would be nice, but must not be done blindly (e.g. with Coccinelle), as the result will be different if the second argument can point to somewhere in the middle of the list. Here it's OK because we indeed are appending (invariant *copy_tail == NULL holds).
René