You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds a UI action to compare any non-current branch against the current branch from the Branches and Tags section. It addresses #1512 by letting users inspect all changes between, for example, main and a feature branch without checking each commit individually.
The implementation reuses the existing diff API, which already accepts Git refs. CommitComparisonBox now works with generic Git refs instead of commit-only objects, branch rows expose a “Compare with current branch” diff action, and GitPanel renders the resulting changed-file summary below the branch list. Existing commit comparison behaviour is preserved by converting commits into the same ref-based shape.
Tests were added and updated for the branch compare button, GitPanel branch comparison flow, and generic ref diff handling in CommitComparisonBox.
While implementing branch comparison, I noticed a separate case in the existing backend diff parsing.
The new UI reuses the existing model.diff(base, target) path, which already supports Git refs such as commits and branches. That part works for normal branch diffs.
However, the backend parser in packages/core/jupyterlab_git_core/git.py currently parses git diff --numstat -z output by splitting each entry on whitespace. That can misread filenames that contain spaces, and it may also mishandle renamed files because Git emits extra path information for renames.
This is not caused by the branch-comparison UI change, but the new feature may make the existing parser limitation easier to hit when comparing whole branches.
Would you prefer that I keep this PR scoped to exposing branch comparison in the UI, or should I also include a backend parser fix for paths with spaces / renamed files here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1512
This PR adds a UI action to compare any non-current branch against the current branch from the Branches and Tags section. It addresses #1512 by letting users inspect all changes between, for example, main and a feature branch without checking each commit individually.
The implementation reuses the existing diff API, which already accepts Git refs.
CommitComparisonBoxnow works with generic Git refs instead of commit-only objects, branch rows expose a “Compare with current branch” diff action, and GitPanel renders the resulting changed-file summary below the branch list. Existing commit comparison behaviour is preserved by converting commits into the same ref-based shape.Tests were added and updated for the branch compare button, GitPanel branch comparison flow, and generic ref diff handling in
CommitComparisonBox.