Last active
May 27, 2022 16:51
-
-
Save hastebrot/1268c22907e90617f059d1ce1f360e40 to your computer and use it in GitHub Desktop.
isomorphic-git in deno
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S deno run --no-check --allow-env --allow-read --allow-write --allow-net isogit.ts | |
import fs from "https://deno.land/[email protected]/node/fs.ts"; | |
import path from "https://deno.land/[email protected]/node/path.ts"; | |
import git from "https://esm.sh/[email protected]"; | |
import http from "https://esm.sh/[email protected]/http/node.js"; | |
const repositoryDir = path.join(Deno.cwd(), "/../test-repository"); | |
const repositoryUrl = "https://github.com/isomorphic-git/lightning-fs"; | |
await git.clone({ | |
fs, | |
http, | |
dir: repositoryDir, | |
url: repositoryUrl, | |
ref: "main", | |
singleBranch: true, | |
noCheckout: true, | |
}); | |
const realRepositoryDir = await Deno.realPath(repositoryDir); | |
console.log("repository dir:", realRepositoryDir); | |
const commitObjectId = await git.resolveRef({ | |
fs, | |
dir: realRepositoryDir, | |
ref: "HEAD", | |
}); | |
const object = await git.readCommit({ | |
fs, | |
dir: realRepositoryDir, | |
oid: commitObjectId, | |
}); | |
console.log("commit object:", object); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment