author | Jonathan Nieder <jrnieder@gmail.com> | |
Sat, 26 Nov 2011 02:30:02 +0000 (20:30 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 28 Nov 2011 19:40:46 +0000 (11:40 -0800) | ||
commit | 3f59481e338c2d3167b9654a4289a9d1201f7944 | |
tree | 04944df5313a8383faec47b1ad5d9b0426db2841 | tree | snapshot |
parent | 017d1e134545db0d162908f3538077eaa1f34fb6 | commit | diff |
branch: allow a no-op "branch -M <current-branch> HEAD"
Overwriting the current branch with a different commit is forbidden, as it
will make the status recorded in the index and the working tree out of
sync with respect to the HEAD. There however is no reason to forbid it if
the current branch is renamed to itself, which admittedly is something
only an insane user would do, but is handy for scripts.
Test script is by Conrad Irwin.
Reported-by: Soeren Sonnenburg <sonne@debian.org>
Reported-by: Josh Chia (谢任中)
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Overwriting the current branch with a different commit is forbidden, as it
will make the status recorded in the index and the working tree out of
sync with respect to the HEAD. There however is no reason to forbid it if
the current branch is renamed to itself, which admittedly is something
only an insane user would do, but is handy for scripts.
Test script is by Conrad Irwin.
Reported-by: Soeren Sonnenburg <sonne@debian.org>
Reported-by: Josh Chia (谢任中)
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/branch.c | diff | blob | history | |
t/t3200-branch.sh | diff | blob | history |