git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug report: 'git commit --dry-run' corner case: returns error ("nothing to commit") when all conflicts resolved to HEAD
@ 2015-08-26  2:21 Ovidiu Gheorghioiu
  0 siblings, 0 replies; 17+ messages in thread
From: Ovidiu Gheorghioiu @ 2015-08-26  2:21 UTC (permalink / raw)
  To: git

Hi git guys,

The bug is fairly simple: if we have a conflicted merge, AND all the
conflicts have been resolved to the version in HEAD, the commit
--dry-run error code says nothing to commit. As expected, git commit
goes through.

The commit message IS correct (-ish), just not the error code:

"""
All conflicts fixed but you are still merging.
  (use "git commit" to conclude merge)

nothing to commit, working directory clean
"""

The script below demonstrates the problem; version tested was 2.5.0.
Let me know if you need any more details.

Best,
Ovidiu

------
#!/bin/bash
mkdir test-repository || exit 1
cd test-repository
git init
echo "Initial contents, unimportant" > test-file
git add test-file
git commit -m "Initial commit"
echo "commit-1-state" > test-file
git commit -m "commit 1" -i test-file
git tag commit-1
git checkout -b branch-2 HEAD^1
echo "commit-2-state" > test-file
git commit -m "commit 2" -i test-file

# Creates conflicted state.
git merge --no-commit commit-1

# Resolved entirely to commit-2, aka HEAD.
echo "commit-2-state" > test-file
# If we'd set to commit-1=state, all would work as expected (changes vs HEAD).
git add test-file

# =====  Bug is here.
git commit --dry-run && echo "Git said something to commit" \
        || echo "Git said NOTHING to commit"

git commit -m "Something to commit after all" && echo "Commit went through"

git log --pretty=oneline

cd ..

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

end of thread, other threads:[~2018-08-23  1:28 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1649296.sC1eN3ni6k@thunderbird>
2016-02-09  1:55 ` Bug report: 'git commit --dry-run' corner case: returns error ("nothing to commit") when all conflicts resolved to HEAD Stephen & Linda Smith
2016-02-16  2:38   ` [PATCH] wt-status.c: set commitable bit if there is a meaningful merge Stephen P. Smith
2016-02-16  8:20     ` Philip Oakley
2016-02-16 21:54       ` Junio C Hamano
2016-02-16 23:26       ` Stephen & Linda Smith
2016-02-16 23:40       ` Stephen & Linda Smith
2016-02-16 23:30     ` Stephen & Linda Smith
2016-02-17  3:33     ` Junio C Hamano
2016-02-17  5:06       ` [PATCH v2] " Stephen P. Smith
2016-02-17  4:58     ` [PATCH] " Stephen & Linda Smith
2016-05-10  4:51     ` Stephen & Linda Smith
2018-08-22  5:33     ` Stephen Smith
2018-08-22 15:39       ` Junio C Hamano
2018-08-22 15:54       ` Junio C Hamano
2018-08-23  1:28       ` Stephen & Linda Smith
2016-02-12  1:04 ` Bug report: 'git commit --dry-run' corner case: returns error ("nothing to commit") when all conflicts resolved to HEAD Stephen & Linda Smith
2015-08-26  2:21 Ovidiu Gheorghioiu

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 NNTP newsgroup(s).