Re: Problem switching branches in submodule
(cc-ing Duy, who knows the setup code well) Manish Gill wrote: I have a git repository with lots of submodules. In one particular submodule, I'm having the following problem: If I try to switch branches at the top-level of that submodule, I succeed. But, if I try to switch branches in any subsequen levels, I get the following error: fatal: internal error: work tree has already been set Current worktree: ../path/Mailman3/rest_project New worktree: ../path/Mailman3/rest_project/website/public_rest Here, Mailman3 is the primary repository and rest_project is a submodule. I can do git checkout just fine inside rest_project, but not after cd-ing into any other repos. My git version is 1.8.4 Other commands, like git status, push/pull are working fine. Interesting. Yeah, this shouldn't happen. What is the exact command you use to get the above output? Is your repository public (which would let us reproduce it) or can you reproduce it by creating a small artificial test repository? For comparison, did some previous version of git work ok in the same scenario, or is this the first time you've tried it? Thanks, Jonathan -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Problem switching branches in submodule
On 09/26/2013 11:38 PM, Jonathan Nieder wrote: (cc-ing Duy, who knows the setup code well) Manish Gill wrote: I have a git repository with lots of submodules. In one particular submodule, I'm having the following problem: If I try to switch branches at the top-level of that submodule, I succeed. But, if I try to switch branches in any subsequen levels, I get the following error: fatal: internal error: work tree has already been set Current worktree: ../path/Mailman3/rest_project New worktree: ../path/Mailman3/rest_project/website/public_rest Here, Mailman3 is the primary repository and rest_project is a submodule. I can do git checkout just fine inside rest_project, but not after cd-ing into any other repos. My git version is 1.8.4 Other commands, like git status, push/pull are working fine. Interesting. Yeah, this shouldn't happen. What is the exact command you use to get the above output? git checkout branch_name Is your repository public (which would let us reproduce it) or can you reproduce it by creating a small artificial test repository The repo isn't public, I'm afraid. I should mention what *exactly* happened that led to this. I was trying to publish my branch on Launchpad (using git-remote-bzr). At some point, I had the genius idea to remote the extra stuff from the config file and just try with the bzr:: remote as origin, and instead of doing it via the console, I just replaced the config file. Ayway, I just restored my backed up config file for that submodule in the middle of writing this and seems like things seem to work now. I dunno, this was most likely because of some configuration derp on my part (the new config file didn't contain the branch information most likely). So I guess problem solved! Thanks for your help. signature.asc Description: OpenPGP digital signature
Re: Problem switching branches in submodule
Manish Gill wrote: Jonathan Nieder wrote: What is the exact command you use to get the above output? git checkout branch_name Is branch_name a normal branch, a remote-tracking branch, or a branch that doesn't exist yet? [...] I should mention what *exactly* happened that led to this. I was trying to publish my branch on Launchpad (using git-remote-bzr). At some point, I had the genius idea to remote the extra stuff from the config file and just try with the bzr:: remote as origin, and instead of doing it via the console, I just replaced the config file. Ayway, I just restored my backed up config file for that submodule in the middle of writing this and seems like things seem to work now. If you happen to have a copy of the old config file or remember what it said, that could be helpful (especially if you can still reproduce the problem in case we come up with a fix). Did the config file have a [core] worktree setting or something similar? Hmm, Jonathan -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Problem switching branches in submodule
On 09/27/2013 12:18 AM, Jonathan Nieder wrote: Manish Gill wrote: Jonathan Nieder wrote: What is the exact command you use to get the above output? git checkout branch_name Is branch_name a normal branch, a remote-tracking branch, or a branch that doesn't exist yet? Local branch that was supposed to track a remote branch. [...] I should mention what *exactly* happened that led to this. I was trying to publish my branch on Launchpad (using git-remote-bzr). At some point, I had the genius idea to remote the extra stuff from the config file and just try with the bzr:: remote as origin, and instead of doing it via the console, I just replaced the config file. Ayway, I just restored my backed up config file for that submodule in the middle of writing this and seems like things seem to work now. If you happen to have a copy of the old config file or remember what it said, that could be helpful (especially if you can still reproduce the problem in case we come up with a fix). Config file which was NOT working: http://bpaste.net/show/oaWG3TQarH3BrdjDj5be/ Working config restored from backup: http://bpaste.net/show/nF3ap5fDEAwL9NyqdCmD/ Did the config file have a [core] worktree setting or something similar? Looks like the working one had it and the other didn't. Adding the worktree setting seems to fix the problem. But shouldn't this work uniformly in the repo? Removing the [core] worktree gives the same error, but only in directories inside the repo. Checkout still works on the top-level. Seems a bit strange I guess. Hmm, Jonathan signature.asc Description: OpenPGP digital signature
Re: Problem switching branches in submodule
On Fri, Sep 27, 2013 at 12:20 AM, Manish Gill mgil...@outlook.com wrote: Hello, I have a git repository with lots of submodules. In one particular submodule, I'm having the following problem: If I try to switch branches at the top-level of that submodule, I succeed. But, if I try to switch branches in any subsequen levels, I get the following error: fatal: internal error: work tree has already been set Current worktree: ../path/Mailman3/rest_project New worktree: ../path/Mailman3/rest_project/website/public_rest Can you apply this patch, rebuild git and retry again? It will create a coredump at fatal:..., which might give me a clue what's going on.. Once you get the coredump, open it with gdb, execute bt full and paste the output here. diff --git a/usage.c b/usage.c index ed14645..0403091 100644 --- a/usage.c +++ b/usage.c @@ -34,6 +34,7 @@ static NORETURN void usage_builtin(const char *err, va_list params) static NORETURN void die_builtin(const char *err, va_list params) { vreportf(fatal: , err, params); + *(char*)0 = 1; exit(128); } -- Duy -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: problem switching branches
On 2/26/2013 10:17 PM, Jeff King wrote: On Tue, Feb 26, 2013 at 04:08:55PM -0700, J.V. wrote: I was on my master branch, I then checked out a branch ( origin/somebranch ), made no updates but did a few git pulls on the branch over about a week; then made a small change to only a single file committed pushed. Now am trying to go back to my master branch and get: error: The following untracked working tree files would be overwritten by checkout: lib/derbyclient.jar Please move or remove them before you can switch branches. Aborting I did not put that jar file there (I edited a single config file), how do I now get back to my master branch? Not knowing anything about your project, it's impossible to say for sure, but this often happens with something like: 1. lib/derbyclient.jar used to be generated by your project's build procedure This jar was put on the master branch last year; It does not exist in the branch that I am now on where I get the error message (I am on a branch that was created for a previous release). 2. You did a build of your project, generating the file in your working tree. This jar is downloaded from the web and put there; we did not generate. 3. Meanwhile, somebody upstream added and commited lib/derbyclient.jar directly in the repository. This might have been intentional (it used to be a generated file, but now is included as source), or it may have been an accident (mistaken use of `git add`). It was committed intentionally, last year, but does not exist in the branch that I am now on, but it is there. 4. You try to switch to the master branch with the new commits from (3). Git sees that the copy of the file in your working tree would be overwritten and lost (since it was never committed by you), so aborts. If you are sure that the file in the working tree does not contain anything interesting, you can use git checkout -f master to force the overwrite. I will try this. I do not want to muck up the branch that I am now on by deleting anything. Any ideas how this happened? You won't hurt the branch you are on; you will just lose the contents in the untracked working tree file. That's probably fine if it is a generated file, as in the scenario I described above. We know that the file is not included in the branch you are on (otherwise, it would not be listed as untracked). And even if it were, you would only impact the branch by committing the changes, not by changing the working tree. Obviously someone put derbyclient.jar there, not sure, but it is supposed to be there so do not want to remove as advised. It won't be removed; it will be overwritten with the version of the file that is on master. Which is probably what you want; you may want to look at `git log master -- lib/derbyclient.jar` to see why it was added. -Peff -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: problem switching branches
On Tue, Feb 26, 2013 at 04:08:55PM -0700, J.V. wrote: I was on my master branch, I then checked out a branch ( origin/somebranch ), made no updates but did a few git pulls on the branch over about a week; then made a small change to only a single file committed pushed. Now am trying to go back to my master branch and get: error: The following untracked working tree files would be overwritten by checkout: lib/derbyclient.jar Please move or remove them before you can switch branches. Aborting I did not put that jar file there (I edited a single config file), how do I now get back to my master branch? Not knowing anything about your project, it's impossible to say for sure, but this often happens with something like: 1. lib/derbyclient.jar used to be generated by your project's build procedure 2. You did a build of your project, generating the file in your working tree. 3. Meanwhile, somebody upstream added and commited lib/derbyclient.jar directly in the repository. This might have been intentional (it used to be a generated file, but now is included as source), or it may have been an accident (mistaken use of `git add`). 4. You try to switch to the master branch with the new commits from (3). Git sees that the copy of the file in your working tree would be overwritten and lost (since it was never committed by you), so aborts. If you are sure that the file in the working tree does not contain anything interesting, you can use git checkout -f master to force the overwrite. I do not want to muck up the branch that I am now on by deleting anything. Any ideas how this happened? You won't hurt the branch you are on; you will just lose the contents in the untracked working tree file. That's probably fine if it is a generated file, as in the scenario I described above. We know that the file is not included in the branch you are on (otherwise, it would not be listed as untracked). And even if it were, you would only impact the branch by committing the changes, not by changing the working tree. Obviously someone put derbyclient.jar there, not sure, but it is supposed to be there so do not want to remove as advised. It won't be removed; it will be overwritten with the version of the file that is on master. Which is probably what you want; you may want to look at `git log master -- lib/derbyclient.jar` to see why it was added. -Peff -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html