summaryrefslogtreecommitdiff
path: root/git-fetch.sh
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2006-11-01 22:06:25 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-11-03 08:24:07 (GMT)
commit576162a45f35e157427300066b0ff566ff698a0f (patch)
tree2fdc7abe3ac1688b340b30cffd7d5e086c04998f /git-fetch.sh
parent9ca4a201eaf0c58dbc7184cb2d5ab01c48cb7447 (diff)
downloadgit-576162a45f35e157427300066b0ff566ff698a0f.zip
git-576162a45f35e157427300066b0ff566ff698a0f.tar.gz
git-576162a45f35e157427300066b0ff566ff698a0f.tar.bz2
remove .keep pack lock files when done with refs update
This makes both git-fetch and git-push (fetch-pack and receive-pack) safe against a possible race with aparallel git-repack -a -d that could prune the new pack while it is not yet referenced, and remove the .keep file after refs have been updated. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-fetch.sh')
-rwxr-xr-xgit-fetch.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/git-fetch.sh b/git-fetch.sh
index 2b5538f..7442dd2 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -51,7 +51,7 @@ do
verbose=Yes
;;
-k|--k|--ke|--kee|--keep)
- keep=--keep
+ keep='-k -k'
;;
--reflog-action=*)
rloga=`expr "z$1" : 'z-[^=]*=\(.*\)'`
@@ -368,6 +368,7 @@ fetch_main () {
;; # we are already done.
*)
( : subshell because we muck with IFS
+ pack_lockfile=
IFS=" $LF"
(
git-fetch-pack --thin $exec $keep "$remote" $rref || echo failed "$remote"
@@ -378,6 +379,12 @@ fetch_main () {
failed)
echo >&2 "Fetch failure: $remote"
exit 1 ;;
+ # special line coming from index-pack with the pack name
+ pack)
+ continue ;;
+ keep)
+ pack_lockfile="$GIT_OBJECT_DIRECTORY/pack/pack-$remote_name.keep"
+ continue ;;
esac
found=
single_force=
@@ -408,6 +415,7 @@ fetch_main () {
append_fetch_head "$sha1" "$remote" \
"$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
done
+ if [ "$pack_lockfile" ]; then rm -f "$pack_lockfile"; fi
) || exit ;;
esac