File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -153,8 +153,24 @@ private void SetViewContentAsDiff()
153
153
{
154
154
var revisionFilePath = new Commands . QueryFilePathInRevision ( _repo . FullPath , _revision . SHA , _file ) . Result ( ) ;
155
155
156
- var option = new Models . DiffOption ( _revision , revisionFilePath ) ;
157
- ViewContent = new DiffContext ( _repo . FullPath , option , _viewContent as DiffContext ) ;
156
+ if ( _revision . Parents . Count > 0 )
157
+ {
158
+ var parentSHA = _revision . Parents [ 0 ] ;
159
+ var changes = new Commands . CompareRevisions ( _repo . FullPath , parentSHA , _revision . SHA ) . Result ( ) ;
160
+ foreach ( var change in changes )
161
+ {
162
+ if ( ( change . WorkTree == Models . ChangeState . Renamed || change . Index == Models . ChangeState . Renamed )
163
+ && change . Path == revisionFilePath )
164
+ {
165
+ var option = new Models . DiffOption ( parentSHA , _revision . SHA , change ) ;
166
+ ViewContent = new DiffContext ( _repo . FullPath , option , _viewContent as DiffContext ) ;
167
+ return ;
168
+ }
169
+ }
170
+ }
171
+
172
+ var defaultOption = new Models . DiffOption ( _revision , revisionFilePath ) ;
173
+ ViewContent = new DiffContext ( _repo . FullPath , defaultOption , _viewContent as DiffContext ) ;
158
174
}
159
175
160
176
[ GeneratedRegex ( @"^version https://git-lfs.github.com/spec/v\d+\r?\noid sha256:([0-9a-f]+)\r?\nsize (\d+)[\r\n]*$" ) ]
You can’t perform that action at this time.
0 commit comments