Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
Avoid hardlinks when cloning across filesystems
Browse files Browse the repository at this point in the history
Would be nice if git detected this for us, but sadly it doesn't.
  • Loading branch information
falconindy committed Sep 12, 2018
1 parent 51bbb93 commit 33b4338
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions package.inc.sh
Expand Up @@ -156,20 +156,28 @@ package_export() {
}

package_checkout() {
local remote
local remote clone_args
pkgname=$1

package_init "$pkgname" remote || return

git show-ref -q "refs/heads/$remote/packages/$pkgname" ||
git branch -qf --no-track {,}"$remote/packages/$pkgname"

quiet_git clone \
--local \
--single-branch \
--branch "$remote/packages/$pkgname" \
--config "pull.rebase=true" \
"$ASPROOT" "$pkgname" || return
clone_args=(
--local
--single-branch
--branch "$remote/packages/$pkgname"
--config "pull.rebase=true"
)

# If the current directory isn't on the same FS as us, then we can't use
# hardlinks in the clone, implied by --local.
if [[ $(stat -c %d "$ASPROOT") != "$(stat -c %d .)" ]] ; then
clone_args+=(--no-hardlinks)
fi

quiet_git clone "${clone_args[@]}" "$ASPROOT" "$pkgname"
}

package_get_repos_with_arch() {
Expand Down

0 comments on commit 33b4338

Please sign in to comment.