precise-commits
precise-commits copied to clipboard
Code corrupted by format a white-spaces only changes
Hi. I faced a code corruption on white-space changes. Cannot say for sure it's caused by precise-commits (the setup include a prettier precise-commits and husky as suggested). Though applying prettier directly on the whole file does work properly.
I made a simple project with example. Basically it reproduced by with the following:
- Original snippet
function func01(arg1: number) {
if ( arg1 > 32) {
console.log("test3");
}
//return (arg1-32);
}
- Then apply patch
function func01(arg1: number) {
-if ( arg1 > 32) {
- console.log("test3");
- }
+if ( arg1 > 32) {
+ console.log("test3");
+ }
//return (arg1-32);
- }
+ }
- Which then make the snippet
function func01(arg1: number) {
if ( arg1 > 32) {
console.log("test3");
}
//return (arg1-32);
}
- Commit
git add test01.ts
git commit -m "test01 format"
- The result
cat test01.ts
function func01(arg1: number) {
if (rg1 > 3) {
c onsole.log("test3");
}
//re turn (arg1-32);
}
Please advise if I missed something in my setup? What else could be checked on my side? Thanks.