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
[SR-3802] [SwiftPM] Xcode gets confused by SwiftPM's edit mode, which in turns confuses SwiftPM #5121
Comments
From your steps here, in step 6 you commit a change to B's copy of A, but you don't push that change anywhere. So isn't it correct that it has unpushed changes? I'm a little confused as to what you're saying that Xcode has to do with this, as well. |
Comment by David Sweeris (JIRA) Maybe? I was under the impression that pushing was only involved with remote repositories, and these are all local. I tried telling git to push them, it said, "fatal: The current branch 0.2.0 has no upstream branch.". I took that to mean that there wasn't anywhere to push them to, which, unless I'm misunderstanding something, makes complaining about it kind of a moot point. Is that not the case? I'll have to laugh/SMH at myself a bit if this is just me not having a firm enough grasp on how git works. Re: Xcode |
I believe the point of this error is to keep you from accidentally discarding changes. If you commit a change in your edited package and then don't actually push those changes to a remote repository, your committed changes only live in your local edited repo. If you then unedit, those committed changes will be lost, which likely isn't what you want. So we display this error to prevent you from accidentally blowing away those changes. If you really do want to lose your changes, you can pass the --force option. Because 0.2.0 is a branch that you created locally, it doesn't know which branch in the remote to track, so you need to set a remote tracking branch before you can push. You can read about how this works at https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches. |
You can push to local repos: sp = swift package $ sp edit bar --branch bugfix
$ cd Packages/bar
$ git status
On branch bugfix
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Sources/bar.swift
$ git add .
$ git commit -m "test"
[bugfix a21c919] test
1 file changed, 1 deletion(-)
$ git remote --v
origin /private/tmp/BigPackage/bar (fetch)
origin /private/tmp/BigPackage/bar (push)
$ git push origin bugfix
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 347 bytes | 0 bytes/s, done.
Total 4 (delta 1), reused 0 (delta 0)
To /private/tmp/BigPackage/bar
* [new branch] bugfix -> bugfix |
Environment
macOS 10.11.6
$ swift --version
Apple Swift version 3.1-dev (LLVM 2475cd4a8a, Clang bbab01d581, Swift bf16b699c5)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
md5: 2939d609dca274083394a13185a3403d
Issue Description:
The result is that Xcode thinks the dependency in edit mode belongs to two repositories, and SwiftPM won't let me "unedit" the dependency because of "hasUnpushedChanges". Well, all the changes are committed, and this is all local so there's nothing to push to.
Here are the steps:
At which point SwiftPM complains about unpushed changes that, as far as I can tell, don't actually exist.
The text was updated successfully, but these errors were encountered: