Skip to content

Commit

Permalink
Be more careful with objects directory permissions on clone
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mark Hills authored and Junio C Hamano committed May 7, 2008
1 parent 867fa20 commit c904bf3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion git-clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c904bf3

Please sign in to comment.