Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork939
Add missing newline when writing a symbolic ref.#490
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@@ -313,7 +313,7 @@ def set_reference(self, ref, logmsg=None): | |||
lfd = LockedFD(fpath) | |||
fd = lfd.open(write=True, stream=True) | |||
fd.write(write_value.encode('ascii')) | |||
fd.write(write_value.encode('ascii') + '\n') |
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.
For Python 3 compat, prefer to useb'\n'
here, since this should be a byte, not a unicode string.
@bertwesarg Thanks for your contribution. May I ask why this is needed ? When creating refs using plain git, I don't see newlines either. |
bertwesarg commentedJul 23, 2016 • edited by Byron
Loading Uh oh!
There was an error while loading.Please reload this page.
edited by Byron
Uh oh!
There was an error while loading.Please reload this page.
Hmm, while I still use an ancient git 2.1.4 it does add a newline:
And git master should still do this: https://github.com/git/git/blob/master/refs/files-backend.c#L2740 Though I noticed this because the git prompt provided by git-prompt.sh did not worked anymore, because it uses the shell read builtin, which does not work if the file does not has a trailing newline: https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh#L433
|
Thanks for the clarification and the thorough research, great to have this contribution merged now! I feel a bit silly that I was unable to 'see' the newline at the end of the symbolic ref with vim, but will certainly put |
No description provided.