Skip to content

Commit b5f1295

Browse files
authored
Merge pull request #7 from lambdalisue/support-old-git
Do NOT use `--format` in `git-ls-tree`
2 parents 5f46e60 + b1298cb commit b5f1295

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

object_url.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ async function getObjectType(
3939
commitish: string,
4040
path: string,
4141
options: ExecuteOptions = {},
42-
): Promise<ObjectType> {
42+
): Promise<ObjectType | undefined> {
4343
const stdout = await execute(
44-
["ls-tree", "-t", "--format=%(objecttype)", commitish, path],
44+
["ls-tree", "-t", commitish, path],
4545
options,
4646
);
47-
return stdout.trim().split("\n").at(0) as ObjectType;
47+
return stdout.trim().split("\n").at(0)?.split(" ").at(1) as ObjectType;
4848
}
4949

5050
function parsePath(path: string): [string, Range | undefined] {

0 commit comments

Comments
 (0)