Re: [PATCH v4 01/16] Verify that `git pull --rebase` shows the helpful advice when failing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Junio,

On Mon, 25 Jul 2016, Junio C Hamano wrote:

> Johannes Schindelin <johannes.schindelin@xxxxxx> 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.

> > +	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.

> > +	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.

> > +	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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]