Download raw body.
got patch: handle "\ No newline at end of file"
Stefan Sperling <stsp@stsp.name> wrote: > On Sat, Mar 19, 2022 at 07:33:54PM +0100, Omar Polo wrote: > > I'd say to just assume \n as newline as patch(1) and diff(1) do. But if > > we want to handle CRLF too at some point it shouldn't be incredibly > > hard. \r alone instead don't seems to be worth imho. (forgot to mention that the CRLF handling *may* involve 'got diff' too. I haven't checked how it) > Fine. Let's go with just \n for now and perhaps document in the > man page that 'got patch' requires newlines to be \n. > > Are there are other whitespace issues that might be worth documenting? > I recall the filename getting messed up by 'svn patch' if a tab gets > replaced by regular spaces. Does this also apply to 'got patch'? > I recall this was needed in order to support paths which contain spaces. > Do we already have a test for this case? I've never used subversion, but this seems an issue that patch(1) has and that we share too. The format for the "---" and "+++" lines is roughly: optional leading spaces as per isspace(3) vvvvv (---|+++)[ \t]*[^\t]+(\t.*)?\n ^^^^^ ^^^^^^ | | filename | optional stuff after a tab so tabs, as well as newlines and leading spaces are forbidden in path names by the format. If theres some optional stuff after the name and the tab character gets converted into spaces the file path _will_ be mangled here as well. I don't have any ideas on how to make this more reliable, if even possible. I don't have written any tests for paths with spaces yet (and i have to still go through the svn patch regress suite as i were focusing on finishing some missing parts, which with the "no newline at eof" patch are done.)
got patch: handle "\ No newline at end of file"