Problem switching branches in submodule

6 messages, 3 authors, 2016-06-15 · open the first message on its own page

Problem switching branches in submodule

From: Manish Gill <hidden>
Date: 2016-06-15 22:58:54

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

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.

I'd appreciate any help. Thank you.

Re: Problem switching branches in submodule

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:58:54

(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

Re: Problem switching branches in submodule

From: Manish Gill <hidden>
Date: 2016-06-15 22:58:54

On 09/26/2013 11:38 PM, Jonathan Nieder wrote:
(cc-ing Duy, who knows the setup code well)
Manish Gill wrote:
quoted
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.

Annnnyway, 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.

Re: Problem switching branches in submodule

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:58:54

Manish Gill wrote:
Jonathan Nieder wrote:
quoted
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.

Annnnyway, 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

Re: Problem switching branches in submodule

From: Manish Gill <hidden>
Date: 2016-06-15 22:58:54

On 09/27/2013 12:18 AM, Jonathan Nieder wrote:
Manish Gill wrote:
quoted
Jonathan Nieder wrote:
quoted
quoted
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.
[...]
quoted
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.

Annnnyway, 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

Re: Problem switching branches in submodule

From: Duy Nguyen <hidden>
Date: 2016-06-15 22:58:54

On Fri, Sep 27, 2013 at 12:20 AM, Manish Gill [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help