File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
src/main/groovy/net/minecrell/gitpatcher/task/patch Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ plugins {
1212}
1313
1414group = ' net.minecrell'
15- version = ' 0.5.1 '
15+ version = ' 0.5.2 '
1616description = ' A Gradle plugin to manage patches for Git repositories'
1717
1818sourceCompatibility = 1.6
Original file line number Diff line number Diff line change @@ -71,14 +71,21 @@ class MakePatchesTask extends PatchTask {
7171 def first = diff. findIndexOf(HUNK )
7272 if (first >= 0 && diff[first + 1 ]. startsWith(' From' , 1 )) {
7373 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 )) {
7578 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
8080 }
8181 }
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+ }
8289 }
8390
8491 didWork = true
You can’t perform that action at this time.
0 commit comments