+
Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions git-cache
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ drop() {
}

_check_commit() {
git_cache cat-file -e ${1}^{commit}
if [ -d "${GIT_CACHE_DIR}" ]; then
git_cache cat-file -e ${1}^{commit}
else
false
fi
}

_remote_name() {
Expand All @@ -98,7 +102,7 @@ clone() {
git_cache tag commit$SHA1 $SHA1 || true # ignore possibly already existing tag
git clone --reference "${GIT_CACHE_DIR}" "${GIT_CACHE_DIR}" "${TARGET_PATH}" --branch commit$SHA1
else
git clone --reference "${GIT_CACHE_DIR}" "${REMOTE}" "${TARGET_PATH}"
git clone "${REMOTE}" "${TARGET_PATH}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the semantic significantly. Before, it would use the .gitcache as reference also if the exact commit would not be in the cache. Now it ignores the cache in that case.

I think there should be another test if the cache dir exists and only if it doesn't do a checkout without reference.

git -C "${TARGET_PATH}" checkout $SHA1
fi
set +e
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载