Browse Source

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>
maint
Mark Hills 17 years ago committed by Junio C Hamano
parent
commit
c904bf392d
  1. 5
      git-clone.sh

5
git-clone.sh

@ -334,7 +334,10 @@ yes)
fi fi
fi && fi &&
cd "$repo" && 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 exit 1
fi fi
git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD" || exit 1 git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD" || exit 1

Loading…
Cancel
Save