[ 
https://issues.apache.org/jira/browse/SVN-2527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16201733#comment-16201733
 ] 

Julian Foad commented on SVN-2527:
----------------------------------

For adding and removing files to work with GNU patch, it is not necessarily the 
case that the header should use /dev/null. The alternative is for the 
nonexistent-side header to use a date stamp of the Unix Epoch (1970-01-01 
00:00:00 UTC). Indeed, that is what GNU diff does when diffing a tree (where 
'--new-file' tells it to produce diffs for added and deleted files):
{code}
$ diff --unified --new-file a/ b/
diff -uN a/added b/added
--- a/added     1970-01-01 01:00:00.000000000 +0100
+++ b/added     2017-10-12 10:31:40.666882337 +0100
@@ -0,0 +1 @@
+added
diff -uN a/deleted b/deleted
--- a/deleted   2017-10-12 10:31:40.666882337 +0100
+++ b/deleted   1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-deleted
{code}
See the GNU patch man page, e.g. at 
https://www.gnu.org/software/diffutils/manual/diffutils.html#Creating-and-Removing

> svn diff does not use /dev/null as filename for added or removed files
> ----------------------------------------------------------------------
>
>                 Key: SVN-2527
>                 URL: https://issues.apache.org/jira/browse/SVN-2527
>             Project: Subversion
>          Issue Type: Bug
>          Components: libsvn_diff
>    Affects Versions: ---
>            Reporter: Subversion Importer
>             Fix For: 1.7.0
>
>         Attachments: 1_svn-diff.sh
>
>
> {noformat:nopanel=true}
> svn diff is not usable to generate patches between revisions that either add 
> or remove files.
> Added files must have /dev/null as filename in the ^+++ line.
> Removed files must have /dev/null as filename in the ^--- line.
> patch(1) will recognize this and either refuse to append to an existing file,
> or it will unlink and deleted file.
> Currently the ^--- and ^+++ lines will just contain the filename for both.
> Looking through the 1.3 sources, there is appearently no support for handling 
> add/deletes.
> {noformat}
> Original issue reported by *olh*



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to