-
Notifications
You must be signed in to change notification settings - Fork 713
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
Fix no end-of-line bug #295
Conversation
This can happen easily with certain editors (such as Mousepad) that do not automatically add a newline character at the end of a file. In _addto(), ensure a trailing newline via sed (taken from https://unix.stackexchange.com/a/31955/18876). Fixes todotxt#294
This can happen easily with certain editors (such as Mousepad) that do not automatically add a newline character at the end of a file.
@karbassi Somehow, the CI build isn't triggered on this: This branch has not been deployed; I was able to restart an old PR build in Travis, so that still works; maybe the GitHub trigger didn't work. I don't have admin rights to check this. It's gotten a bit silent here; I've answered a few issues and PRs in the past, but other than that, not much has happened. If you could briefly review my two other open PRs (#271 and #273), I would merge them all in soon. I hope you're fine! |
@inkarkat we might want to move over to Github Actions at some point. I ran the tests and it failed.
|
We have GitHub Actions now! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t1850-move fails on macOS
Use the POSIX \{1,\} instead.
@karbassi Thank you for setting up the new CI builds; that's really great! (And I involuntarily demonstrated why it's so important to have them.) I've fixed the compatibility problem; fortunately, that was an easy one and I didn't have to update my FreeBSD VM to see how barren it is in non-GNU land :-) |
@inkarkat looks good. Merge. |
* Handle missing EOL in todo.txt This can happen easily with certain editors (such as Mousepad) that do not automatically add a newline character at the end of a file. In _addto(), ensure a trailing newline via sed (taken from https://unix.stackexchange.com/a/31955/18876). Fixes todotxt#294 * Tests: Add basic coverage of move * Handle missing EOL in todo.txt for move, too This can happen easily with certain editors (such as Mousepad) that do not automatically add a newline character at the end of a file. * Refactoring: Extract fixMissingEndOfLine() * FIX: Compatibility: sed \+ multi not supported on MacOS Use the POSIX \{1,\} instead. Co-authored-by: Ali Karbassi <ali@karbassi.com>
This reverts commit 861ad5e.
This fixes #294 by passing the target file through
sed
(when adding or moving, both of which use simple>>
shell redirection which is susceptible to this) to add a trailing newline (EOL) character if one is missing.Before submitting a pull request, please make sure the following is done:
master
.fixes #XX
reference to the issue that this pull request fixes.