1
0
mirror of https://github.com/git/git.git synced 2024-09-22 03:12:08 +02:00
Commit Graph

31 Commits

Author SHA1 Message Date
Junio C Hamano
63049292e0 Teach git-repack to preserve objects referred to by reflog entries.
This adds a new option --reflog to pack-objects and revision
machinery; do not bother documenting it for now, since this is
only useful for local repacking.

When the option is passed, objects reachable from reflog entries
are marked as interesting while computing the set of objects to
pack.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-20 17:22:10 -08:00
Nicolas Pitre
ad2c82c0e1 repacked packs should be read-only
... just like the other pack creating tools do.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 14:18:16 -08:00
Shawn Pearce
ce8590748b Only repack active packs by skipping over kept packs.
During `git repack -a -d` only repack objects which are loose or
which reside in an active (a non-kept) pack.  This allows the user
to keep large packs as-is without continuous repacking and can be
very helpful on large repositories.  It should also help us resolve
a race condition between `git repack -a -d` and the new pack store
functionality in `git-receive-pack`.

Kept packs are those which have a corresponding .keep file in
$GIT_OBJECT_DIRECTORY/pack.  That is pack-X.pack will be kept
(not repacked and not deleted) if pack-X.keep exists in the same
directory when `git repack -a -d` starts.

Currently this feature is not documented and there is no user
interface to keep an existing pack.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-29 12:46:21 -08:00
Junio C Hamano
05eb811aa1 Merge branch 'np/pack'
* np/pack:
  add the capability for index-pack to read from a stream
  index-pack: compare only the first 20-bytes of the key.
  git-repack: repo.usedeltabaseoffset
  pack-objects: document --delta-base-offset option
  allow delta data reuse even if base object is a preferred base
  zap a debug remnant
  let the GIT native protocol use offsets to delta base when possible
  make pack data reuse compatible with both delta types
  make git-pack-objects able to create deltas with offset to base
  teach git-index-pack about deltas with offset to base
  teach git-unpack-objects about deltas with offset to base
  introduce delta objects with offset to base
2006-10-22 22:51:42 -07:00
Junio C Hamano
b6945f570a git-repack: repo.usedeltabaseoffset
When configuration variable `repack.UseDeltaBaseOffset` is set
for the repository, the command passes `--delta-base-offset`
option to `git-pack-objects`; this typically results in slightly
smaller packs, but the generated packs are incompatible with
versions of git older than (and including) v1.4.3.

We will make it default to true sometime in the future, but not
for a while.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-13 21:28:58 -07:00
Jeff King
d0b353b1a7 git-repack: allow git-repack to run in subdirectory
Now that we explicitly create all tmpfiles below $GIT_DIR, there's no reason
to care about which directory we're in.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 20:16:23 -07:00
Junio C Hamano
cd0d74d2f9 repack: use only pack-objects, not rev-list.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-20 11:15:32 -07:00
Martin Langhoff
0ea2582d1c git-repack: create new packs inside $GIT_DIR, not cwd
Avoid failing when cwd is !writable by writing the
packfiles in $GIT_DIR, which is more in line with other commands.

Without this, git-repack was failing when run from crontab
by non-root user accounts. For large repositories, this
also makes the mv operation a lot cheaper, and avoids leaving
temp packfiles around the fs upon failure.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-06 00:21:57 -07:00
Matthias Kestenholz
9e84801396 Check if pack directory exists prior to descending into it
This fixes the following warning:

git-repack: line 42: cd: .git/objects/pack: No such file or directory

This happens only, when git-repack -a is run without any packs in the
repository.

Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-29 02:17:15 -07:00
Junio C Hamano
a72f9373c0 git-repack: avoid redirecting stderr into git-pack-objects
We are trying to catch error condition of git-rev-list and cause
the downstream pack-objects to barf, but if you run rev-list
with anything that mucks with its stderr (such as GIT_TRACE),
any stderr output would cause the pipeline to fail.

[jc: originally from Matthias Lederhofer, with a reworded error message.]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-12 23:00:46 -07:00
Junio C Hamano
2ad47d61b9 git-repack: Be careful when updating the same pack as an existing one.
After a clone, packfiles are read-only by default and "mv" to
replace the pack with a new one goes interactive, asking if the
user wants to replace it.  If one is successfully moved and the
other is not, the pack and its idx would become out-of-sync and
corrupts the repository.

Recovering is straightforward -- it is just the matter of
finding the remaining .tmp-pack-* and make sure they are both
moved -- but we should be extra careful not to do something so
alarming to the users.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-25 05:28:58 -07:00
Martin Langhoff
1054dcd165 git-repack -- respect -q and be quiet
git-repack was passing the -q along to pack-objects but ignoring it
itself. Correct the oversight.
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-24 03:06:30 -07:00
Junio C Hamano
fd60acaced Merge branch 'fix'
* fix:
  repack: honor -d even when no new pack was created
  clone: keep --reference even with -l -s
  repo-config: document what value_regexp does a bit more clearly.
  Release config lock if the regex is invalid
  core-tutorial.txt: escape asterisk
