dolt icon indicating copy to clipboard operation
dolt copied to clipboard

Cross Merges don't render correctly in `dolt log --graph`

Open macneale4 opened this issue 7 months ago • 1 comments

Using the following script to create data and commits, the view printed by dolt log --graph brA brB brC doesn't show the fact that there is a cross merge between A and B. Attached to the issue is the graphviz representation of this graph.

CREATE TABLE A (pk INT PRIMARY KEY);
CREATE TABLE B (pk INT PRIMARY KEY);
CREATE TABLE C (pk INT PRIMARY KEY);
CALL DOLT_COMMIT('-Am', 'empty tables');
CALL DOLT_CHECKOUT('-b', 'brA', 'main');
INSERT INTO A VALUES (1),(2),(3);
CALL DOLT_COMMIT('-am', 'insert into A while on brA');
CALL DOLT_CHECKOUT('-b', 'brB', 'main');
INSERT INTO B VALUES (10),(20),(30);
CALL DOLT_COMMIT('-am', 'insert into B while on brB');
CALL DOLT_CHECKOUT('-b', 'brC', 'brB');
INSERT INTO C VALUES (100),(200),(300);
CALL DOLT_COMMIT('-am', 'insert into C while on brC');
CALL DOLT_CHECKOUT('brA');
SET @A_initial = (SELECT DOLT_HASHOF('HEAD'));
CALL DOLT_MERGE('--no-ff', 'brB');
CALL DOLT_CHECKOUT('brB');
CALL DOLT_MERGE('--no-ff', @A_initial);
$ dolt log --graph brA brB brC
*   commit 91ibt5633u32cpeb366knqlsv3n26jlt(brB)
|\  Merge: pbbc2c18e9grgikvq9k0tbhhmct1ltdv gdhhot2n64tcpbhm1ungom6mjaimeel9
| | Author: root <root@localhost>
| | Date: Mon May 19 11:53:09 -0700 2025
| |
| |     Merge branch 'gdhhot2n64tcpbhm1ungom6mjaimeel9' into brB
| |
| * commit e7ovtovs41p9fnuc5anbliep3dlnbsqq(brA)
| | Merge: gdhhot2n64tcpbhm1ungom6mjaimeel9 pbbc2c18e9grgikvq9k0tbhhmct1ltdv
| | Author: root <root@localhost>
| | Date: Mon May 19 11:53:09 -0700 2025
| |
| |     Merge branch 'brB' into brA
| |
| | * commit sqi866cmq1neveh9enc58br14goqn4th(brC)
| | | Author: root <root@localhost>
| | | Date: Mon May 19 11:53:09 -0700 2025
| |/
| /     insert into C while on brC
|/|
* | commit pbbc2c18e9grgikvq9k0tbhhmct1ltdv
| | Author: root <root@localhost>
| | Date: Mon May 19 11:53:09 -0700 2025
| |
| |     insert into B while on brB
| |
| * commit gdhhot2n64tcpbhm1ungom6mjaimeel9
| | Author: root <root@localhost>
| | Date: Mon May 19 11:53:09 -0700 2025
| |
| |     insert into A while on brA
|/
* commit nqtjb4obq9fqe19pdkcrqsusqig7e6o9(HEAD -> main)
| Author: root <root@localhost>
| Date: Mon May 19 11:53:09 -0700 2025
|
|       empty tables
|
* commit 70g621fsrtnu6jbdqofhtfgdfq7jmlma
  Author: macneale <[email protected]>
  Date: Mon May 19 11:52:59 -0700 2025

        Initialize data repository

macneale4 avatar May 19 '25 18:05 macneale4

The text representation doesn't show that commit gdhhot2n64tcpbhm1ungom6mjaimeel9 has two children.

Also, e7ovtovs41p9fnuc5anbliep3dlnbsqq is a merge, but it only has one parent.

Image

macneale4 avatar May 19 '25 18:05 macneale4