{"record":{"id":"079d845883c36204","repo":"gitbutlerapp/gitbutler","slug":"no-diffs-to-show","errorCode":null,"errorMessage":"No diffs to show.","messagePattern":"No diffs to show\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/but/src/command/legacy/diff/mod.rs","lineNumber":63,"sourceCode":"            CliId::CommittedFile {\n                committed_file:\n                    CommittedFileId {\n                        commit_id, path, ..\n                    },\n                id: _,\n            } => DiffFileEntry::from_commit(ctx, commit_id, Some(path))?,\n            CliId::Commit {\n                commit: CommitId { commit_id, .. },\n                id: _,\n            } => DiffFileEntry::from_commit(ctx, commit_id, None)?,\n            CliId::Branch(branch) => DiffFileEntry::from_branch(ctx, branch.name)?,\n        }\n    } else {\n        DiffFileEntry::from_worktree(&id_map, None)\n    };\n\n    if files.is_empty() {\n        anyhow::bail!(\"No diffs to show.\");\n    }\n\n    crate::tui::diff_viewer::run_diff_viewer(files)\n}\n\npub fn handle(\n    ctx: &mut Context,\n    out: &mut OutputChannel,\n    target_str: Option<&str>,\n) -> anyhow::Result<()> {\n    let id_map = IdMap::legacy_new_from_context(ctx)?;\n\n    if let Some(entity) = target_str {\n        let id = id_map\n            .parse_using_context(entity, ctx)? // TODO: look up plain names\n            .first() // TODO: handle ambiguity\n            .cloned()\n            .ok_or_else(|| anyhow::anyhow!(\"No ID found for entity\"))?;","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/diff/mod.rs#L45-L81","documentation":"`but diff` opens the TUI diff viewer for a chosen target: a file inside a commit, a whole commit, a branch/lane, or (by default) the worktree. After `DiffFileEntry::from_commit`/`from_branch`/`from_worktree` collects the changed files, an empty list means there is nothing to render, so the command bails instead of launching an empty viewer.","triggerScenarios":"`but diff` with no argument on a clean worktree; `but diff <commit-id>` where the commit's diff is empty (empty/revert-style commit with no net changes); `but diff <branch-id>` for a lane with no diff against the base; `but diff <commit-id> <path>` where that commit did not touch the path.","commonSituations":"Running the viewer right after committing or absorbing everything; selecting a commit whose changes are identical to its parent; assuming a file was changed by a commit when it was not.","solutions":["Run `but status` and confirm uncommitted changes exist before a bare `but diff`.","Pick a target that actually changed files, e.g. `but diff <commit-id>` for a content-changing commit.","If you expected worktree changes, verify with `git status` that the worktree is not clean."],"exampleFix":"# before\nbut diff          # clean worktree -> No diffs to show.\n\n# after\nbut diff 3k       # open the diff of a commit that changed files","handlingStrategy":"validation","validationCode":"# Only open the viewer when the worktree actually has changes\n[ -n \"$(git status --porcelain)\" ] && but diff || echo 'nothing to diff'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat this as a benign empty result: check for changes before launching the viewer in scripts.","When diffing a commit, pick one you know modified files.","In wrappers, branch on the message and exit zero instead of failing the pipeline."],"tags":["cli","diff","empty-result","tui","gitbutler"],"backgroundTag":"empty-result-set","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}