goto out;
}
+ if (!repo_peel_to_type(lm->rev.repo, obj->path, 0, obj->item, OBJ_COMMIT)) {
+ ret = error(_("revision argument '%s' is a %s, not a commit-ish"), obj->name, type_name(obj->item->type));
+ goto out;
+ }
+
diff_tree_oid(lm->rev.repo->hash_algo->empty_tree,
&obj->item->oid, "", &diffopt);
diff_flush(&diffopt);
test_commit 1 file &&
mkdir a &&
test_commit 2 a/file &&
+ git tag -mA t2 2 &&
mkdir a/b &&
test_commit 3 a/b/file
'
cat >expect &&
git ${indir:+-C "$indir"} last-modified "$@" >tmp.1 &&
- git name-rev --annotate-stdin --name-only --tags \
+ git name-rev --annotate-stdin --name-only --tags --exclude=t2 \
<tmp.1 >tmp.2 &&
tr '\t' ' ' <tmp.2 >actual &&
test_cmp expect actual
EOF
'
+test_expect_success 'last-modified on annotated tag' '
+ check_last_modified t2 <<-\EOF
+ 2 a
+ 1 file
+ EOF
+'
+
test_expect_success 'last-modified recursive with show-trees' '
check_last_modified -r -t <<-\EOF
3 a/b
test_grep "unknown last-modified argument: --foo" err
'
+test_expect_success 'last-modified expects commit-ish' '
+ test_must_fail git last-modified HEAD^{tree} 2>err &&
+ test_grep "revision argument ${SQ}HEAD^{tree}${SQ} is a tree, not a commit-ish" err
+'
+
test_done