summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
bfbfd4e)
Signed-off-by: Yann Dirson <ydirson@altern.org>
-The first form doesn't allow yet to overwrite an existing file
-(whether it could be recovered from Git or not), and the second form
-does not check before overwriting any file, possibly leading to loss
-of non-committed modifications.
+This command does not allow yet to overwrite an existing file (whether
+it could be recovered from Git or not). Further more, when copying a
+directory, the second form does not allow to proceed if a directory by
+that name already exists inside the target, even when no file inside
+that directory would be overwritten.
FUTURE OPTIONS
--------------
FUTURE OPTIONS
--------------
if os.path.isdir(target):
# target is a directory: copy each entry on the command line,
# with the same name, into the target
if os.path.isdir(target):
# target is a directory: copy each entry on the command line,
# with the same name, into the target
+ target = target.rstrip('/')
+
+ # first, check that none of the children of the target
+ # matching the command line aleady exist
+ for filespec in filespecs:
+ entry = target+ '/' + os.path.basename(filespec.rstrip('/'))
+ if os.path.exists(entry):
+ raise GitException, 'Target "%s" already exists' % entry
+
for filespec in filespecs:
filespec = filespec.rstrip('/')
basename = '/' + os.path.basename(filespec)
for filespec in filespecs:
filespec = filespec.rstrip('/')
basename = '/' + os.path.basename(filespec)