Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 newlines added at the end of .bumpversion.cfg file when bumping #179

Open
arielnmz opened this issue Mar 31, 2018 · 2 comments
Open

2 newlines added at the end of .bumpversion.cfg file when bumping #179

arielnmz opened this issue Mar 31, 2018 · 2 comments

Comments

@arielnmz
Copy link

Whenever you bump the .bumpversion.cfg file ends up with 2 newlines at the end

@arielnmz
Copy link
Author

Since I don't want to fork I suggest the following patch as a fix:

Index: bumpversion/__init__.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- bumpversion/__init__.py	(date 1435260711000)
+++ bumpversion/__init__.py	(date 1522533107000)
@@ -860,7 +860,7 @@
 
         if write_to_config_file:
             with io.open(config_file, 'wb') as f:
-                f.write(new_config.getvalue().encode('utf-8'))
+                f.write((new_config.getvalue().strip()+'\n').encode('utf-8'))
 
     except UnicodeEncodeError:
         warnings.warn(

It just strips and appends a single newline at the end of the file, perhaps a better solution would be checking at the _write_section method of the RawConfigParser class, but this does the trick.

@sharksforarms
Copy link

See this fork https:/c4urself/bump2version/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants