We're using 'git format-patch' and 'git am' workflow to sync changes between two repositories. This works great but I've found an edge case in apply.c If one commit creates a file whose path has a directory segment ending with space will cause the generated patch unappliable. Here is a script to reproduce the edge case: mkdir tmp && cd tmp git init git commit --allow-empty -m empty mkdir 'foo ' touch 'foo /bar' git add -A git commit -m foo git format-patch HEAD~1 git reset --hard HEAD~1 git am 0001-foo.patch Git complains 'error: git diff header lacks filename information when removing 1 leading pathname component (line 9)'. Turns out `git_header_name()` uses the 'wrong' space as separator, and `skip_tree_prefix()` thinks the pathname as an absolute path. In theory, we could quote the pathname for this edge case. But that would require many changes to quote.c, simply quote all pathnames with space also fix the issue. Han Young (1): quote: quote space quote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.44.0