git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git merge commits staged files (when two trees are identical)
@ 2017-12-20 11:43 Andreas Krey
  2017-12-21 18:50 ` Elijah Newren
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Krey @ 2017-12-20 11:43 UTC (permalink / raw)
  To: git@vger.kernel.org

Hi everybody,

we just stumbled over a situation in which a merge commits
staged changes into the merge commit. This happens when the
merged-in branch does have commits ('main') but has the same
tree ('--allow-empty') as the merge base:

    git init
    echo eins >a
    git add a
    git commit -m initial
    git branch sub
    git commit -m main --allow-empty
    git checkout sub
    : two
    echo zwei >>a
    git add a
    git commit -m underway
    : three
    echo drei >>a
    git add a              # important
    git status
    git diff --cached
    git merge master -m 'merge'
    git status
    git log --cc -1

If the change isn't staged (comment out the '# important' line)
the change survives as unstaged.

That is a bug?

- Andreas

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-01-09 18:49 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-20 11:43 git merge commits staged files (when two trees are identical) Andreas Krey
2017-12-21 18:50 ` Elijah Newren
2017-12-21 19:19   ` [PATCH 1/3] t6044: recursive can silently incorporate dirty changes in a merge Elijah Newren
2017-12-21 19:19     ` [PATCH 2/3] move index_has_changes() from builtin/am.c to merge.c for reuse Elijah Newren
2017-12-21 19:36       ` Elijah Newren
2017-12-22 20:46         ` Junio C Hamano
2017-12-23  2:26           ` Elijah Newren
2017-12-21 19:19     ` [PATCH 3/3] merge-recursive: Avoid incorporating uncommitted changes in a merge Elijah Newren
2017-12-22 20:38       ` Junio C Hamano
2018-01-08 20:37       ` Junio C Hamano
2018-01-09 18:19         ` [PATCH] merge-recursive: do not look at the index during recursive merge Junio C Hamano
2018-01-09 18:25           ` Junio C Hamano
2018-01-09 18:27           ` Eric Sunshine
2018-01-09 18:29           ` Elijah Newren
2018-01-09 18:49             ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).