git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug with worktrees...
@ 2015-08-27 19:03 John Szakmeister
  2015-08-28  2:55 ` Eric Sunshine
  0 siblings, 1 reply; 3+ messages in thread
From: John Szakmeister @ 2015-08-27 19:03 UTC (permalink / raw)
  To: git

My apologies if this has already been reported, but I ran into an
interesting bug with worktrees.  In particular, I have an alias 'st'
that maps to 'status -sb'.  When running this under a subdirectory of
a worktree created with 'git worktree add', it fails complaining that
the work tree has already been set.

Here's a script to reproduce the problem:
    git init test-repo
    cd test-repo
    git config --local alias.st 'status -sb'
    mkdir subdir
    echo file > subdir/file.txt
    git add subdir/file.txt
    git commit -m 'add file'
    git branch foo
    git worktree add ../new-worktree foo
    cd ../new-worktree/subdir
    echo "new line" >> file.txt
    echo "this will work"
    git status -sb
    echo "this fails"
    git st

When I run it, I see this:

Initialized empty Git repository in
/home/jszakmeister/tmp/test-case/test-repo/.git/
[master (root-commit) 1ec5360] add file
 1 file changed, 1 insertion(+)
 create mode 100644 subdir/file.txt
Enter ../new-worktree (identifier new-worktree)
Switched to branch 'foo'
this will work
## foo
this fails
fatal: internal error: work tree has already been set
Current worktree: /home/jszakmeister/tmp/test-case/new-worktree
New worktree: /home/jszakmeister/tmp/test-case/new-worktree/subdir

Hope this helps!

-John

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-28 10:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-27 19:03 Bug with worktrees John Szakmeister
2015-08-28  2:55 ` Eric Sunshine
2015-08-28 10:27   ` John Szakmeister

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).