mercurial/patch.py
changeset 4006 67982d3ee76c
parent 3996 c190df14338c
child 4096 49237d6ae97d
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -377,8 +377,9 @@ def updatedir(ui, repo, patches, wlock=N
             dst = os.path.join(repo.root, gp.path)
             # patch won't create empty files
             if ctype == 'ADD' and not os.path.exists(dst):
-                repo.wwrite(gp.path, '')
-            util.set_exec(dst, x)
+                repo.wwrite(gp.path, '', x and 'x' or '')
+            else:
+                util.set_exec(dst, x)
     cmdutil.addremove(repo, cfiles, wlock=wlock)
     files = patches.keys()
     files.extend([r for r in removes if r not in files])