-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the name of a pack-file depend on the objects packed there-in.
This means that the .git/objects/pack directory is also rsync'able, since the filenames created there-in are either unique or refer to the same data. Otherwise you might not be able to pull from a directory that is partly packed without having to worry about missing objects due to pack-file name clashes.
- Loading branch information
Linus Torvalds
committed
Jul 3, 2005
1 parent
2396ec8
commit 5f3de58
Showing
2 changed files
with
20 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
#!/bin/sh | ||
: ${GIT_DIR=.git} | ||
: ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"} | ||
packname=$(date +"pack-%s") | ||
if [ -f "$GIT_OBJECT_DIRECTORY/pack/$packname.idx" ]; then | ||
echo Pack $packname already exists | ||
rm -f .tmp-pack-* | ||
packname=$(git-rev-list --unpacked --objects $(git-rev-parse --all) | | ||
git-pack-objects --non-empty --incremental .tmp-pack) || | ||
exit 1 | ||
fi | ||
rm -f $packname.idx $packname.pack | ||
git-rev-list --unpacked --objects $(git-rev-parse --all) | | ||
git-pack-objects --non-empty --incremental $packname || | ||
exit 1 | ||
|
||
if [ ! -f $packname.idx ]; then | ||
if [ -z "$packname" ]; then | ||
echo Nothing new to pack | ||
exit 0 | ||
fi | ||
mv $packname.idx $packname.pack "$GIT_OBJECT_DIRECTORY/pack/" | ||
mv .tmp-pack-$packname.pack "$GIT_OBJECT_DIRECTORY/pack/pack-$packname.pack" | ||
mv .tmp-pack-$packname.idx "$GIT_OBJECT_DIRECTORY/pack/pack-$packname.idx" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters