Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: Cherry-pick dangles and forgets helpful advice in next

From: Phil Hord <hidden>
Date: 2016-06-15 22:53:53

Junio C Hamano wrote:
Junio C Hamano [off-list ref] writes:
quoted
Phil Hord [off-list ref] writes:
quoted
In git.git 'master' when I cherry-pick a commit which is eventually
empty, git gives me a friendly description of my supposed error, leaves
my cherry-pick "pending" and exits with an error code.


$ git cherry-pick a0aff2d                          
# On branch master
nothing to commit (working directory clean)
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

Otherwise, please use 'git reset'

In 'next' this is broken.  Now git does not tell me anything and it does
not exit with an error code.
...  The test
t3505.2 is about failing an attempt to cherry-pick an empty commit:
Ahh, disregard that one.  It is not testing the case where a cherry-pick
results in empty.
Yes, but the last one checks for something similar.  However, I tried
this and it does not trigger the same failure.

$ git cherry-pick HEAD^                              
# On branch master
nothing to commit (working directory clean)
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

Otherwise, please use 'git reset'



So I think I need to be more specific about the error condition I am seeing.

mkdir repo && cd repo && git init &&
touch foo && git add foo && git commit -mfoo &&
echo foo > foo && git add foo && git commit -mnewfoo && git branch newfoo &&
git commit --amend -m"new foo" &&
git cherry-pick newfoo

This sequence fails to report an error as of this commit:

commit b27cfb0d8d4cbb6d079c70ffeadac9c0dcfff250
Author: Neil Horman [off-list ref]
Date:   Fri Apr 20 10:36:15 2012 -0400

    git-cherry-pick: Add keep-redundant-commits option

But it does report the problem and 'exit 1' prior to that.

Phil
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help