{"record":{"id":"52f03dcfb71582f0","repo":"jesseduffield/lazygit","slug":"entire-file","errorCode":null,"errorMessage":"Entire file","messagePattern":"Entire file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/gui/controllers/helpers/fixup_helper.go","lineNumber":335,"sourceCode":"\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tappendBlamedLine(blameOutput)\n\t\t\t}\n\n\t\t\t// Blame the line after this hunk. We don't know how many lines the\n\t\t\t// file has, so we can't check if there is a line after the hunk;\n\t\t\t// let the error tell us.\n\t\t\tblameOutput, err := self.c.Git().Blame.BlameLineRange(h.filename, \"HEAD\", h.startLineIdx+1, 1)\n\t\t\tif err != nil {\n\t\t\t\t// If this fails, we're probably at the end of the file (we\n\t\t\t\t// could have checked this beforehand, but it's expensive). If\n\t\t\t\t// there was a line before this hunk, this is fine, we'll just\n\t\t\t\t// return that one; if not, the hunk encompasses the entire\n\t\t\t\t// file, and we can't blame the lines before and after the hunk.\n\t\t\t\t// This is an error.\n\t\t\t\tif h.startLineIdx == 0 {\n\t\t\t\t\treturn errors.New(\"Entire file\") // TODO i18n\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tappendBlamedLine(blameOutput)\n\t\t\t}\n\n\t\t\thashesChan <- result\n\t\t\treturn nil\n\t\t})\n\t}\n\n\tgo func() {\n\t\t// We don't care about the error here, we'll check it later (in the\n\t\t// return statement below). Here we only wait for all the goroutines to\n\t\t// finish so that we can close the channel.\n\t\t_ = errg.Wait()\n\t\tclose(hashesChan)\n\t}()\n","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/controllers/helpers/fixup_helper.go#L317-L353","documentation":"Internal sentinel returned inside FixupHelper.blameDeletedLines (marked TODO i18n) when a deleted-lines hunk starts at line 0 AND blaming the line after the hunk fails: the hunk spans the entire file, so there is no context line before or after to attribute the deletion to a base commit. The message 'Entire file' is a developer-facing placeholder, not a polished user-facing string.","triggerScenarios":"Invoking fixup on a deleted file/hunk where the deletion begins at line 1 and the file has no trailing line after the hunk — e.g. selecting the whole-file deletion of a newly added file and pressing shift-F.","commonSituations":"Deleting an entire file that was added in an earlier commit on the branch and trying to fixup that deletion; whole-file replacements pasted over the original content.","solutions":["Fixup does not support whole-file deletions; commit the deletion normally (it is a new change, not an amendment).","If the file was added by mistake in the branch's last commit, use amend or drop that commit instead."],"exampleFix":"// before\nif h.startLineIdx == 0 {\n    return errors.New(\"Entire file\") // TODO i18n\n}\n\n// after\nif h.startLineIdx == 0 {\n    return errors.New(self.c.Tr.FixupEntireFileNotSupported) // add to english.go\n}","handlingStrategy":"fallback","validationCode":"// detect whole-file hunks up front:\nif h.startLineIdx == 0 && hunkSpansRestOfFile { /* commit normally; fixup unsupported */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't fixup whole-file deletions; they are new changes against merged history","If the add was the branch's last commit, amend or drop it instead"],"tags":["git","fixup","blame","whole-file","untranslated"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}