2006-05-07 15:36:39 -07:00
Martin Waitz
178613c737 repack: honor -d even when no new pack was created
If all objects are reachable via an alternate object store then we
still have to remove all obsolete local packs.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-07 15:35:50 -07:00
Linus Torvalds
ccb365047a Allow "git repack" users to specify repacking window/depth
.. but don't even bother documenting it. I don't think any normal person
is supposed to ever really care, but it simplifies testing when you want
to use the "git repack" wrapper rather than forcing you to use the core
programs (which already do support the window/depth arguments, of course).

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-19 10:31:23 -07:00
Jim Radford
40e907bff2 fix repacking with lots of tags
Use git-rev-list's --all instead of git-rev-parse's to keep from
hitting the shell's argument list length limits when repacking
with lots of tags.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-02 21:25:57 -07:00
Junio C Hamano
2d0048e681 repack: prune loose objects when -d is given
[jc: the request originally came from Martin Atukunda, which was
 improved further by Alex Riesen]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-10 22:07:23 -08:00
Junio C Hamano
cec2be76d9 git-repack: allow passing a couple of flags to pack-objects.
A new flag -q makes underlying pack-objects less chatty.
A new flag -f forces delta to be recomputed from scratch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-17 02:11:38 -08:00
freku045@student.liu.se
9678faaaff git-repack: Usage string clean-up, emit usage at incorrect invocation
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-14 02:53:44 -08:00
Junio C Hamano
ae2b0f1518 git-sh-setup: die if outside git repository.
Now all the users of this script detect its exit status and die,
complaining that it is outside git repository.  So move the code
that dies from all callers to git-sh-setup script.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 13:49:17 -08:00
Linus Torvalds
ef07618fdd git-repack: Properly abort in corrupt repository
In a corrupt repository, git-repack produces a pack that does not
contain needed objects without complaining, and the result of this
combined with -d flag can be very painful -- e.g. a lossage of one
tree object can lead to lossage of blobs reachable only through that
tree.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 14:08:49 -08:00
Junio C Hamano
6ed64058e1 git-repack: do not do complex redundancy check.
With "-a", redundant pack removal is trivial, and otherwise
redundant pack removal is pointless; do not call
git-redundant-pack from this script.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-19 12:13:53 -08:00
Lukas Sandström
62af0b532b Remove all old packfiles when doing "git repack -a -d"
No point in running git-pack-redundant if we already know
which packs are redundant.

Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-18 14:26:31 -08:00
Ralf Baechle
0adb3358f6 git-repack: Fix variable name
Three times remove_redandant -> remove_redundant.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-17 21:28:45 -08:00
Lukas_Sandström
1c3039e8f1 Make git-pack-redundant consider alt-odbs
This patch changes git-pack-redundant so that packfiles
in alternate object directories also are considered when
deciding which objects are redundant.

This functionality is controlled by the flag '--alt-odb'.

Also convert the other flags to the long form, and update
docs and git-repack accordingly.

Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-11 21:19:11 -08:00
Lukas_Sandström
9bc0f32c77 Rename git-pack-intersect to git-pack-redundant
This patch renames git-pack-intersect to git-pack-redundant
as suggested by Petr Baudis. The new name reflects what the
program does, rather than how it does it.

Also fix a small argument parsing bug.

Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-11 21:19:11 -08:00
Lukas_Sandström
b4ad3552de Make git-repack use git-pack-intersect.
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-11 21:19:11 -08:00
Linus Torvalds
41f222e87a Be marginally more careful about removing objects
The git philosophy when it comes to disk accesses is "Laugh in the face of
danger".

Notably, since we never modify an existing object, we don't really care
that deeply about flushing things to disk, since even if the machine
crashes in the middle of a git operation, you can never really have lost
any old work. At most, you'd need to figure out the proper heads (which
git-fsck-objects can do for you) and re-do the operation.

However, there's two exceptions to this: pruning and repacking. Those
operations will actually _delete_ old objects that they know about in
other ways (ie that they just repacked, or that they have found in other
places).

However, since they actually modify old state, we should thus be a bit
more careful about them. If the machine crashes and the duplicate new
objects haven't been flushed to disk, you can actually be in trouble.

This is trivially stupid about it by calling "sync" before removing the
objects. Not very smart, but we're talking about special operations than
are usually done once a week if that.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-28 14:25:02 -07:00
Linus Torvalds
f7aac2eac9 Add "-l" flag for repacking only local packs
This uses the new "--local" flag to git-pack-objects.  It currently only
makes a difference together with "-a", since a normal incremental repack
won't pack any packed objects at all (whether local or remote).

Eventually, it might end up skipping any objects that aren't local to
the current object directory, but for now it only knows to skip packed
objects.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-13 15:38:29 -07:00
Junio C Hamano
490e23d22a Archive-destroying "git repack -a -d" bug.
Using "git repack -a -d" can destroy your git archive if you use it
twice in succession, because the new pack can be called the same as
the old pack.  Found by Linus.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-17 23:35:49 -07:00
Junio C Hamano
215a7ad1ef Big tool rename.
As promised, this is the "big tool rename" patch.  The primary differences
since 0.99.6 are:

  (1) git-*-script are no more.  The commands installed do not
      have any such suffix so users do not have to remember if
      something is implemented as a shell script or not.

  (2) Many command names with 'cache' in them are renamed with
      'index' if that is what they mean.

There are backward compatibility symblic links so that you and
Porcelains can keep using the old names, but the backward
compatibility support  is expected to be removed in the near
future.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-07 17:45:20 -07:00