dolthub / dolthub/dolt

DOLT_DIFF three dot diff does not support WORKING

Open
#11,204 2 comments 0 reactions 0 assignees View on GitHub
customer issue enhancement version control
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 9h
Merged PRs (30d)
121

Description

I'm using `DOLT_DIFF` with the three-dot syntax to get a diff starting at the last common commit between two revisions.

```sql
SELECT * FROM DOLT_DIFF('foo...bar');
```

This works great, and also works with reserved identifiers such as `HEAD` based on the active branch:

```sql
CALL DOLT_CHECKOUT('some-branch');
SELECT * FROM DOLT_DIFF('HEAD...bar');
```

However, it does not similarly work for `WORKING`:

```sql
CALL DOLT_CHECKOUT('some-branch');
SELECT * FROM DOLT_DIFF('WORKING...bar');
```

> branch not found: WORKING

However, WORKING is recognised outside the three dot diff:

```sql
CALL DOLT_CHECKOUT('some-branch');
SELECT * FROM DOLT_DIFF('WORKING', 'bar');
```

... but that of course doesn't start from the last common commit.

My use case is that I would like to get the same diff as `HEAD...bar`, but including possible differences based on the working changes of the active branch, so I can also scan those for entities that have changed on both branches or revisions (so I can warn the user about potentially conflicting edits to the same tables).

Related to this, if I query tables such as `dolt_diff_airblocks`, they do show `WORKING` in the `to_commit` field, so Dolt already knows about these changes - that table unfortunately doesn't have the convenience of being able to select the three dot diff to start from the last common commit, though.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the DOLT_DIFF queries in the issue, then trace the DOLT_DIFF three-dot handling and compare it with the two-argument WORKING path. Done means WORKING...bar resolves the last common commit while retaining working changes, with regression coverage for the reported queries.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.