From: Zachary Stevens Date: Thu, 12 Nov 2009 20:21:37 +0000 (+0000) Subject: Removed unused methods on Project. X-Git-Tag: 0.000000_01~40 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fc11c7f105ef7e139f3bc7d0525896900fa033c9;p=catagits%2FGitalist.git Removed unused methods on Project. --- diff --git a/lib/Gitalist/Git/Project.pm b/lib/Gitalist/Git/Project.pm index 853f0c5..b698e74 100644 --- a/lib/Gitalist/Git/Project.pm +++ b/lib/Gitalist/Git/Project.pm @@ -223,21 +223,7 @@ The keys for each item will be: return ($rev =~ /^($SHA1RE)$/); } - # Should be in ::Object - method get_object_mode_string (Gitalist::Git::Object $object) { - return $object->modestr; - } - - method get_object_type (NonEmptySimpleStr $sha1) { - return $self->get_object($sha1)->type; - } - - method cat_file (NonEmptySimpleStr $sha1) { - return $self->get_object($sha1)->contents; - } - - method hash_by_path ($base, $path?, $type?) { - $path ||= ''; + method hash_by_path ($base, $path = '', $type?) { $path =~ s{/+$}(); # FIXME should this really just take the first result? my @paths = $self->run_cmd('ls-tree', $base, '--', $path) diff --git a/t/02git_project.t b/t/02git_project.t index 90c8b38..02d4257 100644 --- a/t/02git_project.t +++ b/t/02git_project.t @@ -43,10 +43,7 @@ isa_ok(($proj->list_tree)[1], 'Gitalist::Git::Object'); my $obj1 = $proj->get_object('5716ca5987cbf97d6bb54920bea6adde242d87e6'); isa_ok($obj1, 'Gitalist::Git::Object'); -# Test methods that really should be called on ::Object -# This is transitional from Git.pm -my $obj = ($proj->list_tree)[1]; -isa_ok($obj, 'Gitalist::Git::Object'); -is($proj->get_object_mode_string($obj), '-rw-r--r--', "get_object_mode_string"); -is($proj->get_object_type('5716ca5987cbf97d6bb54920bea6adde242d87e6'), 'blob', "get_object_type"); -is($proj->cat_file('5716ca5987cbf97d6bb54920bea6adde242d87e6'), "bar\n", 'cat_file'); +my $hbp_sha1 = $proj->hash_by_path('36c6c6708b8360d7023e8a1649c45bcf9b3bd818', 'dir1/file2'); +my $obj2 = $proj->get_object($hbp_sha1); +is($obj2->type, 'blob', 'hash_by_path obj is a file'); +is($obj2->contents, "foo\n", 'hash_by_path obj is a file');