Exemplo n.º 1
0
void test_repo_head__orphan_branch_does_not_count(void)
{
    git_signature *sig;
    git_oid id;
    const char *msg;

    cl_git_pass(git_signature_now(&sig, "me", "*****@*****.**"));

    /* Have something known */
    msg = "message1";
    git_oid_fromstr(&id, "e90810b8df3e80c413d903f631643c716887138d");
    cl_git_pass(git_repository_set_head_detached(repo, &id, sig, msg));
    assert_head_reflog(repo, 0, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750",
                       "e90810b8df3e80c413d903f631643c716887138d", msg);

    /* Switching to an orphan branch does not write tot he reflog */
    cl_git_pass(git_repository_set_head(repo, "refs/heads/orphan", sig, "ignored message"));
    assert_head_reflog(repo, 0, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750",
                       "e90810b8df3e80c413d903f631643c716887138d", msg);

    /* And coming back, we set the source to zero */
    msg = "message2";
    cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked", sig, msg));
    assert_head_reflog(repo, 0, "0000000000000000000000000000000000000000",
                       "258f0e2a959a364e40ed6603d5d44fbb24765b10", msg);

    git_signature_free(sig);
}
Exemplo n.º 2
0
void test_repo_head__detaching_writes_reflog(void)
{
    git_signature *sig;
    git_oid id;
    const char *msg;

    cl_git_pass(git_signature_now(&sig, "me", "*****@*****.**"));

    msg = "checkout: moving from master to e90810b8df3e80c413d903f631643c716887138d";
    git_oid_fromstr(&id, "e90810b8df3e80c413d903f631643c716887138d");
    cl_git_pass(git_repository_set_head_detached(repo, &id));
    assert_head_reflog(repo, 0, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750",
                       "e90810b8df3e80c413d903f631643c716887138d", msg);

    msg = "checkout: moving from e90810b8df3e80c413d903f631643c716887138d to haacked";
    cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked"));
    assert_head_reflog(repo, 0, "e90810b8df3e80c413d903f631643c716887138d",
                       "258f0e2a959a364e40ed6603d5d44fbb24765b10", msg);

    git_signature_free(sig);
}
Exemplo n.º 3
0
void test_repo_head__orphan_branch_does_not_count(void)
{
    git_oid id;
    const char *msg;

    /* Have something known */
    msg = "checkout: moving from master to e90810b8df3e80c413d903f631643c716887138d";
    git_oid_fromstr(&id, "e90810b8df3e80c413d903f631643c716887138d");
    cl_git_pass(git_repository_set_head_detached(repo, &id));
    assert_head_reflog(repo, 0, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750",
                       "e90810b8df3e80c413d903f631643c716887138d", msg);

    /* Switching to an orphan branch does not write tot he reflog */
    cl_git_pass(git_repository_set_head(repo, "refs/heads/orphan"));
    assert_head_reflog(repo, 0, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750",
                       "e90810b8df3e80c413d903f631643c716887138d", msg);

    /* And coming back, we set the source to zero */
    msg = "checkout: moving from orphan to haacked";
    cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked"));
    assert_head_reflog(repo, 0, "0000000000000000000000000000000000000000",
                       "258f0e2a959a364e40ed6603d5d44fbb24765b10", msg);
}