summaryrefslogtreecommitdiff
path: root/git-clone.sh
diff options
context:
space:
mode:
authorMark Hills <mark@pogo.org.uk>2008-05-05 17:46:42 +0100
committerJunio C Hamano <gitster@pobox.com>2008-05-06 21:34:35 -0700
commitc904bf392d7621b04c14bb9b2e93c3ed08f7e57b (patch)
tree42833d3597231b5e37d154166b4b62e44ba49396 /git-clone.sh
parent867fa20fe929942fba2345adc591e6f5c74f8c11 (diff)
downloadgit-c904bf392d7621b04c14bb9b2e93c3ed08f7e57b.tar.gz
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>
Diffstat (limited to 'git-clone.sh')
-rwxr-xr-xgit-clone.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/git-clone.sh b/git-clone.sh
index 8c7fc7f631..9d88d1ce60 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -334,7 +334,10 @@ yes)
fi
fi &&
cd "$repo" &&
- find objects -depth -print | cpio $cpio_quiet_flag -pumd$l "$GIT_DIR/" || \
+ # Create dirs using umask and permissions and destination
+ find objects -type d -print | (cd "$GIT_DIR" && xargs mkdir -p) &&
+ # Copy existing 0444 permissions on content
+ find objects ! -type d -print | cpio $cpio_quiet_flag -pumd$l "$GIT_DIR/" || \
exit 1
fi
git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD" || exit 1