git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: rebase not honoring core.worktree pointing elsewhere

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Nov 2, 2010, 00:11 UTC
Message-ID
<AANLkTi=ejRcnz+83zc2Z-6etUGMsBSw1FFUY0JNFRFGB@mail.gmail.com>
In-Reply-To
<loom.20101101T182113-378@post.gmane.org>
On Tue, Nov 2, 2010 at 12:22 AM, Paul Drews <paul.drews@intel.com> wrote:
Show 38 quoted lines
> Hello,
>
> I'm observing an unexpected error from "git rebase" run from the directory
> containing the ".git" directory:
>
> $ git --version
>
> git version 1.7.3.GIT
> (includes up to commit ca2090 from git repository at
> http://www.kernel.org/pub/scm/git/git.git)
>
> $ mkdir wherefilesare
> $ mkdir wheregitis
> $ cd wherefilesare
> $ echo "Here is a line from the original" > myfile.txt
> $ cd ../wheregitis
> $ git init
> $ git config core.worktree /absolute/path/to/wherefilesare/
> $ git add .
> $ git commit
> $ git branch mybranch
> $ git checkout mybranch
> $ vim ../wherefilesare/myfile.txt
> $ git add .
> $ git commit
> $ git checkout master
> $ vim ../wherefilesare/myfile.txt
> $ git add .
> $ git commit
> $ git checkout mybranch
> $ git rebase master
>
> fatal: /usr/libexec/git-core/git-rebase cannot be used without a working tree.
>
> Since I'm in the directory containing ".git" at this point, the ".git" directory
> and the worktree can be unambiguously found.  Other commands besides "git
> rebase" work.  I would expect "git rebase" to work as well.  Is this a bug or an
> unreasonable expectation on my part?

First of all, core.worktree should not matter because GIT_DIR has not been set (No don't trust core.worktree documentation, it's equivalent to --work-tree in "man git"). You need to set GIT_DIR (or --git-dir). That's a bug I'm working on.

Then, yes, rebase should be updated to use worktree even if it's outside cwd. I'm not sure how to do it properly in git-rebase.sh though. The requirement "require_work_tree" can be loosen a bit.

-- 
Duy
Previous: Sverre RabbelierNext: Junio C Hamano
Message 3 of 10 in “rebase not honoring core.worktree pointing elsewhere”
  1. Paul DrewsNov 1, 2010
  2. Sverre RabbelierNov 1, 2010
  3. Nguyen Thai Ngoc DuyNov 2, 2010
  4. Junio C HamanoNov 2, 2010
  5. Paul DrewsNov 2, 2010
  6. Nguyen Thai Ngoc DuyNov 3, 2010
  7. Paul DrewsNov 3, 2010
  8. Nguyen Thai Ngoc DuyNov 3, 2010
  9. Jonathan NiederNov 3, 2010
  10. Nguyen Thai Ngoc DuyNov 4, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.