composer-git-merge-driver icon indicating copy to clipboard operation
composer-git-merge-driver copied to clipboard

Add support to preserve formatting (preserve tabs)

Open glensc opened this issue 5 years ago • 2 comments

I have tab indent formatted composer.json, each time composer-git-merge-driver is merging, the formatting is replaced with space indent.

glensc avatar Jul 14 '19 19:07 glensc

@glensc these bits of logic were supposed to match the indentation and preserve the specific type of indentation (and in the case the case of spaces, the appropriate width), but I guess it isn't working properly? https://github.com/balbuf/composer-git-merge-driver/blob/master/bin/composer-git-merge-driver#L27-L29 https://github.com/balbuf/composer-git-merge-driver/blob/master/bin/composer-git-merge-driver#L230-L235

It's limited in its ability because it just matches a sample line and extrapolates for the rest of the file, so if there's a mixture of spaces/tabs or other nonstandard indentation (or if the indentation type was changed during the merge), it's not going to faithfully preserve the indentation. If you want to look into what the issue is, those would be the places to start.

balbuf avatar Jun 22 '20 19:06 balbuf

@balbuf thanks for the investigation. I've converted muy files to space indent, so this is no longer bothering me.

ps:

🚧 Never link to branches, share a permalink 🚧

  • see https://news.ycombinator.com/item?id=8046710 and https://help.github.com/articles/getting-permanent-links-to-files/ and https://docs.gitlab.com/ee/user/shortcuts.html#project-files
  • hit y
  • and perhaps for https://github.com/josephfrazier/octopermalinker (GitHub)

glensc avatar Jun 25 '20 08:06 glensc