mirror of
https://github.com/frej/fast-export.git
synced 2025-11-09 12:45:38 +01:00
Add dos2unix plugin
This commit is contained in:
@@ -145,6 +145,8 @@ class Filter:
|
||||
#Or don't pass, if you want to do some init code here
|
||||
```
|
||||
|
||||
Beyond the boilerplate initialization, you can see the one of the
|
||||
defined filter methods in the [dos2unix](./plugins/dos2unix) plugin.
|
||||
|
||||
```
|
||||
commit_data = {'branch': branch, 'parents': parents, 'author': author, 'desc': desc}
|
||||
|
||||
9
plugins/dos2unix/README.md
Normal file
9
plugins/dos2unix/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
## Dos2unix filter
|
||||
|
||||
This plugin converts CRLF line ending to LF in text files in the repo.
|
||||
It is recommended that you have a .gitattributes file that maintains
|
||||
the usage of LF endings going forward, for after you have converted your
|
||||
repository.
|
||||
|
||||
To use the plugin, add
|
||||
`--plugin dos2unix`.
|
||||
11
plugins/dos2unix/__init__.py
Normal file
11
plugins/dos2unix/__init__.py
Normal file
@@ -0,0 +1,11 @@
|
||||
def build_filter(args):
|
||||
return Filter(args)
|
||||
|
||||
class Filter():
|
||||
def __init__(self, args):
|
||||
pass
|
||||
|
||||
def file_data_filter(self,file_data):
|
||||
file_ctx = file_data['file_ctx']
|
||||
if not file_ctx.isbinary():
|
||||
file_data['data'] = file_data['data'].replace('\r\n', '\n')
|
||||
Reference in New Issue
Block a user