Taking just the diff
Taking just the diff
Posted Jan 17, 2025 9:04 UTC (Fri) by epa (subscriber, #39769)In reply to: Issue IDs by ewen
Parent article: The many names of commit 55039832f98c
Posted Jan 17, 2025 11:58 UTC (Fri)
by TomH (subscriber, #56149)
[Link] (6 responses)
Posted Jan 17, 2025 13:46 UTC (Fri)
by epa (subscriber, #39769)
[Link] (5 responses)
Posted Jan 17, 2025 13:54 UTC (Fri)
by geert (subscriber, #98403)
[Link] (4 responses)
Posted Jan 17, 2025 18:16 UTC (Fri)
by k3ninho (subscriber, #50375)
[Link] (2 responses)
The diff has end-result line numbers and expected text, you can test "does this line match this patch?" pretty cheaply. If the line number doesn't match up, the unified diff gives you three lines to find so you can check after and before the three lines following. Maybe the lines get split up, but that's a case that a tool can't work out intent.
K3n.
Posted Jan 17, 2025 18:47 UTC (Fri)
by mathstuf (subscriber, #69389)
[Link]
Posted Jan 18, 2025 8:41 UTC (Sat)
by epa (subscriber, #39769)
[Link]
Posted Jan 19, 2025 1:59 UTC (Sun)
by Heretic_Blacksheep (guest, #169992)
[Link]
A single unique ancestral id assigned strictly to committed content in which all children and cousin ids including changes to the ancestor are hard linked is preferable to systems where there can be confusion generated as to when, if, and why content may or may not have been integrated into the target work. Effectively what's needed in the kernel is a system in which all changes have such a unique content ID that can be referenced regardless of the sub project. The current system really doesn't appear to work in all cases at the scale the kernel is working at. And the DRM groups need to stop thinking they're independent of "downstream" kernel, when that's obviously a fiction. They're as dependent on kernel features just as the kernel is dependent on their features.
Posted Jan 18, 2025 11:00 UTC (Sat)
by em (subscriber, #91304)
[Link] (1 responses)
Posted Jan 18, 2025 21:17 UTC (Sat)
by epa (subscriber, #39769)
[Link]
(Another way to see whether a branch has been merged would be to look at the code and check the changes in the other branch are present in yours. This is what people sometimes had to resort to in older version control systems without change tracking, or which were not distributed, or indeed if they had no VCS at all. Both approaches have their advantages, but often we prefer the cleaner one based on explicitly tracking commit history.)
Now moving from whole branches to individual changes. You could try to work out whether a cherry-pick has been applied by looking at the current state of the code, or going back over the branch history to see if a similar-looking diff has been applied in the past. But as you say that falls down if there were conflicts or for other reasons the patch wasn’t applied exactly.
Instead, I suggest a metadata-based approach where you can create a “disembodied commit” which has a patch to apply but no ancestor commits. Merging this commit into your branch is usually simpler than merging a whole other branch, which may have unrelated changes (unless your programmers are very disciplined about always creating “daggy fixes” where the commit fixing a bug is an immediate child of the one that introduced it). Indeed merging this disembodied commit is the same as cherry-picking it, as far as the code goes. But unlike cherry-picking, the disembodied commit keeps the same SHA, and is now an ancestor of your branch. That would make it easy to ask “has this fix been applied?” without having to match the file contents, and even when the fix is only given as a text diff against some slightly different version of the codebase.
The SHA of the disembodied commit could be the hash of the original set of changes (or textual diff) but that same SHA would still be used even if you had to resolve conflicts on merging. Again, just as happens for regular branches and regular merges.
Taking just the diff
Taking just the diff
Taking just the diff
Taking just the diff
Taking just the diff
Taking just the diff
Taking just the diff
Taking just the diff
Taking just the diff