removing lines creates unnecessary diffs in saved pcb
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pcb |
New
|
Wishlist
|
Unassigned |
Bug Description
When you delete a line, there some code like (from memory):
list[victim] = list[--nlist];
that swaps the last element in to the hole generated by deleting 'victim'. That's great for efficiency, but since the saved output uses the array order for output, deleting a line creates extra text diffs where lines move in the file without changing.
It would be nice if simple edits like that also produced the "obvious" simple diff of deleting the one line from the output file.
Other than that, PCB's file format plays very well with source control.
One possible solution: Assign a sequence number to every line on load (in load order). Then all new object creation increments the sequence number. On save, the output order is the sequence number order. The sequence numbers themselves don't have to be saved or user visible, they just make it possible to keep the order.
Another possible solution: Define a sort order based on some existing parameter. Eg elements by refdes lexigraphically, lines by position on the pcb, etc. That would keep most of the benefit, although the first use of the PCB that did this would reorder the entire file.
Changed in geda-project: | |
importance: | Undecided → Wishlist |
Speaking of unnecessary diffs, perhaps there should be a setting to strip off UI flags like selectedflag and foundflag (and much to my surprise, rubberendflag!) which end up in files.