File tree Expand file tree Collapse file tree 2 files changed +26
-10
lines changed Expand file tree Collapse file tree 2 files changed +26
-10
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,10 @@ namespace SourceGit.Commands
66{
77 public partial class CompareRevisions : Command
88 {
9- [ GeneratedRegex ( @"^([MADRC ])\s+(.+)$" ) ]
9+ [ GeneratedRegex ( @"^([MADC ])\s+(.+)$" ) ]
1010 private static partial Regex REG_FORMAT ( ) ;
11+ [ GeneratedRegex ( @"^R[0-9]{0,4}\s+(.+)$" ) ]
12+ private static partial Regex REG_RENAME_FORMAT ( ) ;
1113
1214 public CompareRevisions ( string repo , string start , string end )
1315 {
@@ -38,7 +40,17 @@ protected override void OnReadline(string line)
3840 {
3941 var match = REG_FORMAT ( ) . Match ( line ) ;
4042 if ( ! match . Success )
43+ {
44+ match = REG_RENAME_FORMAT ( ) . Match ( line ) ;
45+ if ( match . Success )
46+ {
47+ var renamed = new Models . Change ( ) { Path = match . Groups [ 1 ] . Value } ;
48+ renamed . Set ( Models . ChangeState . Renamed ) ;
49+ _changes . Add ( renamed ) ;
50+ }
51+
4152 return ;
53+ }
4254
4355 var change = new Models . Change ( ) { Path = match . Groups [ 2 ] . Value } ;
4456 var status = match . Groups [ 1 ] . Value ;
@@ -57,10 +69,6 @@ protected override void OnReadline(string line)
5769 change . Set ( Models . ChangeState . Deleted ) ;
5870 _changes . Add ( change ) ;
5971 break ;
60- case 'R' :
61- change . Set ( Models . ChangeState . Renamed ) ;
62- _changes . Add ( change ) ;
63- break ;
6472 case 'C' :
6573 change . Set ( Models . ChangeState . Copied ) ;
6674 _changes . Add ( change ) ;
Original file line number Diff line number Diff line change @@ -9,8 +9,10 @@ namespace SourceGit.Commands
99 /// </summary>
1010 public partial class QueryStashChanges : Command
1111 {
12- [ GeneratedRegex ( @"^([MADRC ])\s+(.+)$" ) ]
12+ [ GeneratedRegex ( @"^([MADC ])\s+(.+)$" ) ]
1313 private static partial Regex REG_FORMAT ( ) ;
14+ [ GeneratedRegex ( @"^R[0-9]{0,4}\s+(.+)$" ) ]
15+ private static partial Regex REG_RENAME_FORMAT ( ) ;
1416
1517 public QueryStashChanges ( string repo , string stash )
1618 {
@@ -31,7 +33,17 @@ public QueryStashChanges(string repo, string stash)
3133 {
3234 var match = REG_FORMAT ( ) . Match ( line ) ;
3335 if ( ! match . Success )
36+ {
37+ match = REG_RENAME_FORMAT ( ) . Match ( line ) ;
38+ if ( match . Success )
39+ {
40+ var renamed = new Models . Change ( ) { Path = match . Groups [ 1 ] . Value } ;
41+ renamed . Set ( Models . ChangeState . Renamed ) ;
42+ outs . Add ( renamed ) ;
43+ }
44+
3445 continue ;
46+ }
3547
3648 var change = new Models . Change ( ) { Path = match . Groups [ 2 ] . Value } ;
3749 var status = match . Groups [ 1 ] . Value ;
@@ -50,10 +62,6 @@ public QueryStashChanges(string repo, string stash)
5062 change . Set ( Models . ChangeState . Deleted ) ;
5163 outs . Add ( change ) ;
5264 break ;
53- case 'R' :
54- change . Set ( Models . ChangeState . Renamed ) ;
55- outs . Add ( change ) ;
56- break ;
5765 case 'C' :
5866 change . Set ( Models . ChangeState . Copied ) ;
5967 outs . Add ( change ) ;
You can’t perform that action at this time.
0 commit comments