wiggle
wiggle copied to clipboard
ignore new white space in the patch context
unexpected new line in context
if a new line has appeared in the patch context since the patch was created the patch is not cleanly applied
there could be a flag to ignore this type of conflict instead of forcing a manual edit
proposed solution: compare the found and expected section. if the difference is only white space characters write the replacement without a conflict message
in this example i would like to use the replacement as it is without creating a conflict message that an extra new line is now in the context that was not there before
alias copy=termux-clipboard-set
alias ws="sed 's/ /·/g;s/\t/→/g;s/\r/§/g;s/$/¶/g'"
printf "a\n\nc">orig
printf "a\n\nb\n\nc">new
diff orig new -Naru>patch
cat patch|ws|copy
---·orig→2024-05-19·00:06:29.249319646·+0300¶
+++·new→2024-05-19·00:06:29.249319646·+0300¶
@@·-1,3·+1,5·@@¶
·a¶
·¶
+b¶
+¶
·c¶
\·No·newline·at·end·of·file¶
printf "a\n\n\nc">new
rm new.porig
wiggle -rp patch
1 unresolved conflict found
cat new|ws|copy
<<<<<<<·found¶
a¶
¶
¶
c|||||||·expected¶
a¶
¶
c¶
=======¶
a¶
¶
b¶
¶
c¶
>>>>>>>·replacement¶
and again almost the same
this might be redundant
the actual problem is the same but i also introduce a harmless mistake of removing a space from indentation
the found and expected message is still correct with context unlike the actual conflict further down
printf " a\nc">orig
printf " a\nb\nc">new
diff orig new -Naru>patch
printf " a\n\nc">new
rm new.porig
wiggle -rp patch
1 unresolved conflict found
cat new|ws|copy
<<<<<<<·found¶
··a¶
¶
c|||||||·expected¶
··a¶
c¶
=======¶
·a¶
b¶
c¶
>>>>>>>·replacement¶
the actual conflict
all the conflicts from these patches seemed to be caused by new white space in the context that i would like to ignore
git clone --depth 1 https://github.com/termux/termux-app
git remote add jp https://github.com/john-peterson/termux-app
git pull jp day key
unexpected new line in context
there was one empty line in the context when i patched it but now there are three.
this happens in two places but i show only one for brevity
the message context is stripped but it is correct about two new empty lines
git format-patch jp/day -2
ack "Integer getTerminalCursorStyle" terminal-emulator/src/main/java/com/termux/terminal/TerminalSessionClient.java -A2|ws
····Integer·getTerminalCursorStyle();¶
¶
¶
¶
····void·logError(String·tag,·String·message);¶
ack shouldEnableDarkTheme 0001* -C2|ws
·····Integer·getTerminalCursorStyle();¶
·¶
+····boolean·shouldEnableDarkTheme();¶
+¶
·····void·logError(String·tag,·String·message);¶
--¶
wiggle -rp 0001*
1 unresolved conflict found
1 unresolved conflict found
ack -A 10 "<<<" --heading|ws|copy
terminal-emulator/src/main/java/com/termux/terminal/TerminalSessionClient.java
<<<<<<<·found¶
¶
¶
|||||||·expected¶
=======¶
····boolean·shouldEnableDarkTheme();¶
¶
>>>>>>>·replacement¶
····void·logError(String·tag,·String·message);¶
¶
····void·logWarn(String·tag,·String·message);¶
same problem again
a conflict is generated because a new line has appeared in the context
in this case also the replacement would be fine there was no need to generate a conflict
the first line in the patch is an accidentally removed space but it is irrelevant to the problem
the found and expected message is incorrect in this case it should indicate the new line with context preferably not the first line of the patch context that contains nothing interesting
git checkout .
git clean -f
git format-patch jp/key -3
wiggle -rp 0001*
1 unresolved conflict found
ack mExtraKeysView.reload -A10 --heading --break|ws|copy
app/src/main/java/com/termux/app/TermuxActivity.java¶
1013:················mExtraKeysView.reload(mTermuxTerminalExtraKeys.getExtraKeysInfo(),·mTerminalToolbarDefaultHeight);¶
1014-············}¶
1015-¶
1016-|||||||·expected¶
1017:················mExtraKeysView.reload(mTermuxTerminalExtraKeys.getExtraKeysInfo(),·mTerminalToolbarDefaultHeight);¶
1018-············}¶
1019-=======¶
1020:···············mExtraKeysView.reload(mTermuxTerminalExtraKeys.getExtraKeysInfo(),·mTerminalToolbarDefaultHeight);¶
1021-············}¶
1022-············if·(mExtraKeysView2·!=·null)·{¶
1023-················mExtraKeysView2.setButtonTextAllCaps(mProperties.shouldExtraKeysTextBeAllCaps());¶
1024-···············mExtraKeysView2.reload(mTermuxTerminalExtraKeys2.getExtraKeysInfo(),·mTerminalToolbarDefaultHeight);¶
1025-············}¶
1026->>>>>>>·replacement¶
1027-············//·Update·NightMode.APP_NIGHT_MODE¶
1028-············TermuxThemeUtils.setAppNightMode(mProperties.getNightMode());¶
1029-········}¶
1030-¶
¶
app/src/main/java/com/termux/app/TermuxActivity.java.porig¶
985:················mExtraKeysView.reload(mTermuxTerminalExtraKeys.getExtraKeysInfo(),·mTerminalToolbarDefaultHeight);¶
986-············}¶
987-¶
988-············//·Update·NightMode.APP_NIGHT_MODE¶
989-············TermuxThemeUtils.setAppNightMode(mProperties.getNightMode());¶
990-········}¶
991-¶
¶
0001-Add-a-second-keyboard.patch¶
102:-················mExtraKeysView.reload(mTermuxTerminalExtraKeys.getExtraKeysInfo(),·mTerminalToolbarDefaultHeight);¶
103:+···············mExtraKeysView.reload(mTermuxTerminalExtraKeys.getExtraKeysInfo(),·mTerminalToolbarDefaultHeight);¶
104-+············}¶
105-+············if·(mExtraKeysView2·!=·null)·{¶
106-+················mExtraKeysView2.setButtonTextAllCaps(mProperties.shouldExtraKeysTextBeAllCaps());¶
107-+···············mExtraKeysView2.reload(mTermuxTerminalExtraKeys2.getExtraKeysInfo(),·mTerminalToolbarDefaultHeight);¶
108-·············}¶
109-·············//·Update·NightMode.APP_NIGHT_MODE¶
110-·············TermuxThemeUtils.setAppNightMode(mProperties.getNightMode());¶