builtin-remote: make rm operation safer in mirrored repository
authorJay Soffian <jaysoffian@gmail.com>
Wed, 4 Feb 2009 16:06:07 +0000 (11:06 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 4 Feb 2009 16:47:57 +0000 (08:47 -0800)
commit441adf0ccf571a9fe15658fdfcd856d2aabc01cb
treea62a0da5285f95c265e33329929d8a62b7fa4ec9
parente02f1762b257c50124fc528e8b60bf16e8bb7acf
builtin-remote: make rm operation safer in mirrored repository

"git remote rm <repo>" happily removes non-remote refs and their reflogs.
This may be okay if the repository truely is a mirror, but if the user
had done "git remote add --mirror <repo>" by accident and was just
undoing their mistake, then they are left in a situation that is
difficult to recover from.

After this commit, "git remote rm" skips over non-remote refs. The user
is advised on how remove branches using "git branch -d", which itself
has nice safety checks wrt to branch removal lacking from "git remote rm".
Non-remote non-branch refs are skipped silently.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-remote.c
t/t5505-remote.sh