From: Linus Torvalds Date: Thu, 26 May 2005 20:33:26 GMT Subject: Re: git full diff output issues.. Message-ID: In-Reply-To: On Thu, 26 May 2005, Anton Altaparmakov wrote: > > Given that git already has the metadata lines in the diff ("old mode", > "deleted file mode", etc) why not simply add another metadata line "name" > and what follows that is the name until an end of line character (or a NUL > if you want file names with embedded new lines). You can then only emit > the "name" metadata line when no actual diff is present and hence the name > is uncertain. Yes, that would work. However, I ended up just validating the name parsing by making sure that when I parse the "git --diff" line, I only take the name if I can see it being the same for both the old and the new. IOW, if I see diff --git a/hi b/hello then I won't take it, but if I see diff --git hi there/I am/being difficult oopsie dir/I am/being difficult then I get "I am/being difficult" by virtue of checking the two names against each other. This means, btw, that the "git --diff" format must _not_ do diff --git a/file /dev/null deleted file mode 100644 because in that case I don't trust the filename enough. Of course, this all only happens when deleting empty files, if the file had any contents, then I will see the unambiguos filename on the '---' line, and again be happy. IOW, git-apply is being pretty anal about things, but it looks like that works out well. Linus