Re: [PATCH 13/16] repack: consider bitmaps when performing repacks

2013-06-25 Thread Junio C Hamano
Vicent Marti tan...@gmail.com writes:

 @@ -156,6 +156,11 @@ do
   fullbases=$fullbases pack-$name
   chmod a-w $PACKTMP-$name.pack
   chmod a-w $PACKTMP-$name.idx
 +
 + test -f $PACKTMP-$name.bitmap 
 + chmod a-w $PACKTMP-$name.bitmap 
 + mv -f $PACKTMP-$name.bitmap $PACKDIR/pack-$name.bitmap

If we see a temporary bitmap but somehow failed to move it to the
final name, should we _ignore_ that error, or should we die, like
the next two lines do?

   mv -f $PACKTMP-$name.pack $PACKDIR/pack-$name.pack 
   mv -f $PACKTMP-$name.idx  $PACKDIR/pack-$name.idx ||
   exit
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 13/16] repack: consider bitmaps when performing repacks

2013-06-25 Thread Vicent Martí
On Wed, Jun 26, 2013 at 1:00 AM, Junio C Hamano gits...@pobox.com wrote:
 @@ -156,6 +156,11 @@ do
   fullbases=$fullbases pack-$name
   chmod a-w $PACKTMP-$name.pack
   chmod a-w $PACKTMP-$name.idx
 +
 + test -f $PACKTMP-$name.bitmap 
 + chmod a-w $PACKTMP-$name.bitmap 
 + mv -f $PACKTMP-$name.bitmap $PACKDIR/pack-$name.bitmap

 If we see a temporary bitmap but somehow failed to move it to the
 final name, should we _ignore_ that error, or should we die, like
 the next two lines do?

I obviously decided against dying (as you can see on the patch, har
har), because the bitmap is not required for the proper operation of
the Git repository, unlike the packfile and the index.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/16] repack: consider bitmaps when performing repacks

2013-06-24 Thread Vicent Marti
Since `pack-objects` will write a `.bitmap` file next to the `.pack` and
`.idx` files, this commit teaches `git-repack` to consider the new
bitmap indexes (if they exist) when performing repack operations.

This implies moving old bitmap indexes out of the way if we are
repacking a repository that already has them, and moving the newly
generated bitmap indexes into the `objects/pack` directory, next to
their corresponding packfiles.

Since `git repack` is now capable of handling these `.bitmap` files,
a normal `git gc` run on a repository that has `pack.usebitmaps` set
to true in its config file will generate bitmap indexes as part of the
garbage collection process.
---
 git-repack.sh |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/git-repack.sh b/git-repack.sh
index 7579331..d5355ae 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -108,7 +108,7 @@ rollback=
 failed=
 for name in $names
 do
-   for sfx in pack idx
+   for sfx in pack idx bitmap
do
file=pack-$name.$sfx
test -f $PACKDIR/$file || continue
@@ -156,6 +156,11 @@ do
fullbases=$fullbases pack-$name
chmod a-w $PACKTMP-$name.pack
chmod a-w $PACKTMP-$name.idx
+
+   test -f $PACKTMP-$name.bitmap 
+   chmod a-w $PACKTMP-$name.bitmap 
+   mv -f $PACKTMP-$name.bitmap $PACKDIR/pack-$name.bitmap
+
mv -f $PACKTMP-$name.pack $PACKDIR/pack-$name.pack 
mv -f $PACKTMP-$name.idx  $PACKDIR/pack-$name.idx ||
exit
@@ -166,6 +171,7 @@ for name in $names
 do
rm -f $PACKDIR/old-pack-$name.idx
rm -f $PACKDIR/old-pack-$name.pack
+   rm -f $PACKDIR/old-pack-$name.bitmap
 done
 
 # End of pack replacement.
@@ -180,7 +186,7 @@ then
  do
case  $fullbases  in
* $e *) ;;
-   *)  rm -f $e.pack $e.idx $e.keep ;;
+   *)  rm -f $e.pack $e.idx $e.keep $e.bitmap 
;;
esac
  done
)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html