Skip to content
Commits on May 13, 2011
  1. Merge branch 'jk/merge-one-file-working-tree' into maint

    * jk/merge-one-file-working-tree:
      merge-one-file: fix broken merges with alternate work trees
      add tests for merge-index / merge-one-file
Commits on Apr 29, 2011
  1. @peff

    merge-one-file: fix broken merges with alternate work trees

    peff committed with
    The merge-one-file tool predates the invention of
    GIT_WORK_TREE. By the time GIT_WORK_TREE was invented, most
    people were using the merge-recursive strategy, which
    handles resolving internally. Therefore these features have
    had very little testing together.
    For the most part, merge-one-file just works with
    GIT_WORK_TREE; most of its heavy lifting is done by plumbing
    commands which do respect GIT_WORK_TREE properly. The one
    exception is a shell redirection which touches the worktree
    directly, writing results to the wrong place in the presence
    of a GIT_WORK_TREE variable.
    This means that merges won't even fail; they will silently
    produce incorrect results, throwing out the entire "theirs"
    side of files which need content-level merging!
    This patch makes merge-one-file chdir to the toplevel of the
    working tree (and exit if we don't have one). This most
    closely matches the assumption made by the original script
    (before separate work trees were invented), and matches what
    happens when the script is called as part of a merge
    While we're at it, we'll also error-check the call to cat.
    Merging a file in a subdirectory could in fact fail, as the
    redirection relies on the "checkout-index" call just prior
    to create leading directories. But we never noticed, since
    we ignored the error return from running cat.
    Signed-off-by: Jeff King <>
    Signed-off-by: Junio C Hamano <>
Commits on Jun 5, 2010
  1. build: propagate $DIFF to scripts

    git-merge-one-file expects to run "-u" capable "diff", but using
    $DIFF is not the right way to do so.
    Signed-off-by: Junio C Hamano <>
Commits on May 31, 2010
  1. Do not use "diff" found on PATH while building and installing

    Gary V. Vaughan committed with
    Some of the flags used with the first diff found in PATH cause the
    vendor diff to choke.
    Signed-off-by: Gary V. Vaughan <>
    Signed-off-by: Junio C Hamano <>
Commits on Nov 10, 2009
  1. @jrn

    Show usage string for 'git merge-one-file -h'

    jrn committed with
    Signed-off-by: Jonathan Nieder <>
    Signed-off-by: Junio C Hamano <>
Commits on May 9, 2009
  1. @raalkml

    Clarify kind of conflict in merge-one-file helper

    raalkml committed with
    Not as verbose as the recursive merge driver, but better still.
    Signed-off-by: Alex Riesen <>
    Signed-off-by: Junio C Hamano <>
Commits on Mar 19, 2008
  1. git-merge-one-file: fix longstanding stupid thinko

    When a merge result creates a new file, and when our side already has a
    file in the path, taking the merge result may clobber the untracked file.
    However, the logic to detect this situation was totally the wrong way.  We
    should complain when the file exists, not when the file does not exist.
    Signed-off-by: Junio C Hamano <>
Commits on Dec 11, 2007
  1. Support a merge with conflicting gitlink change

    merge-recursive did not support merging trees that have conflicting
    changes in submodules they contain, and died.  Support it exactly the
    same way as how it handles conflicting symbolic link changes --- mark it
    as a conflict, take the tentative result from the current side, and
    letting the caller resolve the conflict, without dying in merge_file()
    Also reword the error message issued when merge_file() has to die
    because it sees a tree entry of type it does not support yet.
    [jc: fixed up initial draft by Finn Arne Gangstad]
    Signed-off-by: Junio C Hamano <>
Commits on Jul 9, 2007
  1. Fix merge-one-file for our-side-added/our-side-removed cases

    When commit ed93b44 changed the script so that it does not
    touch untracked working tree file, we forgot that we still
    needed to resolve the index entry (otherwise they are left
    Signed-off-by: Junio C Hamano <>
Commits on Jul 3, 2007
  1. Rewrite "git-frotz" to "git frotz"

    This uses the remove-dashes target to replace "git-frotz" to "git frotz".
    Signed-off-by: Junio C Hamano <>
Commits on Jun 7, 2007
  1. War on whitespace

    This uses "git-apply --whitespace=strip" to fix whitespace errors that have
    crept in to our source files over time.  There are a few files that need
    to have trailing whitespaces (most notably, test vectors).  The results
    still passes the test, and build result in Documentation/ area is unchanged.
    Signed-off-by: Junio C Hamano <>
Commits on Dec 22, 2006
  1. @dscho

    Use git-merge-file in git-merge-one-file, too

    dscho committed with Junio C Hamano
    Would you believe? I edited git-merge-one-file (note the missing ".sh"!)
    when I submitted the patch which became commit e2b7008...
    Signed-off-by: Johannes Schindelin <>
    Signed-off-by: Junio C Hamano <>
Commits on Oct 28, 2006
  1. merge: loosen overcautious "working file will be lost" check.

    Junio C Hamano committed
    The three-way merge complained unconditionally when a path that
    does not exist in the index is involved in a merge when it
    existed in the working tree.  If we are merging an old version
    that had that path tracked, but the path is not tracked anymore,
    and if we are merging that old version in, the result will be
    that the path is not tracked.  In that case we should not
    Signed-off-by: Junio C Hamano <>
Commits on Jul 10, 2006
  1. @proski

    Fix more typos, primarily in the code

    proski committed with Junio C Hamano
    The only visible change is that git-blame doesn't understand
    "--compability" anymore, but it does accept "--compatibility" instead,
    which is already documented.
    Signed-off-by: Pavel Roskin <>
    Signed-off-by: Junio C Hamano <>
Commits on Apr 13, 2006
  1. @distorted-mdw

    Shell utilities: Guard against expr' magic tokens.

    distorted-mdw committed with Junio C Hamano
    Some words, e.g., `match', are special to expr(1), and cause strange
    parsing effects.  Track down all uses of expr and mangle the arguments
    so that this isn't a problem.
    Signed-off-by: Mark Wooding <>
    Signed-off-by: Junio C Hamano <>
Commits on Jan 6, 2006
  1. @raalkml

    trivial: remove the dots at the end of file names from merge-one-file

    raalkml committed with Junio C Hamano
    to make the output more friendly to mouse copy-paste.
    Signed-off-by: Alex Riesen <>
    Signed-off-by: Junio C Hamano <>
Commits on Dec 7, 2005
  1. git-merge-one: new merge world order.

    Junio C Hamano committed
    This does two things:
     - Use new --stage=2 option to create the working tree file with
       leading paths and correct permission bits using
       checkout-index, as before.
     - Make sure we do not confuse "merge" program when the file
       being merged has an unfortunate name, '-L'.
    Signed-off-by: Junio C Hamano <>
Commits on Dec 6, 2005
  1. git-merge-one-file: resurrect leading path creation.

    Junio C Hamano committed
    Since we do not use git-update-index followed by
    git-checkout-index -u to create the half-merged file on
    conflicting case anymore, we need to make sure the leading
    directories are created here.
    Maybe a better solution would be to allow update-index to add to
    higher stage, and checkout-index to extract from such, but that
    is a change slightly bigger than I would like to have so close
    to 1.0, so this should do for now.
    Signed-off-by: Junio C Hamano <>
Commits on Dec 2, 2005
  1. merge-one-file: make sure we do not mismerge symbolic links.

    Junio C Hamano committed
    We ran "merge" command on O->A, O->B, A!=B case without
    verifying the path involved is not a symlink.
    Signed-off-by: Junio C Hamano <>
  2. merge-one-file: make sure we create the merged file.

    Junio C Hamano committed
    The "update-index followed by checkout-index" chain served two
    purposes -- to collapse the index to "our" version, and make
    sure that file exists in the working tree.  In the recent update
    to leave the index unmerged on conflicting path, we wanted to
    stop doing the former, but we still need to do the latter (we
    allow merging to work in an un-checked-out working tree).
    Signed-off-by: Junio C Hamano <>
  3. git-merge-one-file: do not worry about 'rmdir -p' not removing direct…

    Junio C Hamano committed
    9ae2172 used "rmdir -p"
    carelessly, causing the more important "git-update-index
    --remove" to be skipped.
    Signed-off-by: Junio C Hamano <>
Commits on Nov 30, 2005
  1. merge-one-file: leave unmerged index entries upon automerge failure.

    Linus Torvalds committed with Junio C Hamano
    When automerge fails, we used to collapse the path to stage0
    from "our" branch, to help "diff-files" users to view the
    half-merged state against the current HEAD.  Now diff-files has
    been taught how to compare with unmerged stage2,leaving them
    unmerged is a better thing to do, especially this prevents the
    unresolved conflicts to be committed by mistake.
    Signed-off-by: Junio C Hamano <>
Commits on Nov 20, 2005
  1. merge-one-file: use rmdir -p

    Junio C Hamano committed
    The flag is universally available, even on VMS; use it.
    Signed-off-by: Junio C Hamano <>
  2. merge-one-file: remove empty directories

    Junio C Hamano committed
    When the last file in a directory is removed as the result of a
    merge, try to rmdir the now-empty directory.
    [jc: We probably could use "rmdir -p", but for now we do that by
    hand for portability.]
    Signed-off-by: Junio C Hamano <>
Commits on Nov 12, 2005
  1. merge-one-file: use empty- or common-base condintionally in two-stage…

    Junio C Hamano committed
    … merge.
    If two sides added the same path completely different thing, it is
    easier to see the merge pivoting on /dev/null.  So check the size of
    the common section we have found, and empty it if it is too small.
    Signed-off-by: Junio C Hamano <>
  2. merge-one-file: use common as base, instead of emptiness.

    Junio C Hamano committed
    Unlike the previous round that merged the path added differently
    in each branches using emptiness as the base, compute a common
    version and use it as input to 'merge' program.
    This would show the resulting (still conflicting) file left in
    the working tree as:
    	common file contents...
    	<<<<<< FILENAME
    	version from our branch...
    	version from their branch...
    	>>>>>> .merge_file_XXXXXX
    	more common file contents...
    when both sides added similar contents.
    Signed-off-by: Junio C Hamano <>
  3. merge with /dev/null as base, instead of punting O==empty case

    Junio C Hamano committed
    Instead of leaving the path unmerged in a case where each side
    adds different version of the same path, attempt to merge it
    with empty base and leave "our" version in the index file, just
    like we do for the case in conflicting merge.
    Signed-off-by: Junio C Hamano <>
Commits on Sep 8, 2005
  1. Big tool rename.

    Junio C Hamano committed
    As promised, this is the "big tool rename" patch.  The primary differences
    since 0.99.6 are:
      (1) git-*-script are no more.  The commands installed do not
          have any such suffix so users do not have to remember if
          something is implemented as a shell script or not.
      (2) Many command names with 'cache' in them are renamed with
          'index' if that is what they mean.
    There are backward compatibility symblic links so that you and
    Porcelains can keep using the old names, but the backward
    compatibility support  is expected to be removed in the near
    Signed-off-by: Junio C Hamano <>
Something went wrong with that request. Please try again.