{"record":{"id":"66a652aff231da01","repo":"mislav/hub","slug":"can-t-load-git-log-s-s","errorCode":null,"errorMessage":"Can't load git log %s..%s","messagePattern":"Can't load git log (.+?)\\.\\.(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"git/git.go","lineNumber":236,"sourceCode":"\tcmd.Stderr = nil\n\tcmd.WithArg(\"-c\").WithArg(\"log.showSignature=false\")\n\tcmd.WithArg(\"show\").WithArg(\"-s\").WithArg(\"--format=%s%n%+b\").WithArg(sha)\n\n\toutput, err := cmd.Output()\n\treturn strings.TrimSpace(output), err\n}\n\nfunc Log(sha1, sha2 string) (string, error) {\n\texecCmd := cmd.New(\"git\")\n\texecCmd.WithArg(\"-c\").WithArg(\"log.showSignature=false\").WithArg(\"log\").WithArg(\"--no-color\")\n\texecCmd.WithArg(\"--format=%h (%aN, %ar)%n%w(78,3,3)%s%n%+b\")\n\texecCmd.WithArg(\"--cherry\")\n\tshaRange := fmt.Sprintf(\"%s...%s\", sha1, sha2)\n\texecCmd.WithArg(shaRange)\n\n\toutputs, err := execCmd.Output()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Can't load git log %s..%s\", sha1, sha2)\n\t}\n\n\treturn outputs, nil\n}\n\nfunc Remotes() ([]string, error) {\n\tremoteCmd := gitCmd(\"remote\", \"-v\")\n\tremoteCmd.Stderr = nil\n\toutput, err := remoteCmd.Output()\n\treturn outputLines(output), err\n}\n\nfunc Config(name string) (string, error) {\n\treturn gitGetConfig(name)\n}\n\nfunc ConfigAll(name string) ([]string, error) {\n\tmode := \"--get-all\"","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/git/git.go#L218-L254","documentation":"Log() runs `git log --cherry a...b` to obtain the commit log between two SHAs and returns the raw output as a string. When the git log command fails, it wraps the failure as \"Can't load git log <sha1>..<sha2>\", meaning the range cannot be computed from the local object store.","triggerScenarios":"Calling git.Log(sha1, sha2) (via pullRequest, TestGitLog) with unknown SHAs, SHAs from a shallow clone, or objects pruned by gc — rev-list/log then exits non-zero.","commonSituations":"Shallow CI checkouts (clone --depth 1) missing history between the SHAs; referencing SHAs from a force-pushed/rebased branch; fork PR base commits not fetched locally.","solutions":["Fetch full history: git fetch --unshallow (or increase --depth)","Verify both SHAs exist: git cat-file -e <sha>^{commit}","Fetch the PR's base ref if working with fork branches","Check for force-pushes that orphaned the referenced SHAs"],"exampleFix":"// before\nout, err := git.Log(baseSha, headSha)\n// after\nif err := run(\"git\", \"fetch\", \"--unshallow\"); err != nil {\n    return err\n}\nout, err := git.Log(baseSha, headSha)","handlingStrategy":"retry","validationCode":"for _, s := range []string{sha1, sha2} {\n    if exec.Command(\"git\", \"cat-file\", \"-e\", s+\"^{commit}\").Run() != nil {\n        return fmt.Errorf(\"commit %s not present locally; fetch/unshallow first\", s)\n    }\n}","typeGuard":null,"tryCatchPattern":"out, err := git.Log(sha1, sha2)\nif err != nil {\n    _ = exec.Command(\"git\", \"fetch\", \"--unshallow\").Run() // or fetch missing refs\n    out, err = git.Log(sha1, sha2)\n    if err != nil {\n        return fmt.Errorf(\"git log %s...%s unavailable even after fetch\", sha1, sha2)\n    }\n}","preventionTips":["Avoid --depth 1 clones when log ranges are needed, or unshallow first","Fetch PR base refs before computing logs","Re-check SHAs after force-pushes/rebases","Verify commits exist with git cat-file before log queries"],"tags":["git","log","shallow-clone","history"],"backgroundTag":"unknown-revision","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}