Skip to content

Commit

Permalink
git-fetch: remove .keep file at the end.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Jan 1, 2007
1 parent d1014a1 commit ac9c110
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions git-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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=
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ac9c110

Please sign in to comment.