[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Do we want 'svn patch' to be able to add empty files?

From: Branko Čibej <brane_at_xbc.nu>
Date: Thu, 02 Sep 2010 10:50:52 +0200

 On 02.09.2010 10:27, Daniel Shahaf wrote:
> Daniel Näslund wrote on Thu, Sep 02, 2010 at 07:13:00 +0200:
>> On Wed, Sep 01, 2010 at 06:37:08PM +0100, Julian Foad wrote:
>>> This may be off topic, but I'm wondering whether Git has defined such
>>> operations on directories fully or at all, since it doesn't version them
>>> explicitly. I mean, can you tell the difference between "add empty file
>>> A" and "add empty dir A"? I could go and look, but haven't time today.
>>> If yes, great; if it doesn't, we'll have to invent syntax extensions to
>>> do it. (I'm recalling that the goal of this work is we want Subversion
>>> diffs to be able to support all valid Subversion changes, and we chose
>>> Git format as a basis for supporting that. We don't want to constrain
>>> ourselves to only the operations that Git supports.)
>> Not supported at the moment:
>>
>> $ svn mkdir X
>> A X
>> $ svn status
>> A X
>> $ svn diff
>> $ svn diff --git
>> $
>>
>> Suggestion:
>>
>> $ svn diff --git
>> Index: empty
>> ===================================================================
>> diff --git a/trunk/empty b/trunk/empty
>> new directory mode 10644
> IIRC trailing slashes on "empty/" were suggested on IRC, what was the
> conclusion about that?
>
>> E.g., just changing the 'new file mode 10644' line to mention directory
>> instead. Haven't investigate what changes would be needed in the diff
>> editor.
> By the way, are we just influenced by Git's format, or are we looking
> for some degree of interoperability? Consider adding a symlink:
>
> [[[
> ### with git (in $wcroot/trunk/):
> diff --git a/trunk/bar b/trunk/bar
> new file mode 120000
> index 0000000..1910281
> --- /dev/null
> +++ b/trunk/bar
> @@ -0,0 +1 @@
> +foo
> \ No newline at end of file
>
> ### with svn (in $wcroot/trunk/):
> Index: bar
> ===================================================================
> diff --git a/trunk/bar b/trunk/bar
> new file mode 10644
> --- /dev/null (revision 0)
> +++ b/trunk/bar (working copy)
> @@ -0,0 +1 @@
> +link foo
> \ No newline at end of file
>
> Property changes on: trunk/bar
> ___________________________________________________________________
> Added: svn:special
> ## -0,0 +1 ##
> +*
> ]]]
Hmm, this is interesting. :) Git faithfully (blindly?) interprets Unix
permission bits, whiles SVN faithfully (blindly?) interprets the
contents of special files ... I wonder if "svn patch" does the right
thing here?

Anyway, for the sake of interoperability, we'd have to emit and parse
the git format for symlinks. Not that I'm too amused by the idea that
git probably just does a chmod on the new file without thinking about
it, but hey, All the World is Linux, right? :)

-- Brane
Received on 2010-09-02 10:51:35 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.