-
Notifications
You must be signed in to change notification settings - Fork 932
Add IncompatibleBase rejection for cross-base cherry-pick conflicts #13628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
mtsgrd
wants to merge
1
commit into
master
Choose a base branch
from
different-base-conflict
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
46 changes: 46 additions & 0 deletions
46
crates/but-workspace/tests/fixtures/scenario/two-stacks-modifying-shared-file.sh
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| source "${BASH_SOURCE[0]%/*}/shared.sh" | ||
|
|
||
| git init | ||
| echo "two stacks with different bases, upstream modified file, uncommitted changes" >.git/description | ||
|
|
||
| # Initial base with a file | ||
| echo "original" >file.txt | ||
| git add file.txt | ||
| commit "initial" | ||
|
|
||
| # Advance main: upstream modifies file.txt | ||
| echo "upstream-changed" >file.txt | ||
| git add file.txt | ||
| commit "upstream changes file" | ||
| setup_target_to_match_main | ||
|
|
||
| # Stack A: fork from main~1 (old base, before upstream changed file.txt) | ||
| git checkout -b A main~1 | ||
| echo "A-content" >a-only.txt | ||
| git add a-only.txt | ||
| commit "A adds a-only" | ||
|
|
||
| # Stack B: fork from main (new base, includes upstream's change to file.txt) | ||
| git checkout -b B main | ||
| echo "B-content" >b-only.txt | ||
| git add b-only.txt | ||
| commit "B adds b-only" | ||
|
|
||
| # Create workspace merge commit from both stacks | ||
| # B is current (has upstream-changed file.txt), merge A in | ||
| # The merge base between A and B is main~1 where file.txt="original" | ||
| # A has file.txt="original" (unchanged from its base), B has file.txt="upstream-changed" | ||
| # So the merge picks B's (upstream) version of file.txt for the workspace tree. | ||
| create_workspace_commit_once B A | ||
|
|
||
| # Uncommitted worktree change: modify file.txt. | ||
| # This change is relative to the workspace merge tree (which has "upstream-changed"). | ||
| # When committing to stack A, the cherry-pick does: | ||
| # base = HEAD^{tree} (workspace: file.txt="upstream-changed") | ||
| # ours = A-tip^{tree} (A: file.txt="original") | ||
| # theirs = HEAD^{tree} + changes (file.txt="worktree-modified") | ||
| # The cherry-pick sees (base→ours) changed "upstream-changed" to "original" | ||
| # and (base→theirs) changed "upstream-changed" to "worktree-modified" → CONFLICT | ||
| echo "worktree-modified" >file.txt |
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
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
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
65 changes: 65 additions & 0 deletions
65
e2e/playwright/scripts/project-with-different-base-stacks.sh
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #!/bin/bash | ||
|
|
||
| echo "GIT CONFIG $GIT_CONFIG_GLOBAL" | ||
| echo "DATA DIR $E2E_TEST_APP_DATA_DIR" | ||
| echo "BUT $BUT" | ||
|
|
||
| # Setup a remote project with two branches that fork from DIFFERENT master | ||
| # commits. This causes stacks to have different merge bases with the target, | ||
| # which triggers IncompatibleBase rejections when committing a shared file | ||
| # to the wrong stack. | ||
| # | ||
| # master: init ──── upstream-change | ||
| # │ │ | ||
| # old-stack new-stack | ||
| # (doesn't have (has the upstream | ||
| # upstream change) change) | ||
|
|
||
| mkdir remote-project | ||
| pushd remote-project | ||
| git init -b master --object-format=sha1 | ||
|
|
||
| # Initial commit with a shared file | ||
| cat > shared_file << 'CONTENT' | ||
| alpha | ||
| bravo | ||
| charlie | ||
| delta | ||
| echo | ||
| foxtrot | ||
| golf | ||
| hotel | ||
| india | ||
| juliet | ||
| CONTENT | ||
| git add shared_file | ||
| git commit -m "Initial commit with shared_file" | ||
|
|
||
| # Create old-stack branch from here (before the upstream change) | ||
| git checkout -b old-stack | ||
| echo "old-stack work" >> other_file | ||
| git add other_file | ||
| git commit -m "old-stack: add other_file" | ||
| git checkout master | ||
|
|
||
| # Now advance master with a change to shared_file | ||
| sed 's/juliet/JULIET-UPSTREAM/' shared_file > shared_file.tmp && mv shared_file.tmp shared_file | ||
| git commit -am "Upstream change to shared_file" | ||
|
|
||
| # Create new-stack branch from updated master (has the upstream change) | ||
| git checkout -b new-stack | ||
| echo "new-stack work" >> another_file | ||
| git add another_file | ||
| git commit -m "new-stack: add another_file" | ||
| git checkout master | ||
| popd | ||
|
|
||
| # Clone the remote and set up GitButler | ||
| git clone remote-project local-clone | ||
| pushd local-clone | ||
| git checkout master | ||
| target_branch="$(git rev-parse --symbolic-full-name @{u})" | ||
| target_branch="${target_branch#refs/remotes/}" | ||
| "$BUT" setup | ||
| "$BUT" config target "$target_branch" | ||
| popd |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.