// newScriptEngine returns a script engine augmented with commands for // reproducing version-control repositories by replaying commits. func newScriptEngine() *script.Engine { … } // loadScript interprets the given script content using the vcweb script engine. // loadScript always returns either a non-nil handler or a non-nil error. // // The script content must be a txtar archive with a comment containing a script // with exactly one "handle" command and zero or more VCS commands to prepare // the repository to be served. func (s *Server) loadScript(ctx context.Context, logger *log.Logger, scriptPath string, scriptContent []byte, workDir string) (http.Handler, error) { … } // newState returns a new script.State for executing scripts in workDir. func (s *Server) newState(ctx context.Context, workDir string) (*script.State, error) { … } // scriptEnviron returns a new environment that attempts to provide predictable // behavior for the supported version-control tools. func scriptEnviron(homeDir string) []string { … } // homeEnvName returns the environment variable used by os.UserHomeDir // to locate the user's home directory. func homeEnvName() string { … } // tempEnvName returns the environment variable used by os.TempDir // to locate the default directory for temporary files. func tempEnvName() string { … } // pathEnvName returns the environment variable used by exec.LookPath to // identify directories to search for executables. func pathEnvName() string { … } type scriptCtx … type scriptCtxKey … func (sc *scriptCtx) Value(key any) any { … } func getScriptCtx(st *script.State) (*scriptCtx, error) { … } func scriptAt() script.Cmd { … } func scriptHandle() script.Cmd { … } func scriptModzip() script.Cmd { … } func scriptUnquote() script.Cmd { … }