Skip to content

Commit

Permalink
Blame: improve error messages for the , operation
Browse files Browse the repository at this point in the history
The message is now:

   Commit f4657f0 has no ancestors modifying the seleted line

instead of  

   The selected commit has no parents

This addresses a portion of jonas#1315.

Apart from being a bit clearer, the user will be able to learn what `,`
is meant to do from it. In particular, they should notice that commit
`f4657f00` is the commit on the selected *line*, not the commit that is
currently displayed in general.

Trying to press `,` a few times is a natural thing to try to do after
reading the help while trying to figure out how blame works in tig.
  • Loading branch information
ilyagr committed Feb 13, 2024
1 parent e83bbbd commit 1444a54
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,12 @@ blame_go_forward(struct view *view, struct blame *blame, bool parent)
const char *filename = parent ? commit->parent_filename : commit->filename;

if (!*id && parent) {
report("The selected commit has no parents");
report("Commit %.8s has no ancestors modifying the selected line", commit->id);
return;
}

if (!strcmp(history_state->id, id) && !strcmp(history_state->filename, filename)) {
report("The selected commit is already displayed");
report("Commit %.8s is already beind displayed", commit->id);
return;
}

Expand Down

0 comments on commit 1444a54

Please sign in to comment.