src/git/exec.bend relies on unsafe/foreign
raw source on the hub · import 0x74799d3f846634a3d7461d4336d7c9d4/src/git/exec.bend as Exec
git/exec: the git commands the interpreters run: a shallow clone of one commit, a checkout weighed for its NAR hash, HEAD on a remote, and whether one commit descends from another. What they print is read by the pure functions in git/git.bend. They live apart from those because git runs through snap's foreign effect, and bend 2.0.32 fails a proof whose imports reach foreign code, so a law may import git/git but never this.
7 imports
import Base import 0xabe575924687afad4cee1a2c1194d639/main.bend as R import ../pkg/path.bend as P import ../sha/dump.bend as Dump import ../share/say.bend as Say import ../share/spin.bend as Spin import ./git.bend as G
Definitions
def ran source · line 16 · raw
@ok:Bool -> @what:String -> @text:String -> IO(Unit)
a git command that failed stops the command, with whatever git said
def run source · line 24 · raw
@what:String -> @args:List<&2, String> -> IO(Unit)
one git command
def anchored source · line 35 · raw
@+url:String -> IO(String)
a source as git is to read it. A ledger records a local path as it was
given, relative to the project, which is the directory ez runs in, so the
ledger reads the same on every clone. git reads such a path from somewhere
else: a fetch from inside its work directory, and ls-remote from the top
of any repository around it. Every git command here that is handed a source
is handed this instead.
def clone.say source · line 43 · raw
@+work:String -> @+url:String -> @+rev:String -> @+msg:String -> IO(Unit)
the checkout a package is taken from: the pinned commit alone, at the depth of one, so a repo with a long history costs nothing to vendor. The fetch is quiet; the line above it is what a person sees while it runs.
def clone source · line 53 · raw
@+work:String -> @+url:String -> @+rev:String -> IO(Unit)
a shallow clone of one commit into work, with a line saying what it fetches
def nar source · line 59 · raw
@+work:String -> IO(String)
the NAR hash nix rebuilds the checkout by. fetchgit hashes the working
tree with its .git taken off, so that is what is weighed here and the
caller strips .git before asking. Computed in Bend; nix is not required.
def weigh source · line 64 · raw
@+url:String -> @+rev:String -> IO(String)
the NAR hash of one commit. The checkout is weighed the way fetchgit
weighs it, then removed. Nothing is laid under BEND_LIB.
def remote.got source · line 78 · raw
@empty:Bool -> @+rev:String -> @+branch:String -> @+url:String -> IO(0x74799d3f846634a3d7461d4336d7c9d4/src/git/git.Tip)
a remote with no HEAD is not a repo an upgrade can move
def remote.said source · line 86 · raw
@ok:Bool -> @+url:String -> @+text:String -> IO(0x74799d3f846634a3d7461d4336d7c9d4/src/git/git.Tip)
what ls-remote said, or why it said nothing
def remote source · line 96 · raw
@+url:String -> IO(0x74799d3f846634a3d7461d4336d7c9d4/src/git/git.Tip)
HEAD on the remote: the commit the default branch tips, and that branch's
name. --symref is what puts the branch on the line in front of the commit.
def clone.bare source · line 104 · raw
@+work:String -> @+url:String -> IO(Unit)
a bare clone, blobs left behind. Ancestry only needs the commits. The clone is quiet; the line is what shows while it runs.
def descendant.no source · line 113 · raw
@no:Bool -> @+text:String -> IO(Bool)
merge-base answers 0 for a descendant, 1 for anything else, and some other status when the question itself could not be asked
def descendant.pick source · line 121 · raw
@yes:Bool -> @no:Bool -> @text:String -> IO(Bool)
the status, read
def descendant.code source · line 129 · raw
@+code:String -> @+text:String -> IO(Bool)
the status a merge-base answered with
def descendant.clone source · line 134 · raw
@+work:String -> @+url:String -> @+pin:String -> @+tip:String -> IO(Bool)
the clone, the question, the clone gone. The same commit is a descendant of itself and needs no clone to say so.
def descendant.go source · line 144 · raw
@same:Bool -> @work:String -> @url:String -> @pin:String -> @tip:String -> IO(Bool)
whether tip descends from pin, the same commit included
def descendant.at source · line 152 · raw
@+work:String -> @+url:String -> @+pin:String -> @+tip:String -> IO(Bool)
whether tip descends from pin. work is a directory the clone may use.