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

Re: Okay to invoke merge-recursive with an empty workdir?

From
Jeff King <peff@peff.net>
Date
Sep 13, 2011, 03:29 UTC
Message-ID
<20110913032900.GA3296@sigill.intra.peff.net>
In-Reply-To
<CAG+J_Dyz-aeLYn43ARTG4GJz0+zRw_RyDr80bmPCayd9BjzCwg@mail.gmail.com>
On Mon, Sep 12, 2011 at 11:13:37PM -0400, Jay Soffian wrote:
Show 9 quoted lines
> So my approach is to create a temporary, empty, workdir, using
> symlinks to point to the parent repo per git new-workdir.
> 
> I then invoke merge-recursive directly inside the temporary workdir.
> 
> The question is whether this is safe to do, or whether merge-recursive
> expects a fully populated working tree that matches the index. My easy
> test cases seem to work correctly, but I'm concerned that I sometimes
> get:

I'm not sure if we were ever using merge-recursive like that. Especially with Elijah's latest patches to handle worktree dirtiness better, I wouldn't be surprised if it has issues.

What we do now at GitHub is something like:
  export GIT_WORK_TREE=/some/tmpdir
  export GIT_INDEX_FILE=/some/tmpfile
  git read-tree -i -m --aggressive $merge_base $us $them
  git merge-index git-merge-one-file -a

I also have a patch to do the content-level merge in read-tree without touching the filesystem at all. But we're not using it yet, and I should probably write more tests for it. You can see it at:

  git://github.com/peff/git.git jk/read-tree-content-merge

It should produce the same results as the snippet above, but faster. Both of those will obviously not handle renames or do recursive merges like merge-recursive, of course.

-Peff
Previous: Jay SoffianNext: Junio C Hamano
Message 2 of 4 in “Okay to invoke merge-recursive with an empty workdir?”
  1. Jay SoffianSep 13, 2011
  2. Jeff KingSep 13, 2011
  3. Junio C HamanoSep 13, 2011
  4. Jeff KingSep 13, 2011

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.