Check early that a new branch is new and valid
commit352eadc40024b141e1295693654ec20cc123844f
authorDaniel Barkalow <barkalow@iabervon.org>
Sun, 21 Sep 2008 18:36:06 +0000 (21 14:36 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Sep 2008 06:17:06 +0000 (21 23:17 -0700)
tree240eec2143c0d447bcea9aec3a56323abe4d909e
parentcc185a6a8ac24737a26ec4b40cc401c2db8b2e97
Check early that a new branch is new and valid

If you fail to update refs to change branches in checkout, your index
and working tree are left already updated. We don't have an easy way
to undo this, but at least we can check things that would make the
creation of a new branch fail. These checks were in the shell version,
and were lost in the C conversion.

The messages are from the shell version, and should probably be made nicer.

[jc: added test to t7201]

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-checkout.c
t/t7201-co.sh