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

Bug report: git status does not report unmerged entries with copies

From
Mark Lodato <lodatom@gmail.com>
Date
Apr 7, 2011, 00:34 UTC
Message-ID
<BANLkTikWVgsX6yEY=d7kEcO5PLMTRwDU_A@mail.gmail.com>

Commit 4d4d572, "status: show worktree status of conflicted paths separately" introduced the following bug: If one tries to merge two branches with a conflict, where the conflicting file was also copied in one of the branches, "git status" (but not "git status -sb" or git-gui) fails to report the unmerged status. You can use the below test file to see the error. A similar test should probably be integrated into one of the existing git-status test files, though you may need to get rid of the "sed -i" command.

$ git status
# On branch master
# Changes to be committed:
#
#       renamed:    file -> copy
#
$ git status -sb
## master
R  file -> copy
 U file

In the above, "git status" should have reported "file" being in an unmerged state. It probably should also mark "copy" as a copy, not a rename.

-------- 8< -------- #!/bin/sh # # Copyright (c) 2011 Mark Lodato #

test_description='git status on merge with copy'
. ./test-lib.sh
test_expect_success 'setup' '
        echo first > file &&
        echo second >> file &&
        echo third >> file &&
        echo fourth >> file &&
        git add file &&
        git commit -m initial &&
        git checkout -b branch &&
        cp file copy &&
        git add copy &&
        git commit -m copy &&
        sed -i -e "s/second/fifth/" file &&
        git add file &&
        git commit -m fifth &&
        git checkout master &&
        sed -i -e "s/second/sixth/" file &&
        git add file &&
        git commit -m sixth
'
test_expect_success 'merge' '
        ! git merge branch
'
test_expect_success 'status' '
        git status | grep unmerged
'
test_done
Next: Martin von Zweigbergk
Message 1 of 3 in “Bug report: git status does not report unmerged entries with copies”
  1. Mark LodatoApr 7, 2011
  2. Martin von ZweigbergkApr 7, 2011
  3. Mark LodatoApr 7, 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.