stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <>
Subject adding/deleting files in patches (was Re: FW: dependencies among scripts)
Date Mon, 28 Nov 2005 23:16:32 GMT
Anton Pevtsov wrote:
> But all scripts files have no eol-style property. Currently it is not a
> problem, but may turn to it in future.

Yes it might. Thanks for spotting it! I've fixed it with this

> Btw., I have a question about the patch format: 
> Suggest I need to remove or rename a file. How shall I mark this file in
> my mail about the patch?
> I generated the patch file (see the attached runall.patch) but it
> contains nothing about added and deleted files.

There are two parts to every change or patch: the change log entry
listing the modified files and describing the change, and then the
diff itself.

For a change that involves removing a file, the change log entry for
the removed file would look like this:

	* removed.file: Removed... (why)

and the diff is the standard svn diff for the file.

For a change that involves renaming a file, the change log entry for
the renamed and the new files (listed one after the other) would look
like this:

	* old.file: Renamed...
	* new.file: this.

The diff for old.file is the standard svn diff. The diff for new.file
can be a diff against /dev/null, either in the standard context format
(obtained with the POSIX diff -c /dev/null new.file command) or in the
unified format (the output of diff -u /dev/null new.file when diff
supports it), or it can be omitted (in which case you just include
new.file as a separate attachment).

For a change that involves adding a new file, the change log entry
for the renamed file would look like this:

	* new.file: New... (what's in it)

and the patch for the new file is again a diff against /dev/null
in one of the usual formats or a separate new.file.

I don't think a conforming patch utility can delete existing files
or create new ones, so it's a matter of convention how to express
file deletion or creation in the patch. To avoid causing the utility
to fail for files that don't exist and are being added it's probably
best to add the files separately from the patch.


PS The GNU diff and patch utilities implement non-portable extensions
that let you express file creation and deletion (see below). Unless
the produced output is interpreted reasonably by a POSIX-conforming
patch utility I would probably avoid using this format.

View raw message