Diff comments:

> diff --git a/gitbuildrecipe/tests/test_recipe.py 
> b/gitbuildrecipe/tests/test_recipe.py
> index ed7634d..7628a45 100644
> --- a/gitbuildrecipe/tests/test_recipe.py
> +++ b/gitbuildrecipe/tests/test_recipe.py
> @@ -891,6 +891,20 @@ class BuildTreeTests(GitTestCase):
>          self.assertRaises(
>              TargetAlreadyExists, pull_or_clone, base_branch, "target")
>  
> +    def test_pull_or_clone_with_no_HEAD(self):
> +        source = GitRepository("source")
> +        source.build_tree(["a"])
> +        source.add(["a"])
> +        commit = source.commit("one")
> +        source.branch("source/master", commit)
> +        source.set_head("refs/heads/nonexistent")

Functionally, pretty much, yes, but it's a lot easier to arrange since "git 
symbolic-ref" won't let you actually delete HEAD.  This is also somewhat more 
realistic, since the common case on Launchpad is that people end up with their 
default branch automatically set to refs/heads/master but don't have such a 
branch.

> +        base_branch = BaseRecipeBranch(
> +            "source", "1", 0.2, revspec="source/master")
> +        pull_or_clone(base_branch, "target")
> +        target = GitRepository("target", allow_create=False)
> +        self.assertEqual(commit, target.last_revision())
> +        self.assertEqual(commit, target.rev_parse("source/master"))
> +
>      def test_build_tree_runs_commands(self):
>          source = GitRepository("source")
>          commit = source.commit("one")


-- 
https://code.launchpad.net/~cjwatson/git-build-recipe/+git/git-build-recipe/+merge/368050
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/git-build-recipe:tolerate-missing-HEAD into git-build-recipe:master.

_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp

Reply via email to