Skip to content

Conversation

@ssam18
Copy link

@ssam18 ssam18 commented Dec 18, 2025

Problem

When comparing a branch with an ancestor commit (where source == base), the CompareValueIterator was filtering out all changes that were 'added on destination', resulting in empty diff results.

This caused:

  • lakectl branch revert to return 'no changes' error even when there were actual differences
  • lakectl diff to return empty results when comparing with an ancestor tag/commit

Solution

Added a short-circuit in the Compare function: when source == base (i.e., comparing with an ancestor), return the raw diff iterator directly instead of wrapping it in CompareValueIterator which filters results.

When source equals base, the three-way comparison degenerates to a two-way diff, so the filtering logic is inappropriate.

Changes

  • pkg/graveler/committed/manager.go: Added check for source == base case in Compare function
  • pkg/graveler/committed/manager_test.go: Added TestManager_CompareSourceEqualsBase test

Testing

  • All existing tests pass
  • Added new test to verify the fix

Fixes #9802

When comparing a branch with an ancestor commit (where source == base),
the CompareValueIterator was filtering out all changes that were 'added
on destination', resulting in empty diff results.

This fix short-circuits the Compare function to return the raw diff
when source equals base, which correctly shows all differences from
the ancestor commit.

Fixes treeverse#9802
@CLAassistant
Copy link

CLAassistant commented Dec 18, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added area/cataloger Improvements or additions to the cataloger area/testing Improvements or additions to tests labels Dec 18, 2025
Copy link
Contributor

@arielshaqed arielshaqed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see this comment on the issue. I believe you may be interested in the somewhat unfortunately-named two_dot comparison type in the OpenAPI spec.

Unfortunately, given that the existing API supports doing this in another way, and given that this would be a breaking API changing, this means that we will not be able to merge this PR.

Please free to discuss with us on #dev or #help on the lakeFS Slack workspace, lakefs.io/slack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cataloger Improvements or additions to the cataloger area/testing Improvements or additions to tests contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: branch revert returns 'no changes' error despite actual differences between commits

3 participants