Beispiel #1
0
    def test_ref_resolve(self):
        gitdir = repo_create(".")

        master_sha = "d6ae59694dfec74d7f5ca87608f31c884dc9b0f9"
        master = gitdir / "refs" / "heads" / "master"
        self.fs.create_file(master, contents=master_sha)
        data = ref_resolve(gitdir, "HEAD")
        self.assertEqual(master_sha, data)

        ref = "refs/heads/master"
        data = ref_resolve(gitdir, ref)
        self.assertEqual(master_sha, data)
Beispiel #2
0
def cmd_rev_parse(args: argparse.Namespace) -> None:
    gitdir = repo_find()
    sha = ref_resolve(gitdir, args.rev)
    print(sha)