File tree 2 files changed +13
-6
lines changed
src/main/groovy/net/minecrell/gitpatcher/task/patch
2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ plugins {
12
12
}
13
13
14
14
group = ' net.minecrell'
15
- version = ' 0.5.1 '
15
+ version = ' 0.5.2 '
16
16
description = ' A Gradle plugin to manage patches for Git repositories'
17
17
18
18
sourceCompatibility = 1.6
Original file line number Diff line number Diff line change @@ -71,14 +71,21 @@ class MakePatchesTask extends PatchTask {
71
71
def first = diff. findIndexOf(HUNK )
72
72
if (first >= 0 && diff[first + 1 ]. startsWith(' From' , 1 )) {
73
73
def last = diff. findLastIndexOf(HUNK )
74
- if (last >= 0 && diff[last + 1 ]. startsWith(' --' , 1 )) {
74
+ boolean upToDate = false
75
+ if (first == last) { // There is just one hunk, so probably just the hash changed
76
+ upToDate = true
77
+ } else if (last >= 0 && diff[last + 1 ]. startsWith(' --' , 1 )) {
75
78
if (! diff. subList(first + 4 , last). find(HUNK )) {
76
- logger. lifecycle ' Skipping {} (up-to-date)' , patch. name
77
- git. reset(' HEAD' , patch. absolutePath) >> null
78
- git. checkout(' --' , patch. absolutePath) >> null
79
- continue
79
+ upToDate = true
80
80
}
81
81
}
82
+
83
+ if (upToDate) {
84
+ logger. lifecycle ' Skipping {} (up-to-date)' , patch. name
85
+ git. reset(' HEAD' , patch. absolutePath) >> null
86
+ git. checkout(' --' , patch. absolutePath) >> null
87
+ continue
88
+ }
82
89
}
83
90
84
91
didWork = true
You can’t perform that action at this time.
0 commit comments