Skip to content

Commit e32dfec

Browse files
trastgitster
authored andcommitted
repack: place temporary packs under .git/objects/pack/
git-pack-objects is already careful to start out its temporary packs under .git/objects/pack/ (cf. 8b4eb6b, Do not perform cross-directory renames when creating packs, 2008-09-22), but git-repack did not respond in kind so the effort was lost when the filesystem boundary is exactly at that directory. Let git-repack pass a path under .git/objects/pack/ as the base for its temporary packs. This means we might need the $PACKDIR sooner (before the pack-objects invocation), so move the mkdir up just to be safe. Also note that the only use of *.pack is in the find invocation way before the pack-objects call, so the temporary packs will not suddenly show up in any wildcards because of the directory change. Reported-by: Marat Radchenko <marat@slonopotamus.org> Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 87b5054 commit e32dfec

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

git-repack.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ true)
5050
esac
5151

5252
PACKDIR="$GIT_OBJECT_DIRECTORY/pack"
53-
PACKTMP="$GIT_OBJECT_DIRECTORY/.tmp-$$-pack"
53+
PACKTMP="$PACKDIR/.tmp-$$-pack"
5454
rm -f "$PACKTMP"-*
5555
trap 'rm -f "$PACKTMP"-*' 0 1 2 3 15
5656

@@ -80,6 +80,8 @@ case ",$all_into_one," in
8080
;;
8181
esac
8282

83+
mkdir -p "$PACKDIR" || exit
84+
8385
args="$args $local ${GIT_QUIET:+-q} $no_reuse$extra"
8486
names=$(git pack-objects --keep-true-parents --honor-pack-keep --non-empty --all --reflog $args </dev/null "$PACKTMP") ||
8587
exit 1
@@ -88,7 +90,6 @@ if [ -z "$names" ]; then
8890
fi
8991

9092
# Ok we have prepared all new packfiles.
91-
mkdir -p "$PACKDIR" || exit
9293

9394
# First see if there are packs of the same name and if so
9495
# if we can move them out of the way (this can happen if we

0 commit comments

Comments
 (0)