Re: [PATCH v4 01/16] Verify that `git pull --rebase` shows the helpful advice when failing
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jul 26, 2016, 12:21 UTC
- Message-ID
- <alpine.DEB.2.20.1607261421180.14111@virtualbox>
- In-Reply-To
- <xmqqk2g94cti.fsf@gitster.mtv.corp.google.com>
Hi Junio,
On Mon, 25 Jul 2016, Junio C Hamano wrote:
Show 8 quoted lines
> Johannes Schindelin <johannes.schindelin@gmx.de> writes: > > > +test_expect_success '--rebase with conflicts shows advice' ' > > + test_when_finished "git rebase --abort; git checkout -f to-rebase" && > > + git checkout -b seq && > > + printf "1\\n2\\n3\\n4\\n5\\n" >seq.txt && > > Make this more readble by using test-write-lines, perhaps?
Or even test_seq. Thanks for pointing my nose to this.
Show 16 quoted lines
> > + git add seq.txt && > > + test_tick && > > + git commit -m "Add seq.txt" && > > + printf "6\\n" >>seq.txt && > > + test_tick && > > + git commit -m "Append to seq.txt" seq.txt && > > + git checkout -b with-conflicts HEAD^ && > > + printf "conflicting\\n" >>seq.txt && > > + test_tick && > > + git commit -m "Create conflict" seq.txt && > > + test_must_fail git pull --rebase . seq 2>err >out && > > + grep "When you have resolved this problem" out > > +' > > +test_expect_success 'failed --rebase shows advice' ' > > Need a blank line before this one.
Yep, sorry.
Show 11 quoted lines
> > + test_when_finished "git rebase --abort; git checkout -f to-rebase" && > > + git checkout -b diverging && > > + test_commit attributes .gitattributes "* text=auto" attrs && > > + sha1="$(printf "1\\r\\n" | git hash-object -w --stdin)" && > > + git update-index --cacheinfo 0644 $sha1 file && > > + git commit -m v1-with-cr && > > + git checkout -f -b fails-to-rebase HEAD^ && > > It is unclear what the "-f" is for; is it attempting to clean up a > potential mess previous steps might have left? We didn't have it in > the previous test above.
It is there to clean up a very non-potential mess: forcing a CR/LF into a file marked with `text=auto` makes a royal mess. Neither `git reset --hard` nor `git stash` will make that file clean. As a consequence, the `git checkout` without an `-f` would *always* fail "because of uncommitted changes".
I clarified that in a comment.
Show 11 quoted lines
> > + test_commit v2-without-cr file "2" file2-lf && > > + test_must_fail git pull --rebase . diverging 2>err >out && > > + grep "When you have resolved this problem" out > > +' > > + > > test_expect_success '--rebase fails with multiple branches' ' > > git reset --hard before-rebase && > > test_must_fail git pull --rebase . copy master 2>err && > > Not worth a reroll but after this series settles we would probably > want to address some of the above up with a follow-up clean-up patch.
As I re-roll anyway, no big deal.
Ciao, Dscho