eths-git
Version:
**eths-git-remote** is a decentralized Git solution designed to manage repositories on-chain. It provides two main components:
30 lines (29 loc) • 848 B
JavaScript
import * as path from 'path';
import { parseEthsURI } from "../utils/index.js";
import Eths from "./eths.js";
let eths;
export async function createImpl(env) {
// init sdk
let gitDirCandidate = env['GIT_DIR'];
if (!gitDirCandidate) {
gitDirCandidate = '.git';
}
const gitdir = path.resolve(gitDirCandidate);
const [, , , remoteUrl] = process.argv;
const protocol = await parseEthsURI(remoteUrl);
eths = await Eths.create(gitdir, protocol);
return {
list: async (forPush) => {
return await eths.doList(forPush);
},
handlePush: async (refs) => {
return await eths.doPush(refs);
},
handleFetch: async (p) => {
return await eths.doFetch(p);
},
close: async () => {
await eths.close();
}
};
}