Page MenuHomePhabricator

`arc diff` allows addition of empty directories in SVN but `arc patch` creates files
Open, LowPublic

Description

SVN allows the addition of empty directories. Even if this is not recommended.

When an empty directory is present in a diff, arc patch will create a file in its place with touch because no patch file will be present for this patch.

arc diff should at least warn the user that the addition will not be handled properly.

Event Timeline

andrask updated the task description. (Show Details)
andrask added projects: Subversion, Arcanist.
andrask added a subscriber: andrask.
epriestley added a subscriber: epriestley.

This seems straightforward to reproduce:

$ svn st
$ mkdir empty-dir
$ svn add empty-dir
A         empty-dir
$ arc diff --only --conduit-uri=http://local.phacility.com/
 SKIP STAGING  Unable to determine repository for this change.
Created a new Differential diff:
        Diff URI: http://local.phacility.com/differential/diff/264/

Included changes:
  A (dir) empty-dir
$ svn -R revert .
Reverted 'empty-dir'
$ rm -rf empty-dir/

Now apply the patch:

$ arc patch --diff 264 --conduit-uri=http://local.phacility.com/
A         empty-dir
 OKAY  Successfully applied patch to the working copy.

...but we created a file, not a directory:

$ ls -alh empty-dir 
-rw-r--r--  1 epriestley  staff     0B Nov 27 08:22 empty-dir

This affects a small number of users in a small number of use cases, so fixing it is not a high priority, although the fix is likely straightforward (I expect we are encoding the metadata properly, just not writing it correctly in arc patch).

epriestley renamed this task from `arc diff` allows addition of empty directories but `arc patch` creates files to `arc diff` allows addition of empty directories in SVN but `arc patch` creates files.Nov 27 2015, 4:26 PM

@epriestley Thanks for the analysis, I'm happy it was easy to reproduce.

Actually, the metadata is transferred correctly it's just not used where the change is applied https://secure.phabricator.com/diffusion/ARC/browse/master/src/workflow/ArcanistPatchWorkflow.php;4f1141d0c59be24268a45edb0cd25f1d27f31674$619

I haven't proposed a patch for this yet as I'm waiting for D14484 to get evaluated.

eadler moved this task from Backlog to Important on the FreeBSD board.