summaryrefslogtreecommitdiff
path: root/git-fetch.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-01-01 12:24:15 -0800
committerJunio C Hamano <junkio@cox.net>2007-01-01 14:36:01 -0800
commitac9c1108d8915f0937795e354ad72c4ae6890a3f (patch)
tree5d852d5ec2175292448713d9a184c9465a54912e /git-fetch.sh
parentd1014a1745a8aa90c8de2a5ac7624d8175f96724 (diff)
downloadgit-ac9c1108d8915f0937795e354ad72c4ae6890a3f.tar.gz
git-fetch: remove .keep file at the end.
Removal of them is needed regardless of errors. The original code had the removal outside of the process which sets the flag to tell the later step what to remove, but it runs as a downstream of a pipeline and its effect was lost. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-fetch.sh')
-rwxr-xr-xgit-fetch.sh23
1 files changed, 16 insertions, 7 deletions
diff --git a/git-fetch.sh b/git-fetch.sh
index 8bd11f8b60..466fe59e35 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -382,13 +382,22 @@ fetch_main () {
;; # we are already done.
*)
( : subshell because we muck with IFS
- pack_lockfile=
IFS=" $LF"
(
- git-fetch-pack --thin $exec $keep $shallow_depth "$remote" $rref || echo failed "$remote"
+ git-fetch-pack --thin $exec $keep $shallow_depth "$remote" $rref ||
+ echo failed "$remote"
) |
- while read sha1 remote_name
- do
+ (
+ trap '
+ if test -n "$keepfile" && test -f "$keepfile"
+ then
+ rm -f "$keepfile"
+ fi
+ ' 0
+
+ keepfile=
+ while read sha1 remote_name
+ do
case "$sha1" in
failed)
echo >&2 "Fetch failure: $remote"
@@ -397,7 +406,7 @@ fetch_main () {
pack)
continue ;;
keep)
- pack_lockfile="$GIT_OBJECT_DIRECTORY/pack/pack-$remote_name.keep"
+ keepfile="$GIT_OBJECT_DIRECTORY/pack/pack-$remote_name.keep"
continue ;;
esac
found=
@@ -429,8 +438,8 @@ fetch_main () {
append_fetch_head "$sha1" "$remote" \
"$remote_name" "$remote_nick" "$local_name" \
"$not_for_merge" || exit
- done &&
- if [ "$pack_lockfile" ]; then rm -f "$pack_lockfile"; fi
+ done
+ )
) || exit ;;
esac