aboutsummaryrefslogtreecommitdiff
path: root/t/t1401-symbolic-ref.sh
Commit message (Collapse)AuthorAge
* git symbolic-ref --delete $symrefJohan Herland2012-10-21
| | | | | | | | | | | | | Teach symbolic-ref to delete symrefs by adding the -d/--delete option to git-symbolic-ref. Both proper and dangling symrefs are deleted by this option, but other refs - or anything else that is not a symref - is not. The symref deletion is performed by first verifying that we are given a proper symref, and then invoking delete_ref() on it with the REF_NODEREF flag. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* tests: add missing &&Jonathan Nieder2010-11-09
| | | | | | | | | | | Breaks in a test assertion's && chain can potentially hide failures from earlier commands in the chain. Commands intended to fail should be marked with !, test_must_fail, or test_might_fail. The examples in this patch do not require that. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* symbolic-ref: allow refs/<whatever> in HEADJeff King2009-02-13
| | | | | | | | | | | | | | | | | Commit afe5d3d5 introduced a safety valve to symbolic-ref to disallow installing an invalid HEAD. It was accompanied by b229d18a, which changed validate_headref to require that HEAD contain a pointer to refs/heads/ instead of just refs/. Therefore, the safety valve also checked for refs/heads/. As it turns out, topgit is using refs/top-bases/ in HEAD, leading us to re-loosen (at least temporarily) the validate_headref check made in b229d18a. This patch does the corresponding loosening for the symbolic-ref safety valve, so that the two are in agreement once more. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* symbolic ref: refuse non-ref targets in HEADJeff King2009-01-29
When calling "git symbolic-ref" it is easy to forget that the target must be a fully qualified ref. E.g., you might accidentally do: $ git symbolic-ref HEAD master Unfortunately, this is very difficult to recover from, because the bogus contents of HEAD make git believe we are no longer in a git repository (as is_git_dir explicitly checks for "^refs/heads/" in the HEAD target). So immediately trying to fix the situation doesn't work: $ git symbolic-ref HEAD refs/heads/master fatal: Not a git repository and one is left editing the .git/HEAD file manually. Furthermore, one might be tempted to use symbolic-ref to set up a detached HEAD: $ git symbolic-ref HEAD `git rev-parse HEAD` which sets up an even more bogus HEAD: $ cat .git/HEAD ref: 1a9ace4f2ad4176148e61b5a85cd63d5604aac6d This patch introduces a small safety valve to prevent the specific case of anything not starting with refs/heads/ to go into HEAD. The scope of the safety valve is intentionally very limited, to make sure that we are not preventing any behavior that would otherwise be valid (like pointing a different symref than HEAD outside of refs/heads/). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>