Skip to content

Commit

Permalink
Fix "Blame to previous revision"
Browse files Browse the repository at this point in the history
to select the first commit before the revision selected (so the previous, no!?!)

Partly fix gitextensions#6605
  • Loading branch information
pmiossec committed Jul 2, 2019
1 parent 869be49 commit eb142f1
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions GitUI/UserControls/BlameControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -466,24 +466,25 @@ private void blamePreviousRevisionToolStripMenuItem_Click(object sender, EventAr
}

var objectId = _blame.Lines[line].Commit.ObjectId;
int originalLine = _blame.Lines[line].OriginLineNumber;
GitBlame blame = Module.Blame(_fileName, objectId + "^", _encoding, originalLine + ",+1");
if (blame.Lines.Count > 0)

var selectedRevision = _revGrid.GetRevision(objectId);
if (selectedRevision == null)
{
var revision = blame.Lines[0].Commit.ObjectId;
if (_revGrid != null)
{
_clickedBlameLine = blame.Lines[0];
_revGrid.SetSelectedRevision(revision);
}
else
return;
}

if (!selectedRevision.HasParent)
{
_revGrid.SetSelectedRevision(selectedRevision);
using (var frm = new FormCommitDiff(UICommands, selectedRevision.ObjectId))
{
using (var frm = new FormCommitDiff(UICommands, revision))
{
frm.ShowDialog(this);
}
frm.ShowDialog(this);
}

return;
}

_revGrid.SetSelectedRevision(selectedRevision.FirstParentGuid);
}

private void showChangesToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down

0 comments on commit eb142f1

Please sign in to comment.