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

[PATCH 0/2] merge-one-file and GIT_WORK_TREE

From
Jeff King <peff@peff.net>
Date
Apr 28, 2011, 22:38 UTC
Message-ID
<20110428223822.GA16004@sigill.intra.peff.net>
[argh, resend, actually remembering to cc the list this time]

At GitHub, we're using read-tree, merge-index, and merge-one-file to do trivial content-level merges from bare repositories (without having to check out the entire repository contents each time).

However, we noticed a bug in git-merge-one-file when used with GIT_WORK_TREE; it can silently create bogus results that ignore the "theirs" side of files needing content-level merging.

The problem is that merge-one-file simply assumes it is in the root of the working tree without any checking. The only two places we use merge-one-file in git itself are in the octopus and resolve strategies. I think normal use is fine, because "git merge" will have changed to the toplevel of the worktree already.

So I doubt anybody else is being affected by this. But we do expose the commands for general use, with no disclaimer or check on the working tree status or location. And the resulting bogus merge is a nasty surprise.

  [1/2]: add tests for merge-index / merge-one-file
  [2/2]: merge-one-file: fix broken merges with GIT_WORK_TREE
-Peff
Next: Jeff King
Message 1 of 6 in “merge-one-file and GIT_WORK_TREE”
  1. 0/2 merge-one-file and GIT_WORK_TREEJeff King, Apr 28, 2011
  2. 1/2 add tests for merge-index / merge-one-fileJeff King, Apr 28, 2011
  3. Johannes SixtApr 29, 2011
  4. Junio C HamanoApr 29, 2011
  5. 2/2 merge-one-file: fix broken merges with GIT_WORK_TREEJeff King, Apr 28, 2011
  6. Junio C HamanoApr 29, 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.