Be more careful with objects directory permissions on clone
Honour the setgid and umask when re-creating the objects directory at the destination. cpio in copy-pass mode aims to copy file permissions which causes this problem and cannot be disabled. Be explicit by copying the directory structure first, honouring the permissions at the destination, then copy the files with 0444 permissions. This also avoids bugs in some versions of cpio. Signed-off-by: Mark Hills <mark@pogo.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Mark Hills committed
May 5, 2008 at 17:46 UTC
c904bf392d7621b04c14bb9b2e93c3ed08f7e57b
1 file changed
+4
-1
git-clone.sh
+4
-1
@@ -334,7 +334,10 @@ yes)
334
fi
335
fi &&
336
cd "$repo" &&
337
- find objects -depth -print | cpio $cpio_quiet_flag -pumd$l "$GIT_DIR/" || \
337
+ # Create dirs using umask and permissions and destination
338
+ find objects -type d -print | (cd "$GIT_DIR" && xargs mkdir -p) &&
339
+ # Copy existing 0444 permissions on content
340
+ find objects ! -type d -print | cpio $cpio_quiet_flag -pumd$l "$GIT_DIR/" || \
341
exit 1
342
fi
343
git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD" || exit 1