From: Junio C Hamano <hidden> Date: 2016-06-15 22:45:33
Brandon Casey [off-list ref] writes:
Nicolas Pitre wrote:
quoted
On Fri, 31 Oct 2008, Brandon Casey wrote:
quoted
quoted
-The sed statement is stripping off anything after the sha1. Any way to
get rev-list to print out just the sha1 so that sed is not necessary?
If you strip the data after the SHA1 when pipping into pack-objects then
you'll have horrible delta compression results. The path names after
each SHA1 is used to sort objects when trying to find best matches for
delta compression. So you should preserve those and feed it back
especially with those packs that you still want delta compression for.
Ah, I'll have to rethink my script then. Thanks!
Yeah, but wasn't the purpose of your whole exercise to list objects that
do not delta nor compress well with each other, in which case the delta
compression order (aka name hash) would not matter, no?
-The sed statement is stripping off anything after the sha1. Any way to
get rev-list to print out just the sha1 so that sed is not necessary?
If you strip the data after the SHA1 when pipping into pack-objects then
you'll have horrible delta compression results. The path names after
each SHA1 is used to sort objects when trying to find best matches for
delta compression. So you should preserve those and feed it back
especially with those packs that you still want delta compression for.
Ah, I'll have to rethink my script then. Thanks!
Yeah, but wasn't the purpose of your whole exercise to list objects that
do not delta nor compress well with each other, in which case the delta
compression order (aka name hash) would not matter, no?
The script I wrote actually starts up two pack-objects instances and I was
writing the objects I wanted to pack _normally_ to one, and the ones that I
did not want compressed/deltafied to the other (which was started with
--no-reuse-object --window=0 --depth=0 --compression=0).
I didn't mentioned that fact in my first email, but I'm very glad Nico
made his point.
-brandon
From: Jakub Narebski <hidden> Date: 2016-06-15 22:45:33
Brandon Casey [off-list ref] writes:
Junio C Hamano wrote:
quoted
Yeah, but wasn't the purpose of your whole exercise to list objects that
do not delta nor compress well with each other, in which case the delta
compression order (aka name hash) would not matter, no?
The script I wrote actually starts up two pack-objects instances and I was
writing the objects I wanted to pack _normally_ to one, and the ones that I
did not want compressed/deltafied to the other (which was started with
--no-reuse-object --window=0 --depth=0 --compression=0).
I didn't mentioned that fact in my first email, but I'm very glad Nico
made his point.
Wasn't there some gitattribute which prohibited deltification of some
files (`delta` or something)? Or wasn't this patch accepted, as I
cannot find such attribute in documentation (gitattributes(5))...
... err, it was added in commit a74db82e15cd8a2c53a4a83e9a36dc7bf7a4c750
(Teach "delta" attribute to pack-objects.) by Junio C Hamano in May
19, _without_ documentation.
--
Jakub Narebski
Poland
ShadeHawk on #git
-The sed statement is stripping off anything after the sha1. Any way to
get rev-list to print out just the sha1 so that sed is not necessary?
If you strip the data after the SHA1 when pipping into pack-objects then
you'll have horrible delta compression results. The path names after
each SHA1 is used to sort objects when trying to find best matches for
delta compression. So you should preserve those and feed it back
especially with those packs that you still want delta compression for.
Ah, I'll have to rethink my script then. Thanks!
Yeah, but wasn't the purpose of your whole exercise to list objects that
do not delta nor compress well with each other, in which case the delta
compression order (aka name hash) would not matter, no?
The script I wrote actually starts up two pack-objects instances and I was
writing the objects I wanted to pack _normally_ to one, and the ones that I
did not want compressed/deltafied to the other (which was started with
--no-reuse-object --window=0 --depth=0 --compression=0).
So, my script created two pack files: one packed normally, and one packed without
compression or delta. I removed my original packs, and put these two new ones in
my pack directory and ran 'git fsck --full' and it completed successfully. There
are no loose objects in the repo.
I added a .keep file for each pack.
Since my script removed the extra info from rev-parse's output, I removed the
.keep file from the appropriate pack and ran 'git gc --aggressive'.
The 1.7GB pack that had the .keep file removed has been replaced with a +3GB
pack file. The other pack file which still has the .keep file is 2.3GB.
In another repo with 3 packs marked .keep, and one 388KB pack with ~300
objects in it, and 3 loose dangling objects, the 388KB pack was replaced with
a 3.5GB pack.
It appears that the entire repository is being packed into the new pack file
even though there are existing pack files with .keep files.
If I compare the output from 'git verify-pack -v' I can see that many of the
objects in the packs marked with a .keep file are indeed in the new pack file.
But not all of them.
-brandon
From: Brandon Casey <redacted>
Objects residing in pack files that have an associated .keep file are not
supposed to be repacked into new pack files, but they are.
Signed-off-by: Brandon Casey <redacted>
---
t/t7700-repack.sh | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
create mode 100755 t/t7700-repack.sh
@@ -0,0 +1,38 @@+#!/bin/sh++test_description='git repack works correctly'++../test-lib.sh++test_expect_failure'objects in packs marked .keep are not repacked''+echocontent1>file1&&+echocontent2>file2&&+gitadd.&&+gitcommit-minitial_commit&&+# Create two packs +# The first pack will contain all of the objects except one+gitrev-list--objects--all|head-n-1|+gitpack-objectspack>/dev/null&&+# The second pack will contain the excluded object+packsha1=$(gitrev-list--objects--all|tail-n1|+gitpack-objectspack)&&+touch-rpack-$packsha1.packpack-$packsha1.keep&&+objsha1=$(gitverify-pack-vpack-$packsha1.idx|head-n1|+sed-e"s/^\([0-9a-f]\{40\}\).*/\1/")&&+mvpack-*.git/objects/pack/&&+gitrepack-A-d-l&&+gitprune-packed&&+forpin.git/objects/pack/*.idx;do+idx=$(basename$p)+test"pack-$packsha1.idx"="$idx"&&continue+ifgitverify-pack-v$p|egrep"^$objsha1";then+found_duplicate_object=1+echo"DUPLICATE OBJECT FOUND"+break+fi+done&&+test-z"$found_duplicate_object"+'++test_done+
From: Brandon Casey <redacted>
This converts the pack_local flag of the packed_git structure into a generic
bit mask and introduces a PACK_LOCAL mask and an ispacklocal() access macro.
So instead of this:
if (p->pack_local)
do_something
you would do this:
if (ispacklocal(p))
do_something
This is in preparation for adding a flag indicating whether a .keep file is
present.
Signed-off-by: Brandon Casey <redacted>
---
builtin-count-objects.c | 2 +-
builtin-gc.c | 2 +-
builtin-pack-objects.c | 2 +-
cache.h | 5 ++++-
pack-redundant.c | 4 ++--
server-info.c | 4 ++--
sha1_file.c | 5 +++--
7 files changed, 14 insertions(+), 10 deletions(-)
@@ -562,7 +562,7 @@ static struct pack_list * add_pack(struct packed_git *p)}/* this list will be pruned in cmp_two_packs later */l.unique_objects=llist_copy(l.all_objects);-if(p->pack_local)+if(ispacklocal(p))returnpack_list_insert(&local_packs,&l);elsereturnpack_list_insert(&altodb_packs,&l);
@@ -168,14 +168,14 @@ static void init_pack_info(const char *infofile, int force)/* we ignore things on alternate path since they are*notavailabletothepullersingeneral.*/-if(!p->pack_local)+if(!ispacklocal(p))continue;i++;}num_pack=i;info=xcalloc(num_pack,sizeof(structpack_info*));for(i=0,p=packed_git;p;p=p->next){-if(!p->pack_local)+if(!ispacklocal(p))continue;info[i]=xcalloc(1,sizeof(structpack_info));info[i]->p=p;
From: Andreas Ericsson <hidden> Date: 2016-06-15 22:45:34
drafnel@gmail.com wrote:
From: Brandon Casey <redacted>
Objects residing in pack files that have an associated .keep file are not
supposed to be repacked into new pack files, but they are.
I think that's a misconception. Packfiles that are marked with .keep files
should never be deleted. There are, afaik, no rules against packing the
same objects into other packfiles as well. This is nifty for dumb ref
walkers, as they can use a small pack for incremental fetching while using
a mega-pack for initial cloning.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
Hmm, isn't this a smaller change to make?
- int pack_local;
+ unsigned pack_local:1;
Then later you can do:
- unsigned pack_local:1;
+ unsigned pack_local:1,
+ pack_keep:1;
and the compiler handles all the bitmask stuff for you?
In general in git.git we like to use the struct bitmask stuff when
possible as the code is easier to follow. We only use explicit
mask constants and mask operations when the data is being stored
on disk or written over the network and we need to ensure it is
consistent across compilers. But for in-core only stuff, struct
bitmasks are easier.
--
Shawn.
From: Brandon Casey <redacted>
Objects residing in pack files that have an associated .keep file are not
supposed to be repacked into new pack files, but they are.
I think that's a misconception. Packfiles that are marked with .keep files
should never be deleted. There are, afaik, no rules against packing the
same objects into other packfiles as well. This is nifty for dumb ref
walkers, as they can use a small pack for incremental fetching while using
a mega-pack for initial cloning.
Having no rules against an object residing in more than one pack is different
from intending for git to produce pack files with redundant objects.
I think one intention for the .keep mechanism was to allow for a size optimized
pack to be produced and distributed. Currently, if I am handed such a pack file,
I can not merely place it into my pack directory (along with the .idx and .keep
files) and then run git-gc to remove any redundancy. Instead, I would get
a _new_ pack file which would contain all of the objects in the repository and
effectively double the size of my objects store. That doesn't seem like
something a user would expect or should expect.
-brandon
heh, well if you want to do it the "easy" way. :)
For some reason I've never used this bit field mechanism, but
I agree it is more readable and simpler, and you can't argue
with that.
-brandon
From: Andreas Ericsson <hidden> Date: 2016-06-15 22:45:34
Brandon Casey wrote:
Andreas Ericsson wrote:
quoted
drafnel@gmail.com wrote:
quoted
From: Brandon Casey <redacted>
Objects residing in pack files that have an associated .keep file are not
supposed to be repacked into new pack files, but they are.
I think that's a misconception. Packfiles that are marked with .keep files
should never be deleted. There are, afaik, no rules against packing the
same objects into other packfiles as well. This is nifty for dumb ref
walkers, as they can use a small pack for incremental fetching while using
a mega-pack for initial cloning.
Having no rules against an object residing in more than one pack is different
from intending for git to produce pack files with redundant objects.
I think one intention for the .keep mechanism was to allow for a size optimized
pack to be produced and distributed. Currently, if I am handed such a pack file,
I can not merely place it into my pack directory (along with the .idx and .keep
files) and then run git-gc to remove any redundancy. Instead, I would get
a _new_ pack file which would contain all of the objects in the repository and
effectively double the size of my objects store. That doesn't seem like
something a user would expect or should expect.
So long as "git repack -a" still creates a mega-pack, I'm fine with whatever.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
From: Brandon Casey <redacted>
Objects residing in pack files that have an associated .keep file are not
supposed to be repacked into new pack files, but they are.
Signed-off-by: Brandon Casey <redacted>
---
This version replaces the use of 'head -n -1' with a grep, and should work on
all platforms.
-brandon
t/t7700-repack.sh | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
create mode 100755 t/t7700-repack.sh
@@ -0,0 +1,38 @@+#!/bin/sh++test_description='git repack works correctly'++../test-lib.sh++test_expect_failure'objects in packs marked .keep are not repacked''+echocontent1>file1&&+echocontent2>file2&&+gitadd.&&+gitcommit-minitial_commit&&+# Create two packs+# The first pack will contain all of the objects except one+gitrev-list--objects--all|grep-vfile2|+gitpack-objectspack>/dev/null&&+# The second pack will contain the excluded object+packsha1=$(gitrev-list--objects--all|grepfile2|+gitpack-objectspack)&&+touch-rpack-$packsha1.packpack-$packsha1.keep&&+objsha1=$(gitverify-pack-vpack-$packsha1.idx|head-n1|+sed-e"s/^\([0-9a-f]\{40\}\).*/\1/")&&+mvpack-*.git/objects/pack/&&+gitrepack-A-d-l&&+gitprune-packed&&+forpin.git/objects/pack/*.idx;do+idx=$(basename$p)+test"pack-$packsha1.idx"="$idx"&&continue+ifgitverify-pack-v$p|egrep"^$objsha1";then+found_duplicate_object=1+echo"DUPLICATE OBJECT FOUND"+break+fi+done&&+test-z"$found_duplicate_object"+'++test_done+
From: Brandon Casey <redacted>
pack_keep will be set when a pack file has an associated .keep file.
Signed-off-by: Brandon Casey <redacted>
---
This patch and the following one redo the previous 3-patch series using a
bitfield as prudently suggested by Shawn.
It seemed silly to keep the conversion of pack_local into a bitfield, and the
introduction of pack_keep separate, so all 7 lines are in this one patch.
-brandon
cache.h | 3 ++-
sha1_file.c | 5 +++++
2 files changed, 7 insertions(+), 1 deletions(-)
From: Brandon Casey <redacted>
By default, pack-objects creates a pack file with every object specified by
the user. There are two options which can be used to exclude objects which
are accessible by the repository.
1) --incremental
This excludes any object which already exists in an accessible pack.
2) --local
This excludes any object which exists in a non-local pack.
With this patch, both arguments also cause objects which exist in packs
marked with a .keep file to be excluded. Only the --local option requires
an explicit check for the .keep file. If the user doesn't want the objects
in a pack marked with .keep to be exclude, then the .keep file should be
removed.
Additionally, this fixes the repack bug which allowed porcelain repack to
create packs which contained objects already contained in existing packs
marked with a .keep file.
Signed-off-by: Brandon Casey <redacted>
---
builtin-pack-objects.c | 2 +-
t/t7700-repack.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
@@ -4,7 +4,7 @@ test_description='git repack works correctly' ../test-lib.sh-test_expect_failure'objects in packs marked .keep are not repacked''+test_expect_success'objects in packs marked .keep are not repacked''echocontent1>file1&&echocontent2>file2&&gitadd.&&
From: Shawn O. Pearce <hidden> Date: 2016-06-15 22:45:34
Brandon Casey [off-list ref] wrote:
From: Brandon Casey <redacted>
By default, pack-objects creates a pack file with every object specified by
the user. There are two options which can be used to exclude objects which
are accessible by the repository.
1) --incremental
This excludes any object which already exists in an accessible pack.
2) --local
This excludes any object which exists in a non-local pack.
With this patch, both arguments also cause objects which exist in packs
marked with a .keep file to be excluded. Only the --local option requires
an explicit check for the .keep file. If the user doesn't want the objects
in a pack marked with .keep to be exclude, then the .keep file should be
removed.
Additionally, this fixes the repack bug which allowed porcelain repack to
create packs which contained objects already contained in existing packs
marked with a .keep file.
Signed-off-by: Brandon Casey <redacted>
This one and the one before it (2/3):
Acked-by: Shawn O. Pearce <redacted>
@@ -4,7 +4,7 @@ test_description='git repack works correctly' ../test-lib.sh-test_expect_failure'objects in packs marked .keep are not repacked''+test_expect_success'objects in packs marked .keep are not repacked''echocontent1>file1&&echocontent2>file2&&gitadd.&&
So long as "git repack -a" still creates a mega-pack, I'm fine with
whatever.
I don't think it will after pack-objects is taught about .keep files, and
I don't think it will _now_ if all of your packs have .keep files.
'repack -a' will call pack-objects with either '--unpack=<packfile>' for
each pack file without a .keep file, or with '--unpacked --incremental' if
there are no pack files without .keep files.
In the first case, the modifications to pack-objects that I propose
will prevent objects that exist in local packs with .keep files
from being packed into the new pack.
In the second case, the --incremental option would have done the same thing.
So this inconsistency already existed, but will now be removed in favor of
honoring .keep files.
Mega-pack creation will become an "advanced operation" along the lines of:
git rev-list --objects --all | git pack-objects
-brandon
From: Brandon Casey <redacted>
Objects residing in pack files that have an associated .keep file are not
supposed to be repacked into new pack files, but they are.
Signed-off-by: Brandon Casey <redacted>
---
Whoops, white space contaminated in two spots, this one fixes it.
-brandon
t/t7700-repack.sh | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
create mode 100755 t/t7700-repack.sh
@@ -0,0 +1,38 @@+#!/bin/sh++test_description='git repack works correctly'++../test-lib.sh++test_expect_failure'objects in packs marked .keep are not repacked''+echocontent1>file1&&+echocontent2>file2&&+gitadd.&&+gitcommit-minitial_commit&&+# Create two packs+# The first pack will contain all of the objects except one+gitrev-list--objects--all|grep-vfile2|+gitpack-objectspack>/dev/null&&+# The second pack will contain the excluded object+packsha1=$(gitrev-list--objects--all|grepfile2|+gitpack-objectspack)&&+touch-rpack-$packsha1.packpack-$packsha1.keep&&+objsha1=$(gitverify-pack-vpack-$packsha1.idx|head-n1|+sed-e"s/^\([0-9a-f]\{40\}\).*/\1/")&&+mvpack-*.git/objects/pack/&&+gitrepack-A-d-l&&+gitprune-packed&&+forpin.git/objects/pack/*.idx;do+idx=$(basename$p)+test"pack-$packsha1.idx"="$idx"&&continue+ifgitverify-pack-v$p|egrep"^$objsha1";then+found_duplicate_object=1+echo"DUPLICATE OBJECT FOUND"+break+fi+done&&+test-z"$found_duplicate_object"+'++test_done+
From: Andreas Ericsson <hidden> Date: 2016-06-15 22:45:36
Brandon Casey wrote:
From: Brandon Casey <redacted>
Objects residing in pack files that have an associated .keep file are not
supposed to be repacked into new pack files, but they are.
Signed-off-by: Brandon Casey <redacted>
---
This version replaces the use of 'head -n -1' with a grep, and should work on
all platforms.
sed 1q is faster, as it stops parsing after the first line (the same as 'head
-n 1' does, but in a more portable fashion).
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
From: Andreas Ericsson <hidden> Date: 2016-06-15 22:45:36
Brandon Casey wrote:
Andreas Ericsson wrote:
quoted
So long as "git repack -a" still creates a mega-pack, I'm fine with
whatever.
I don't think it will after pack-objects is taught about .keep files, and
In that case you're almost certainly breaking something.
I don't think it will _now_ if all of your packs have .keep files.
It should, by copying the objects from the .keep-marked packfiles. Otherwise
either repack or the repack docs are in error.
'repack -a' will call pack-objects with either '--unpack=<packfile>' for
each pack file without a .keep file, or with '--unpacked --incremental' if
there are no pack files without .keep files.
In the first case, the modifications to pack-objects that I propose
will prevent objects that exist in local packs with .keep files
from being packed into the new pack.
In the second case, the --incremental option would have done the same thing.
So this inconsistency already existed, but will now be removed in favor of
honoring .keep files.
That means the nifty hack of incrementally and sometimes fully repack the
odb to speed up cloning over dumb protocols no longer works properly, then.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
From: Brandon Casey <redacted>
Objects residing in pack files that have an associated .keep file are not
supposed to be repacked into new pack files, but they are.
Signed-off-by: Brandon Casey <redacted>
---
This version replaces the use of 'head -n -1' with a grep, and should
work on
all platforms.
sed 1q is faster, as it stops parsing after the first line (the same as
'head
-n 1' does, but in a more portable fashion).
Except that I wanted all but the _last_ line though.
I didn't think about using sed. Perhaps I could have used something like
sed -n -e '$q' -e 'p'
The grep works though.
-brandon
From: Andreas Ericsson <hidden> Date: 2016-06-15 22:45:36
Brandon Casey wrote:
Andreas Ericsson wrote:
quoted
Brandon Casey wrote:
quoted
From: Brandon Casey <redacted>
Objects residing in pack files that have an associated .keep file are not
supposed to be repacked into new pack files, but they are.
Signed-off-by: Brandon Casey <redacted>
---
This version replaces the use of 'head -n -1' with a grep, and should
work on
all platforms.
sed 1q is faster, as it stops parsing after the first line (the same as
'head
-n 1' does, but in a more portable fashion).
Except that I wanted all but the _last_ line though.
Ach pooie. That's what I get for trying to review stuff while watching
old 70's samurai movies. I misread your 'head' command.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
Junio,
Please leave this in pu for now, I have some concerns that I haven't
had time to write down yet.
-brandon
Brandon Casey wrote:
quoted hunk
From: Brandon Casey <redacted>
By default, pack-objects creates a pack file with every object specified by
the user. There are two options which can be used to exclude objects which
are accessible by the repository.
1) --incremental
This excludes any object which already exists in an accessible pack.
2) --local
This excludes any object which exists in a non-local pack.
With this patch, both arguments also cause objects which exist in packs
marked with a .keep file to be excluded. Only the --local option requires
an explicit check for the .keep file. If the user doesn't want the objects
in a pack marked with .keep to be exclude, then the .keep file should be
removed.
Additionally, this fixes the repack bug which allowed porcelain repack to
create packs which contained objects already contained in existing packs
marked with a .keep file.
Signed-off-by: Brandon Casey <redacted>
---
builtin-pack-objects.c | 2 +-
t/t7700-repack.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
@@ -4,7 +4,7 @@ test_description='git repack works correctly' ../test-lib.sh-test_expect_failure'objects in packs marked .keep are not repacked''+test_expect_success'objects in packs marked .keep are not repacked''echocontent1>file1&&echocontent2>file2&&gitadd.&&
Junio,
Please leave this in pu for now, I have some concerns that I haven't
had time to write down yet.
I've been thinking about pack-objects and repack.
Here's how I think the semantics of repack should be defined:
repack:
<no-options>
-incremental repack which does not repack any object currently packed
in any accessible pack.
Works (it currently works this way).
<-a>
-create a new pack containing all objects required by the repository
including those accessible through alternates, but excluding objects
in _local_ packs with .keep
Flawed, even with my recent patches.
If there are no local packs (or they all have .keep files), then the
pack-objects call will use --incremental which will exclude objects
packed in alt object store, even though -l was not used.
My patches do not differentiate local .keep files from remote .keep files,
which a user may have no control over.
<-A>
-Like -a, but local unreferenced objects which were previously packed
are made to be loose.
Ditto.
<-a -l>
-Restrict operation to only local objects. Only has any effect with -a|-A.
-Like -a, but additionally exclude objects in packs accessible through
alternates.
Works with my recent patches.
<-A -l>
-Like '-a -l', but loosen unreferenced local packed objects.
Ditto.
That set of repack operations needs to map to a combination of pack-objects
options:
<no-options>
-Create a pack with _all_ specified objects
<--unpacked>
-Exclude from packing any object already in an accessible pack.
(Ahh, this came from rev-list interface, and rejects objects at an
earlier stage than --incremental)
<--unpacked=sha1>
-Like '--unpacked', exclude already packed objects, but treat the objects
in the pack with specified sha1 as unpacked.
<--incremental>
-Exclude from packing any object already in an accessible pack,
regardless of whether it is in a pack specified by --unpacked=
(How is this different from --unpacked, even though the exclusion
operation is performed at a different stage? See my epiphany above
about the source of the --unpacked option)
<--unpacked --incremental>
-seems redundant, is there any functional difference?
<--local>
-Exclude objects from being packed that are not in the local object store.
The issue is how to provide my described 'repack -a' functionality.
There does not seem to be a mapping between the above options and the
required functionality.
I see two solutions, both require introducing a new option to pack-objects.
1) allow specifying a set of packs such that if an object resides
in any of the set, the object will not be included in the produced
pack.
Benefits:
-allows keeping pack-objects ignorant of .keep mechanism
-repack can easily be modified to produce the set of packs to ignore
Drawback:
-very round-about way just to have functionality to skip packs with
.keep file
2) New option telling pack-objects to skip objects in local .keep'd packs
Benefits:
-easy to implement in pack-objects
-easy to modify repack
Drawbacks:
-introduces new concept to pack-objects
Questions aside:
1) Are both --incremental and --unpacked still necessary pack-objects options?
2) Can --incremental become an alias for --unpacked, and go away?
patch(es) will follow.
-brandon
This adds a new option to pack-objects which will cause it to ignore an
object which appears in a local pack which has a .keep file, even if it
was specified for packing.
This option will be used by the porcelain repack.
Signed-off-by: Brandon Casey <redacted>
---
This series replaces the previous series starting at
6ee726bc "pack-objects: honor '.keep' files"
It should be applied on top of
f34cf12d "packed_git: convert pack_local flag into a bitfield and add pack_keep"
I created the series on top of f34cf12d rebased on top of master.
Suggestions for a more appropriate name for --honor-pack-keep are very welcome.
-brandon
Documentation/git-pack-objects.txt | 5 +++++
builtin-pack-objects.c | 7 +++++++
2 files changed, 12 insertions(+), 0 deletions(-)
@@ -109,6 +109,11 @@ base-name:: The default is unlimited, unless the config variable `pack.packSizeLimit` is set.+--honor-pack-keep::+ This flag causes an object already in a local pack that+ has a .keep file to be ignored, even if it appears in the+ standard input.+ --incremental:: This flag causes an object already in a pack ignored even if it appears in the standard input.
If the user created a .keep file for a local pack, then it can be inferred
that the user does not want those objects repacked.
This fixes the repack bug tested by t7700.
Signed-off-by: Brandon Casey <redacted>
---
git-repack.sh | 2 +-
t/t7700-repack.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
@@ -4,7 +4,7 @@ test_description='git repack works correctly' ../test-lib.sh-test_expect_failure'objects in packs marked .keep are not repacked''+test_expect_success'objects in packs marked .keep are not repacked''echocontent1>file1&&echocontent2>file2&&gitadd.&&
When repack is called with either the -a or -A option, the user has
requested to repack all objects including those referenced by the
alternates mechanism. Currently, if there are no local packs without
.keep files, then repack will call pack-objects with the
'--unpacked --incremental' options which causes it to exclude alternate
packed objects. So, remove this fallback.
Signed-off-by: Brandon Casey <redacted>
---
git-repack.sh | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
Signed-off-by: Brandon Casey <redacted>
---
I think the existing code was broken. Looks like it would only skip
counting a pack if the pack disappeared between the prepare_packed_git()
and the access() call. It never used the path it create with the .keep
extension.
-brandon
builtin-gc.c | 12 +-----------
1 files changed, 1 insertions(+), 11 deletions(-)
@@ -131,19 +131,9 @@ static int too_many_packs(void)prepare_packed_git();for(cnt=0,p=packed_git;p;p=p->next){-charpath[PATH_MAX];-size_tlen;-intkeep;-if(!p->pack_local)continue;-len=strlen(p->pack_name);-if(PATH_MAX<=len+1)-continue;/* oops, give up */-memcpy(path,p->pack_name,len-5);-memcpy(path+len-5,".keep",6);-keep=access(p->pack_name,F_OK)&&(errno==ENOENT);-if(keep)+if(p->pack_keep)continue;/**Perhapscheckthesizeofthepackandcountonly
From: Andreas Ericsson <hidden> Date: 2016-06-15 22:45:37
Brandon Casey wrote:
quoted hunk
This adds a new option to pack-objects which will cause it to ignore an
object which appears in a local pack which has a .keep file, even if it
was specified for packing.
This option will be used by the porcelain repack.
Signed-off-by: Brandon Casey <redacted>
---
This series replaces the previous series starting at
6ee726bc "pack-objects: honor '.keep' files"
It should be applied on top of
f34cf12d "packed_git: convert pack_local flag into a bitfield and add pack_keep"
I created the series on top of f34cf12d rebased on top of master.
Suggestions for a more appropriate name for --honor-pack-keep are very welcome.
-brandon
Documentation/git-pack-objects.txt | 5 +++++
builtin-pack-objects.c | 7 +++++++
2 files changed, 12 insertions(+), 0 deletions(-)
@@ -109,6 +109,11 @@ base-name:: The default is unlimited, unless the config variable `pack.packSizeLimit` is set.+--honor-pack-keep::+ This flag causes an object already in a local pack that+ has a .keep file to be ignored, even if it appears in the+ standard input.+
Keep-files are *always* honored. Make this option "--ignore-kept" or
something instead, otherwise people will see the synopsis and think
they need to always pass it to not remove .keep-protected packs,
which is stupid.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
From: Andreas Ericsson <hidden> Date: 2016-06-15 22:45:37
Brandon Casey wrote:
If the user created a .keep file for a local pack, then it can be inferred
that the user does not want those objects repacked.
I disagree. It can be inferred that the user doesn't want those packfiles
*removed*.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
On Mon, Nov 03, 2008 at 02:37:05PM -0600, Brandon Casey wrote:
quoted
This version replaces the use of 'head -n -1' with a grep, and should work on
all platforms.
Hmm. I'm not sure what happened, but the version in 'next' has "head -n
-1" in it.
Well, there were so many revisions, I probably should have re-rolled the
whole series. I wasn't sure this was going to go in as is, based on the
[Dropped] message in the "What's Cooking" email and Junio's last email about
reconciling --unpacked and --incremental. I have been working through
the --unpacked code path, but I'm not to the point where I can suggest
a change there.
But, I think it's worse than just the wrong t7700.
These two:
packed_git: convert pack_local flag into generic bit mask
packed_git: add new PACK_KEEP flag and haspackkeep() access macro
should have been replaced by:
packed_git: convert pack_local flag into a bitfield and add pack_keep
which uses a struct bitfield rather than a bitmask.
And then this
pack-objects: honor '.keep' files
was replaced by this
pack-objects: new option --honor-pack-keep
repack: don't repack local objects in packs with .keep file
if that's the way we want to go. I'm not partial to the phrase honor-pack-keep,
but I don't think ignore-pack-keep is appropriate, and it's the best I've come
up with.
So,
31d92611e45d1286b805e362dbc451936af24121
7c335327be664751fa4c04e81b2fe3bfedceaada
77b5a5478a77cc04b674891b542db1ba1a1bf4f7
13e7f5d2f1da42619bd545590d0044b30d00ce4b
should be reverted, and replaced by the series to follow.
-brandon
If the user created a .keep file for a local pack, then it can be inferred
that the user does not want those objects repacked.
This fixes the repack bug tested by t7700.
Signed-off-by: Brandon Casey <redacted>
---
git-repack.sh | 2 +-
t/t7700-repack.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
@@ -4,7 +4,7 @@ test_description='git repack works correctly' ../test-lib.sh-test_expect_failure'objects in packs marked .keep are not repacked''+test_expect_success'objects in packs marked .keep are not repacked''echocontent1>file1&&echocontent2>file2&&gitadd.&&
When repack is called with either the -a or -A option, the user has
requested to repack all objects including those referenced by the
alternates mechanism. Currently, if there are no local packs without
.keep files, then repack will call pack-objects with the
'--unpacked --incremental' options which causes it to exclude alternate
packed objects. So, remove this fallback.
Signed-off-by: Brandon Casey <redacted>
---
git-repack.sh | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
@@ -131,19 +131,9 @@ static int too_many_packs(void)prepare_packed_git();for(cnt=0,p=packed_git;p;p=p->next){-charpath[PATH_MAX];-size_tlen;-intkeep;-if(!p->pack_local)continue;-len=strlen(p->pack_name);-if(PATH_MAX<=len+1)-continue;/* oops, give up */-memcpy(path,p->pack_name,len-5);-memcpy(path+len-5,".keep",6);-keep=access(p->pack_name,F_OK)&&(errno==ENOENT);-if(keep)+if(p->pack_keep)continue;/**Perhapscheckthesizeofthepackandcountonly
From: Brandon Casey <redacted>
Objects residing in pack files that have an associated .keep file are not
supposed to be repacked into new pack files, but they are.
Signed-off-by: Brandon Casey <redacted>
---
t/t7700-repack.sh | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
create mode 100755 t/t7700-repack.sh
@@ -0,0 +1,38 @@+#!/bin/sh++test_description='git repack works correctly'++../test-lib.sh++test_expect_failure'objects in packs marked .keep are not repacked''+echocontent1>file1&&+echocontent2>file2&&+gitadd.&&+gitcommit-minitial_commit&&+# Create two packs+# The first pack will contain all of the objects except one+gitrev-list--objects--all|grep-vfile2|+gitpack-objectspack>/dev/null&&+# The second pack will contain the excluded object+packsha1=$(gitrev-list--objects--all|grepfile2|+gitpack-objectspack)&&+touch-rpack-$packsha1.packpack-$packsha1.keep&&+objsha1=$(gitverify-pack-vpack-$packsha1.idx|head-n1|+sed-e"s/^\([0-9a-f]\{40\}\).*/\1/")&&+mvpack-*.git/objects/pack/&&+gitrepack-A-d-l&&+gitprune-packed&&+forpin.git/objects/pack/*.idx;do+idx=$(basename$p)+test"pack-$packsha1.idx"="$idx"&&continue+ifgitverify-pack-v$p|egrep"^$objsha1";then+found_duplicate_object=1+echo"DUPLICATE OBJECT FOUND"+break+fi+done&&+test-z"$found_duplicate_object"+'++test_done+
This adds a new option to pack-objects which will cause it to ignore an
object which appears in a local pack which has a .keep file, even if it
was specified for packing.
This option will be used by the porcelain repack.
Signed-off-by: Brandon Casey <redacted>
---
Documentation/git-pack-objects.txt | 5 +++++
builtin-pack-objects.c | 7 +++++++
2 files changed, 12 insertions(+), 0 deletions(-)
@@ -109,6 +109,11 @@ base-name:: The default is unlimited, unless the config variable `pack.packSizeLimit` is set.+--honor-pack-keep::+ This flag causes an object already in a local pack that+ has a .keep file to be ignored, even if it appears in the+ standard input.+ --incremental:: This flag causes an object already in a pack ignored even if it appears in the standard input.
Previously, when 'repack -a' was called and there were no packs in the local
repository without a .keep file, the repack would fall back to calling
pack-objects with '--unpacked --incremental'. This resulted in the created
pack file, if any, to be missing the packed objects in the alternate object
store. Test that this specific case has been fixed.
Signed-off-by: Brandon Casey <redacted>
---
Here is a test to demonstrate what
[PATCH 5/6] repack: do not fall back to incremental repacking with [-a|-A]
fixes.
This should apply cleanly to next since it includes
a836cfa3 t7700: demonstrate mishandling of loose objects in an alternate ODB
which has a few context lines showing through in the diff below.
-brandon
t/t7700-repack.sh | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
@@ -53,5 +53,21 @@ test_expect_success 'loose objects in alternate ODB are not repacked' 'test-z"$found_duplicate_object"'+test_expect_success'packed obs in alt ODB are repacked even when local repo is packless''+mkdiralt_objects/pack+mv.git/objects/pack/*alt_objects/pack&&+gitrepack-a&&+myidx=$(ls-1.git/objects/pack/*.idx)&&+test-f"$myidx"&&+forpinalt_objects/pack/*.idx;do+gitverify-pack-v$p|sed-n-e"/^[0-9a-f]\{40\}/p"+done|whilereadsha1rest;do+if!(gitverify-pack-v$myidx|grep"^$sha1");then+echo"Missing object in local pack: $sha1"+return1+fi+done+'+ test_done