-
Notifications
You must be signed in to change notification settings - Fork 455
fix: promotion over non-existent file #12615
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
Alizter
wants to merge
2
commits into
ocaml:main
Choose a base branch
from
Alizter:push-sqrpzslmkvzl
base: main
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
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| - Fix a bug where dune was unable to promote over non-existant files in certain | ||
| cases (#12615, fixes #8075, @Alizter) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| (cram | ||
| (applies_to symlink-to-nonexistent) | ||
| (deps %{bin:git} ../git-helpers.sh)) |
44 changes: 44 additions & 0 deletions
44
test/blackbox-tests/test-cases/promote/symlink-to-nonexistent.t
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,44 @@ | ||
| Tests for promoting with symlink to non-existent file. | ||
|
|
||
| $ cat > dune-project <<EOF | ||
| > (lang dune 3.21) | ||
| > EOF | ||
| $ cp dune-project dune-workspace | ||
|
|
||
| $ cat > dune <<EOF | ||
| > (rule | ||
| > (with-stdout-to "x.gen" | ||
| > (echo "toto"))) | ||
| > (rule | ||
| > (alias bench) | ||
| > (action | ||
| > (diff promoted x.gen))) | ||
| > EOF | ||
|
|
||
| Unset INSIDE_DUNE in order to choose the "git diff" diff algorithm. Root | ||
| detection will now be automatic so a dune-workspace file was included above. | ||
| $ unset INSIDE_DUNE | ||
|
|
||
| The "git diff" command that dune will run will unfortunately go looking for a | ||
| `.git` root. We therefore initialise a git repo to avoid this from escaping the | ||
| test. | ||
| $ . ../git-helpers.sh | ||
| $ git init -q | ||
|
|
||
| This should fail initially but not with the "Unable to resolve symlink" error. | ||
| $ dune build @bench | ||
| File "promoted", line 1, characters 0-0: | ||
| ------ /dev/null | ||
| ++++++ x.gen | ||
| File "/dev/null", line 1, characters 0-1: | ||
| +|toto | ||
| No newline at the end of x.gen | ||
| [1] | ||
|
|
||
| Promotion should work | ||
| $ dune promote | ||
| Promoting _build/default/x.gen to promoted. | ||
|
|
||
| $ cat promoted | ||
| toto | ||
|
|
||
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.