Code

git.git
19 years agoMove ref path matching to connect.c library
Linus Torvalds [Mon, 4 Jul 2005 20:24:30 +0000 (13:24 -0700)]
Move ref path matching to connect.c library

It's a generic thing for matching refs from the other side.

19 years agoFactor out the ssh connection stuff from send-pack.c
Linus Torvalds [Mon, 4 Jul 2005 18:57:58 +0000 (11:57 -0700)]
Factor out the ssh connection stuff from send-pack.c

I want to use it for git-fetch-pack too.

19 years ago[PATCH] Fixup t/t5300 unit tests broken by 5f3de58ff85c49620ae2a1722d8d4d37c881a054
Jon Seymour [Mon, 4 Jul 2005 13:15:36 +0000 (23:15 +1000)]
[PATCH] Fixup t/t5300 unit tests broken by 5f3de58ff85c49620ae2a1722d8d4d37c881a054

This patch fixes up the t/t5300 unit tests which were broken by the changes in:

Make the name of a pack-file depend on the objects packed there-in.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agogit-rev-parse: support show sha1 names for pack entries
Linus Torvalds [Mon, 4 Jul 2005 04:01:11 +0000 (21:01 -0700)]
git-rev-parse: support show sha1 names for pack entries

This is actually subtly wrong.  If a short match is found in the object
directory, but would _also_ match another SHA1 ID in a pack (or it shows
in one pack but not another), we'll never have done the pack lookup, and
we think it's unique.

I can't find it in myself to care.  You really want to use enough of a
SHA1 that there is never any ambiguity.

19 years agoMake git-rev-parse support cogito-style "short hex names"
Linus Torvalds [Mon, 4 Jul 2005 03:27:06 +0000 (20:27 -0700)]
Make git-rev-parse support cogito-style "short hex names"

Currently only for unpacked objects, but the infrastructure
is there to do it for packed objects too.

19 years agoMake the name of a pack-file depend on the objects packed there-in.
Linus Torvalds [Sun, 3 Jul 2005 22:34:04 +0000 (15:34 -0700)]
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.

19 years agoAdd "git-prune-packed" that removes objects that exist in a pack.
Linus Torvalds [Sun, 3 Jul 2005 21:27:34 +0000 (14:27 -0700)]
Add "git-prune-packed" that removes objects that exist in a pack.

This, together with "git repack" can be used to clean up unpacked
git archives.

19 years agoAdd "git repack" command that does an incremental pack
Linus Torvalds [Sun, 3 Jul 2005 20:38:01 +0000 (13:38 -0700)]
Add "git repack" command that does an incremental pack

19 years agoAdd "--non-empty" flag to git-pack-objects
Linus Torvalds [Sun, 3 Jul 2005 20:36:58 +0000 (13:36 -0700)]
Add "--non-empty" flag to git-pack-objects

It skips writing the pack-file if it ends up being empty.

19 years ago"git rev-list --unpacked" shows only unpacked commits
Linus Torvalds [Sun, 3 Jul 2005 20:29:54 +0000 (13:29 -0700)]
"git rev-list --unpacked" shows only unpacked commits

More infrastructure to do efficient incremental packs.

19 years agoAdd "--incremental" flag to git-pack-objects
Linus Torvalds [Sun, 3 Jul 2005 20:08:40 +0000 (13:08 -0700)]
Add "--incremental" flag to git-pack-objects

It won't add an object that is already in a pack to the new pack.

19 years agoAdd "--all" flag to rev-parse that shows all refs
Linus Torvalds [Sun, 3 Jul 2005 20:07:52 +0000 (13:07 -0700)]
Add "--all" flag to rev-parse that shows all refs

And make git-rev-list just silently ignore non-commit refs if we're not
asking for all objects.

19 years agoAdd "has_sha1_pack()" function to query whether the object is available in a pack
Linus Torvalds [Sun, 3 Jul 2005 20:06:36 +0000 (13:06 -0700)]
Add "has_sha1_pack()" function to query whether the object is available in a pack

We'll want this for incremental packing.

19 years agoMake git-fsck-cache check HEAD integrity
Linus Torvalds [Sun, 3 Jul 2005 17:40:38 +0000 (10:40 -0700)]
Make git-fsck-cache check HEAD integrity

In particular, check that it's a symlink, and points to refs/heads/.  We
depend on that these days not only for "git checkout", but also because
fsck and others only check for references in the .git/refs/
subdirectory, not things like HEAD itself.

19 years agoFix sparse warnings.
Linus Torvalds [Sun, 3 Jul 2005 17:10:45 +0000 (10:10 -0700)]
Fix sparse warnings.

Mainly making a lot of local functions and variables be marked "static",
but there was a "zero as NULL" warning in there too.

19 years agoFix up header file dependencies and add sparse checking rules
Linus Torvalds [Sun, 3 Jul 2005 17:02:35 +0000 (10:02 -0700)]
Fix up header file dependencies and add sparse checking rules

We're pretty sparse-clean already, thanks to earlier efforts, but some
things inevitably creep in.

19 years agoFix up "for_each_ref()" to be more usable, and use it in git-fsck-cache
Linus Torvalds [Sun, 3 Jul 2005 17:01:38 +0000 (10:01 -0700)]
Fix up "for_each_ref()" to be more usable, and use it in git-fsck-cache

It needed to take the GIT_DIR information into account, something that
the original receive-pack usage just never cared about.

19 years agoFix gcc warning in send-pack.c
Linus Torvalds [Sun, 3 Jul 2005 17:00:01 +0000 (10:00 -0700)]
Fix gcc warning in send-pack.c

send_pack() was declared to return "int" (although nobody cared), but
didn't actually return anything.

19 years agoAvoid gcc warnings in sha1_file.c
Linus Torvalds [Sun, 3 Jul 2005 16:58:44 +0000 (09:58 -0700)]
Avoid gcc warnings in sha1_file.c

A couple of bogus "might be used undefined" warnings are avoided
by moving the initializations unnecessarily early.

19 years agoGeneralize the "show each ref" code in receice-pack
Linus Torvalds [Sun, 3 Jul 2005 03:23:36 +0000 (20:23 -0700)]
Generalize the "show each ref" code in receice-pack

This turns it into a generic "do xyz for each ref" library function.

19 years ago[PATCH] Show more details of packfile with verify-pack -v.
Junio C Hamano [Fri, 1 Jul 2005 00:17:20 +0000 (17:17 -0700)]
[PATCH] Show more details of packfile with verify-pack -v.

This implements show_pack_info() function used in verify-pack
command when -v flag is used to obtain something like
unpack-objects used to give when it was first written.

It shows the following for each non-deltified object found in
the pack:

    SHA1 type size offset

For deltified objects, it shows this instead:

    SHA1 type size offset depth base_sha1

In order to get the output in the order that appear in the pack
file for debugging purposes, you can do this:

 $ git-verify-pack -v packfile | sort -n -k 4,4

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] verify-pack updates.
Junio C Hamano [Fri, 1 Jul 2005 00:15:39 +0000 (17:15 -0700)]
[PATCH] verify-pack updates.

Nico pointed out that having verify_pack.c and verify-pack.c was
confusing.  Rename verify_pack.c to pack-check.c as suggested,
and enhances the verification done quite a bit.

 - Built-in sha1_file unpacking knows that a base object of a
   deltified object _must_ be in the same pack, and takes
   advantage of that fact.

 - Earlier verify-pack command only checked the SHA1 sum for the
   entire pack file and did not look into its contents.  It now
   checks everything idx file claims to have unpacks correctly.

 - It now has a hook to give more detailed information for
   objects contained in the pack under -v flag.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Avoid unnecessarily inflating and interpreting delta
Junio C Hamano [Fri, 1 Jul 2005 00:13:07 +0000 (17:13 -0700)]
[PATCH] Avoid unnecessarily inflating and interpreting delta

This teaches packed_delta_info() that it only needs to look at
the type of the base object to figure out both type and size of
a deltified object.  This saves quite a many calls to inflate()
when dealing with a deep delta chain.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoDo ref matching on the sender side rather than on receiver
Linus Torvalds [Thu, 30 Jun 2005 19:28:24 +0000 (12:28 -0700)]
Do ref matching on the sender side rather than on receiver

This makes the receiver always send a full list of valid refs, which
will allow us to do better packs, as well as handle creation of new
refs.  Eventually.  Right now we just moved the matching and enabled it.

So now you can do

git-send-pack host:path branch1 branch2

to only send branches "branch1" and "branch2".

19 years agoAdd support for "forcing" a ref on the remote side
Linus Torvalds [Thu, 30 Jun 2005 18:04:59 +0000 (11:04 -0700)]
Add support for "forcing" a ref on the remote side

A "old ref" of all zeroes is considered a "don't care" ref, and allows
us to say "write the new ref regardless of what the old ref contained
(or even if it existed at all)".

This allows (if git-send-pack were to do it) creating new refs, and
fixing up old ones.

19 years agogit-send-pack: actually send the object pack
Linus Torvalds [Thu, 30 Jun 2005 17:17:39 +0000 (10:17 -0700)]
git-send-pack: actually send the object pack

This concludes this lesson.  I've actually successfully sent an update
using the git-send-pack command.

Probably tons of work still to do, and nasty debugging, but it's now
actually potentially useful.

19 years agogit-receive-pack: implement ref switch command handling
Linus Torvalds [Thu, 30 Jun 2005 17:15:22 +0000 (10:15 -0700)]
git-receive-pack: implement ref switch command handling

After unpacking the object pack successfully, we go through the list of
refs, and verify that they still contain their expected values.  Then we
replace them with the new ones.

19 years agoAdd comment on what send-pack still needs to do
Linus Torvalds [Thu, 30 Jun 2005 06:07:01 +0000 (23:07 -0700)]
Add comment on what send-pack still needs to do

Me tired.

19 years agogit-receive-pack: start parsing ref update commands
Linus Torvalds [Thu, 30 Jun 2005 06:01:14 +0000 (23:01 -0700)]
git-receive-pack: start parsing ref update commands

We don't act on them yet, but we parse them.

19 years agoSlow but steady progress on git pack receive/send
Linus Torvalds [Thu, 30 Jun 2005 05:50:48 +0000 (22:50 -0700)]
Slow but steady progress on git pack receive/send

19 years agogit-send-pack: start parsing local/remote reference differences
Linus Torvalds [Thu, 30 Jun 2005 05:31:41 +0000 (22:31 -0700)]
git-send-pack: start parsing local/remote reference differences

Right now it just shows which refs it picks up, and whether they are
the same or changed on the remote end. Getting there..

19 years agoTurn on optimization again
Linus Torvalds [Thu, 30 Jun 2005 04:08:21 +0000 (21:08 -0700)]
Turn on optimization again

It got turned off by mistake just because I had been doing debugging,
and committed the Makefile that had other changes ...

19 years ago[PATCH] Remove unnecessary sort from t6001 testcase
Jon Seymour [Thu, 30 Jun 2005 02:41:59 +0000 (12:41 +1000)]
[PATCH] Remove unnecessary sort from t6001 testcase

This patch removes an unnecessary sort from the t6001 testcase.

Sorts were previously necessary when testing non --merge-order cases
because the output order wasn't entirely deterministic unless commit
date was fixed.

However, commit dates are now fixed, so the need for a sort has
disappeared.  So the sort has been removed.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Fix broken t6001 test case
Jon Seymour [Thu, 30 Jun 2005 02:41:57 +0000 (12:41 +1000)]
[PATCH] Fix broken t6001 test case

This fix fixes a t/t6001 test case break that was hidden by a bug in the
test case infrastructure.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Demonstrate broken t6001 test case function
Jon Seymour [Thu, 30 Jun 2005 02:41:55 +0000 (12:41 +1000)]
[PATCH] Demonstrate broken t6001 test case function

Junio discovered a problem where an actual test case break was hidden
because pipelines are not handled properly by the test infrastructure in
t6001.

This patch fixes the broken infrastructure (and demonstrates the break
explicitly).

A subsequent patch in this series will fix the test case so that it
doesn't fail.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Fix for git-rev-list --merge-order B ^A (A,B share common base) [rev 2]
Jon Seymour [Thu, 30 Jun 2005 01:51:34 +0000 (11:51 +1000)]
[PATCH] Fix for git-rev-list --merge-order B ^A (A,B share common base) [rev 2]

This patch makes --merge-order produce the same list as git-rev-list
without --merge-order specified.

In particular, if the graph looks like this:

A
| B
|/
C
|
D

The both git-rev-list B ^A and git-rev-list --merge-order will produce B.

The unit tests have been changed to reflect the fact that the prune
points are now formally part of the start list that is used to perform
the --merge-order sort.

That is: git-rev-list --merge-order A ^D used to produce

= A
| C

It now produces:

^ A
| C

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Test case that demonstrates problem with --merge-order ^ processing
Jon Seymour [Wed, 29 Jun 2005 23:45:30 +0000 (09:45 +1000)]
[PATCH] Test case that demonstrates problem with --merge-order ^ processing

Added a test case that shows that --merge-order doesn't produce the
correct result in the following case.

A
|
| B
|/
C
|
D

git-rev-list --merge-order A ^B should produce just A. Instead
it produces BCD.

A subsequent patch will fix this defect.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoMake send/receive-pack be closer to doing something interesting
Linus Torvalds [Thu, 30 Jun 2005 03:50:15 +0000 (20:50 -0700)]
Make send/receive-pack be closer to doing something interesting

19 years agoStart of "git-send-pack", the local part of sending off a pack
Linus Torvalds [Thu, 30 Jun 2005 02:09:05 +0000 (19:09 -0700)]
Start of "git-send-pack", the local part of sending off a pack

Like git-receive-pack, this is only partway done.

19 years agoAdd first cut at "git-receive-pack"
Linus Torvalds [Thu, 30 Jun 2005 00:52:11 +0000 (17:52 -0700)]
Add first cut at "git-receive-pack"

It's not working yet, but it's at the point where I want to be able to
track my changes.  The theory of operation is that this is the "remote"
side of a "git push".  It can tell us what references the remote side
has, receives out reference update commands and a pack-file, and can
execute the unpacking command.

19 years agoRemove bogus dup commit warning with --merge-order
Linus Torvalds [Wed, 29 Jun 2005 18:40:58 +0000 (11:40 -0700)]
Remove bogus dup commit warning with --merge-order

It makes gitk unhappy, and besides, non-merge-order doesn't complain, so
why do it here..

19 years agoTeach git-rev-list about non-commit objects
Linus Torvalds [Wed, 29 Jun 2005 18:30:24 +0000 (11:30 -0700)]
Teach git-rev-list about non-commit objects

Now you can give git-rev-list tags, trees and blobs, and it will do the
proper reachability for them all. Knock wood.

Of course, you need the "--objects" flag to do anything but plain
commits.

19 years agoPrepare git-rev-list for tracking tag objects too
Linus Torvalds [Wed, 29 Jun 2005 17:40:14 +0000 (10:40 -0700)]
Prepare git-rev-list for tracking tag objects too

We want to be able to just say "give a difference between these
objects", rather than limiting it to commits only.  This isn't there
yet, but it sets things up to be a bit easier.

19 years ago[PATCH] Adjust t5300 test for unpack-objects change
Junio C Hamano [Wed, 29 Jun 2005 06:07:34 +0000 (23:07 -0700)]
[PATCH] Adjust t5300 test for unpack-objects change

It now always read from standard input and rejects non-flag
arguments.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoRe-instate dry-run logic in git-unpack-objects
Linus Torvalds [Wed, 29 Jun 2005 16:53:20 +0000 (09:53 -0700)]
Re-instate dry-run logic in git-unpack-objects

It can no longer be as verbose, since it doesn't have a good way to
resolve deltas (now that it is purely streaming, it cannot seek around
to read the objects a delta is based on).

But it can check that the thing unpacks cleanly at least as far as pack
syntax goes - all the objects uncompress cleanly, and the pack has the
right final SHA1.

19 years agoClean up git-unpack-objects a bit
Linus Torvalds [Wed, 29 Jun 2005 16:38:02 +0000 (09:38 -0700)]
Clean up git-unpack-objects a bit

I'd like to add back the "dry-run" thing, but it turns out that to do it
well, I'd have to keep all the object data in memory (which is not
acceptable).  So I'll clean it up a bit and make it do as many checks as
it can.

19 years ago[PATCH] Add git-verify-pack command.
Junio C Hamano [Wed, 29 Jun 2005 09:51:27 +0000 (02:51 -0700)]
[PATCH] Add git-verify-pack command.

Given a list of <pack>.idx files, this command validates the
index file and the corresponding .pack file for consistency.

This patch also uses the same validation mechanism in fsck-cache
when the --full flag is used.

During normal operation, sha1_file.c verifies that a given .idx
file matches the .pack file by comparing the SHA1 checksum
stored in .idx file and .pack file as a minimum sanity check.
We may further want to check the pack signature and version when
we map the pack, but that would be a separate patch.

Earlier, errors to map a pack file was not flagged fatal but led
to a random fatal error later.  This version explicitly die()s
when such an error is detected.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Fixlets on top of Nico's clean-up.
Junio C Hamano [Wed, 29 Jun 2005 07:32:11 +0000 (00:32 -0700)]
[PATCH] Fixlets on top of Nico's clean-up.

If we prefer 0 as maxsize for diff_delta() to say "unlimited", let's be
consistent about it.

This patch also fixes type mismatch in a call to get_delta_hdr_size()
from packed_delta_info().

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] assorted delta code cleanup
Nicolas Pitre [Wed, 29 Jun 2005 06:49:56 +0000 (02:49 -0400)]
[PATCH] assorted delta code cleanup

This is a wrap-up patch including all the cleanups I've done to the
delta code and its usage.  The most important change is the
factorization of the delta header handling code.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoFix packed_delta_info() that was broken by the delta header packing change
Linus Torvalds [Wed, 29 Jun 2005 05:42:45 +0000 (22:42 -0700)]
Fix packed_delta_info() that was broken by the delta header packing change

Pointed out by Junio.

19 years agoMake git pack files use little-endian size encoding
Linus Torvalds [Wed, 29 Jun 2005 05:15:57 +0000 (22:15 -0700)]
Make git pack files use little-endian size encoding

This makes it match the new delta encoding, and admittedly makes the
code easier to follow.

This also updates the PACK file version to 2, since this (and the delta
encoding change in the previous commit) are incompatible with the old
format.

19 years ago[PATCH] denser delta header encoding
Nicolas Pitre [Wed, 29 Jun 2005 04:27:45 +0000 (00:27 -0400)]
[PATCH] denser delta header encoding

Since the delta data format is not tied to any actual git object
anymore, now is the time to add a small improvement to the delta data
header as it is been done for packed object header.  This patch allows
for reducing the delta header of about 2 bytes and makes for simpler
code.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Emit base objects of a delta chain when the delta is output.
Junio C Hamano [Wed, 29 Jun 2005 00:49:27 +0000 (17:49 -0700)]
[PATCH] Emit base objects of a delta chain when the delta is output.

Deltas are useless by themselves and when you use them you need to get
to their base objects.  A base object should inherit recency from the
most recent deltified object that is based on it and that is what this
patch teaches git-pack-objects.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agogit-unpack-objects: re-write to read from stdin
Linus Torvalds [Wed, 29 Jun 2005 03:34:23 +0000 (20:34 -0700)]
git-unpack-objects: re-write to read from stdin

It gets a bit more complicated to unpack in a streaming environment, but
here it is.  The rewrite is actually a lot cleaner in other ways, it's
just a bit more subtle.

19 years ago[PATCH] Use enhanced diff_delta() in the similarity estimator.
Junio C Hamano [Tue, 28 Jun 2005 23:58:27 +0000 (16:58 -0700)]
[PATCH] Use enhanced diff_delta() in the similarity estimator.

The diff_delta() interface was extended to reject generating too big a
delta while we were working on the packed GIT archive format.

Take advantage of that when generating delta in the similarity estimator
used in diffcore-rename.c

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Fix unpack-objects for header length information.
Junio C Hamano [Tue, 28 Jun 2005 23:49:28 +0000 (16:49 -0700)]
[PATCH] Fix unpack-objects for header length information.

Standalone unpack-objects command was not adjusted for header length
encoding change when dealing with deltified entry.  This fixes it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoMerge fighting fsck-cache updates from Junio
Linus Torvalds [Tue, 28 Jun 2005 22:20:10 +0000 (15:20 -0700)]
Merge fighting fsck-cache updates from Junio

It's just easier to let git help out with the merge than it is to try to
fix up the diffs.

19 years ago[PATCH] Update fsck-cache (take 2)
Junio C Hamano [Tue, 28 Jun 2005 21:58:33 +0000 (14:58 -0700)]
[PATCH] Update fsck-cache (take 2)

The fsck-cache complains if objects referred to by files in .git/refs/
or objects stored in files under .git/objects/??/ are not found as
stand-alone SHA1 files (i.e.  found in alternate object pools
GIT_ALTERNATE_OBJECT_DIRECTORIES or packed archives stored under
.git/objects/pack).

Although this is a good semantics to maintain consistency of a single
.git/objects directory as a self contained set of objects, it sometimes
is useful to consider it is OK as long as these "outside" objects are
available.

This commit introduces a new flag, --standalone, to git-fsck-cache.
When it is not specified, connectivity checks and .git/refs pointer
checks are taught that it is OK when expected objects do not exist under
.git/objects/?? hierarchy but are available from an packed archive or in
an alternate object pool.

Another new flag, --full, makes git-fsck-cache to check not only the
current GIT_OBJECT_DIRECTORY but also objects found in alternate object
pools and packed GIT archives.a

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Expose packed_git and alt_odb.
Junio C Hamano [Tue, 28 Jun 2005 21:56:57 +0000 (14:56 -0700)]
[PATCH] Expose packed_git and alt_odb.

The commands git-fsck-cache and probably git-*-pull needs to have a way
to enumerate objects contained in packed GIT archives and alternate
object pools.  This commit exposes the data structure used to keep track
of them from sha1_file.c, and adds a couple of accessor interface
functions for use by the enhanced git-fsck-cache command.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Bugfix: initialize pack_base to NULL.
Junio C Hamano [Tue, 28 Jun 2005 21:55:16 +0000 (14:55 -0700)]
[PATCH] Bugfix: initialize pack_base to NULL.

This was causing random segfaults, because use_packed_git() got
confused by random garbage there.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Adjust fsck-cache to packed GIT and alternate object pool.
Junio C Hamano [Tue, 28 Jun 2005 08:49:39 +0000 (01:49 -0700)]
[PATCH] Adjust fsck-cache to packed GIT and alternate object pool.

The fsck-cache complains if objects referred to by files in .git/refs/
or objects stored in files under .git/objects/??/ are not found as
stand-alone SHA1 files (i.e.  found in alternate object pools
GIT_ALTERNATE_OBJECT_DIRECTORIES or packed archives stored under
.git/objects/pack).

Although this is a good semantics to maintain consistency of a single
.git/objects directory as a self contained set of objects, it sometimes
is useful to consider it is OK as long as these "outside" objects are
available.

This commit introduces a new flag, --standalone, to git-fsck-cache.
When it is not specified, connectivity checks and .git/refs pointer
checks are taught that it is OK when expected objects do not exist under
.git/objects/?? hierarchy but are available from an packed archive or in
an alternate object pool.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoChange pack file format. Hopefully for the last time.
Linus Torvalds [Tue, 28 Jun 2005 21:21:02 +0000 (14:21 -0700)]
Change pack file format. Hopefully for the last time.

This also adds a header with a signature, version info, and the number
of objects to the pack file.  It also encodes the file length and type
more efficiently.

19 years agogit-pack-objects: add "--stdout" flag to write the pack file to stdout
Linus Torvalds [Tue, 28 Jun 2005 18:10:48 +0000 (11:10 -0700)]
git-pack-objects: add "--stdout" flag to write the pack file to stdout

This also suppresses creation of the index file.

19 years agocsum-file: add "sha1fd()" to create a SHA1 csum file from an existing file descriptor
Linus Torvalds [Tue, 28 Jun 2005 18:10:06 +0000 (11:10 -0700)]
csum-file: add "sha1fd()" to create a SHA1 csum file from an existing file descriptor

We'll use this soon to write pack-files to stdout.

19 years agoDuh. Fix transposed characters in git-pull-script
Linus Torvalds [Tue, 28 Jun 2005 17:15:10 +0000 (10:15 -0700)]
Duh. Fix transposed characters in git-pull-script

I'd stupidly only tested the non-branch-name version.

19 years agoTeach packing about "tag" objects
Linus Torvalds [Tue, 28 Jun 2005 16:58:23 +0000 (09:58 -0700)]
Teach packing about "tag" objects

(And teach sha1_file and unpack-object know how to unpack them too, of
course)

19 years ago[PATCH] git-cat-file: '-s' to find out object size.
Junio C Hamano [Tue, 28 Jun 2005 06:59:18 +0000 (23:59 -0700)]
[PATCH] git-cat-file: '-s' to find out object size.

We use sha1_object_info() now, and getting size is also trivial.

I admit that this is more of "because we can" not "because I see
immediate need for it", though.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] git-cat-file: use sha1_object_info() on '-t'.
Junio C Hamano [Tue, 28 Jun 2005 06:58:45 +0000 (23:58 -0700)]
[PATCH] git-cat-file: use sha1_object_info() on '-t'.

When trying to find out the type of the object, there is no need
to uncompress the whole object.  Just use sha1_object_info().

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Obtain sha1_file_info() for deltified pack entry properly.
Junio C Hamano [Tue, 28 Jun 2005 06:58:08 +0000 (23:58 -0700)]
[PATCH] Obtain sha1_file_info() for deltified pack entry properly.

The initial one was not doing enough to figure things out
without uncompressing too much.  It also fixes a potential
segfault resulting from missing use_packed_git() call.

We would need to introduce unuse_packed_git() call and do proper
use counting to figure out when it is safe to unmap, but
currently we do not unmap packed file yet.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoTeach git-pull-script about pulling tags
Linus Torvalds [Tue, 28 Jun 2005 03:10:32 +0000 (20:10 -0700)]
Teach git-pull-script about pulling tags

19 years agoFix another test that broke with the recent git-init-db update
Linus Torvalds [Tue, 28 Jun 2005 02:48:02 +0000 (19:48 -0700)]
Fix another test that broke with the recent git-init-db update

t5300-pack-object.sh test 8 expected to have to create the "pack"
directory itself, and was unhappy when it already existed.

19 years ago[PATCH] Skip writing out sha1 files for objects in packed git.
Junio C Hamano [Tue, 28 Jun 2005 02:03:13 +0000 (19:03 -0700)]
[PATCH] Skip writing out sha1 files for objects in packed git.

Now, there's still a misfeature there, which is that when you
create a new object, it doesn't check whether that object
already exists in the pack-file, so you'll end up with a few
recent objects that you really don't need (notably tree
objects), and this patch fixes it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] replace sha1sum with sum in t/t1002
Mark Allen [Tue, 28 Jun 2005 01:40:31 +0000 (18:40 -0700)]
[PATCH] replace sha1sum with sum in t/t1002

This replaces sha1sum(1) with sum(1) in t/t1002.  GNU sum(1) runs in
"BSD compatibility" mode by default, and not all systems have GNU
coreutils.  On any system without GNU coreutils (or sha1sum) t1002 will
fail.  This patch should make t1002 complete successfully everywhere
that sum(1) runs.

I've tested this on Darwin and Linux; it works on both platforms.

Signed-off-by: Mark Allen <mrallen1@yahoo.com>
Acked-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoFix up test that counted subdirectories in ".git/objects"
Linus Torvalds [Tue, 28 Jun 2005 02:10:01 +0000 (19:10 -0700)]
Fix up test that counted subdirectories in ".git/objects"

Now there are 257 of them (256 numeric ones, and the new "pack" directory)

19 years agogit-init-db: create "pack" subdirectory under objects
Linus Torvalds [Tue, 28 Jun 2005 01:26:11 +0000 (18:26 -0700)]
git-init-db: create "pack" subdirectory under objects

Don't make the user have to mkdir it just because he's excited about the
new object pack functionality, do it for him.

19 years agoMerge rsync://rsync.kernel.org/pub/scm/gitk/gitk
Linus Torvalds [Tue, 28 Jun 2005 01:15:47 +0000 (18:15 -0700)]
Merge rsync://rsync.kernel.org/pub/scm/gitk/gitk

19 years agocsum-file: fix missing buf pointer update
Linus Torvalds [Tue, 28 Jun 2005 00:02:56 +0000 (17:02 -0700)]
csum-file: fix missing buf pointer update

This would create broken pack archives for anything nontrivial.

19 years ago[PATCH] Teach read_sha1_file() and friends about packed git object store.
Junio C Hamano [Mon, 27 Jun 2005 10:35:33 +0000 (03:35 -0700)]
[PATCH] Teach read_sha1_file() and friends about packed git object store.

GIT_OBJECT_DIRECTORY and GIT_ALTERNATE_OBJECT_DIRECTORIES can
have the "pack" subdirectory that houses "packed GIT" files
produced by git-pack-objects (e.g. .git/objects/pack/foo.pack
and .git/objects/pack/foo.idx; always store them as pairs).  The
following functions in sha1_file.c can then read object contents
from such packed file:

 - sha1_object_info()
 - has_sha1_file()
 - read_sha1_file()

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Enhance sha1_file_size() into sha1_object_info()
Junio C Hamano [Mon, 27 Jun 2005 10:34:06 +0000 (03:34 -0700)]
[PATCH] Enhance sha1_file_size() into sha1_object_info()

This lets us eliminate one use of map_sha1_file() outside
sha1_file.c, to bring us one step closer to the packed GIT.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Remove "delta" object representation.
Junio C Hamano [Mon, 27 Jun 2005 10:33:33 +0000 (03:33 -0700)]
[PATCH] Remove "delta" object representation.

Packed delta files created by git-pack-objects seems to be the
way to go, and existing "delta" object handling code has exposed
the object representation details to too many places.  Remove it
while we refactor code to come up with a proper interface in
sha1_file.c.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] git-ssh-pull: commit-id consistency
Sven Verdoolaege [Mon, 27 Jun 2005 19:03:07 +0000 (21:03 +0200)]
[PATCH] git-ssh-pull: commit-id consistency

In contrast to other plumbing tools, git-ssh-push only
allow a very restrictive form of commit-id filenames.
This patch removes this restriction.

Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agogit-checkout-script: use "--verify --revs-only" to parse revs
Linus Torvalds [Mon, 27 Jun 2005 19:12:18 +0000 (12:12 -0700)]
git-checkout-script: use "--verify --revs-only" to parse revs

Sven Verdoolaege points out that I added the --verify option to
git-rev-parse exactly for things like this, but didn't update the
users.

19 years agoAdd a menu item for creating tags.
Paul Mackerras [Mon, 27 Jun 2005 12:56:40 +0000 (22:56 +1000)]
Add a menu item for creating tags.

19 years agoFix a bug where we would corrupt the stuff read from git-rev-list.
Paul Mackerras [Mon, 27 Jun 2005 10:04:26 +0000 (20:04 +1000)]
Fix a bug where we would corrupt the stuff read from git-rev-list.

If we have a very long commit message, and we end up getting a
bufferfull of data from git-rev-list that all belongs to one commit,
we ended up throwing away the data from a previous read that should
have been included.  The result was a error message about not being
able to parse the output of git-rev-list.

Also, if the git-rev-list output that we can't parse is long, only put
the first 80 chars in the error message.  Otherwise we end up with an
enormous error window.

19 years agoAdd a menu entry for generating a patch between any two commits.
Paul Mackerras [Mon, 27 Jun 2005 09:27:32 +0000 (19:27 +1000)]
Add a menu entry for generating a patch between any two commits.

19 years agocsum-file interface updates: return resulting SHA1
Linus Torvalds [Mon, 27 Jun 2005 05:01:46 +0000 (22:01 -0700)]
csum-file interface updates: return resulting SHA1

Also, make the writing of the SHA1 as a end-header be conditional: not
every user will necessarily want to write the SHA1 to the file itself,
even though current users do (but we migh end up using the same helper
functions for the object files themselves, that don't do this).

This also makes the packed index file contain the SHA1 of the packed
data file at the end (just before its own SHA1).  That way you can
validate the pairing of the two if you want to.

19 years agoFix behaviour in the case where we have no commits to display.
Paul Mackerras [Mon, 27 Jun 2005 03:38:29 +0000 (13:38 +1000)]
Fix behaviour in the case where we have no commits to display.

I had code in there to put "No commits selected" on the canvas
but it needed some globals.

19 years agogit-pack-objects: write the pack files with a SHA1 csum
Linus Torvalds [Mon, 27 Jun 2005 03:27:56 +0000 (20:27 -0700)]
git-pack-objects: write the pack files with a SHA1 csum

We want to be able to check their integrity later, and putting the
sha1-sum of the contents at the end is a good thing.  The writing
routines are generic, so we could try to re-use them for the index file,
instead of having the same logic duplicated.

Update unpack-objects to know about the extra 20 bytes at the end
of the index.

19 years agoAdd "--pretty=full" format that also shows committer.
Linus Torvalds [Mon, 27 Jun 2005 00:50:46 +0000 (17:50 -0700)]
Add "--pretty=full" format that also shows committer.

Also move the common implementation of parsing the --pretty argument
format into commit.c rather than having duplicates in diff-tree.c and
rev-list.c.

19 years agoAdd git-verify-tag script
Jan Harkes [Mon, 27 Jun 2005 00:38:47 +0000 (17:38 -0700)]
Add git-verify-tag script

Here is a script to simplify validating the gpg signature created by
git-tag-script. Might be useful to add to the git tree so that people
don't have to search for the right post in the git mailinglist archives

19 years agoCheck for the existence of the git directory on startup.
Paul Mackerras [Mon, 27 Jun 2005 00:37:11 +0000 (10:37 +1000)]
Check for the existence of the git directory on startup.

Check that $GIT_DIR (or .git, if GIT_DIR is not set) is a directory.
This means we can give a more informative error message if the user
runs gitk somewhere that isn't a git repository.

19 years agogit-pack-objects: use name information (if any) to sort objects for packing.
Linus Torvalds [Sun, 26 Jun 2005 22:27:28 +0000 (15:27 -0700)]
git-pack-objects: use name information (if any) to sort objects for packing.

This is incredibly cheezy. But it's cheap, and it works pretty well.

19 years agoOoh. Make git-rev-list --object associate a name with objects.
Linus Torvalds [Sun, 26 Jun 2005 22:26:05 +0000 (15:26 -0700)]
Ooh. Make git-rev-list --object associate a name with objects.

The name isn't unique, it's just the first name that object is reached
through, so it's really nothing more than a hint.

19 years agogit-pack-objects: do the delta search in reverse size order
Linus Torvalds [Sun, 26 Jun 2005 20:43:41 +0000 (13:43 -0700)]
git-pack-objects: do the delta search in reverse size order

Starting from big objects and going backwards means that we end up
picking a delta that goes from a bigger object to a smaller one.  That's
advantageous for two reasons: the bigger object is likely the newer one
(since things tend to grow, rather than shrink), and doing a delete
tends to be smaller than doing an add.

So the deltas don't tend to be top-of-tree, and the packed end result is
just slightly smaller.

19 years ago[PATCH] Add git-relink-script to fix up missing hardlinks
Ryan Anderson [Sun, 26 Jun 2005 18:15:16 +0000 (14:15 -0400)]
[PATCH] Add git-relink-script to fix up missing hardlinks

This will scan 2 or more object repositories and look for common objects, check
if they are hardlinked, and replace one with a hardlink to the other if not.

This version warns when skipping files because of size differences, and
handle more than 2 repositories automatically.

Signed-off-by: Ryan Anderson <ryan@michonline.com>
Cheered-on-by: Jeff Garzik <jgarzik@pobox.com>
Acked-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agogit-rev-parse: add "--not" flag to mark subsequent heads negative
Linus Torvalds [Sun, 26 Jun 2005 18:34:30 +0000 (11:34 -0700)]
git-rev-parse: add "--not" flag to mark subsequent heads negative

If you have two lists of heads, and you want to see ones reachable from
list $a but not from list $b, just do

git-rev-list $(git-rev-parse $a --not $b)

which is useful for both bisecting (where "b" would be the list of known
good revisions, and "a" would be the latest found bad head) and for just
seeing what the difference between two sets of heads are if you want to
generate a pack-file for the difference.

19 years agogit-unpack-objects: start removing debug output
Linus Torvalds [Sun, 26 Jun 2005 15:49:48 +0000 (08:49 -0700)]
git-unpack-objects: start removing debug output

At least the least interesting one.

19 years agoFix object packing/unpacking.
Linus Torvalds [Sun, 26 Jun 2005 15:40:08 +0000 (08:40 -0700)]
Fix object packing/unpacking.

This actually successfully packed and unpacked a git archive down to
1.3MB (17MB unpacked).

Right now unpacking is way too noisy, lots of debug messages left.

19 years ago[PATCH] Finish initial cut of git-pack-object/git-unpack-object pair.
Junio C Hamano [Sun, 26 Jun 2005 11:29:18 +0000 (04:29 -0700)]
[PATCH] Finish initial cut of git-pack-object/git-unpack-object pair.

This finishes the initial round of git-pack-object /
git-unpack-object pair.  They are now good enough to be used as
a transport medium:

 - Fix delta direction in pack-objects; the original was
   computing delta to create the base object from the object to
   be squashed, which was quite unfriendly for unpacker ;-).

 - Add a script to test the very basics.

 - Implement unpacker for both regular and deltified objects.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoAdd "--depth=N" parameter to git-pack-objects to limit maximum delta depth
Linus Torvalds [Sun, 26 Jun 2005 03:17:59 +0000 (20:17 -0700)]
Add "--depth=N" parameter to git-pack-objects to limit maximum delta depth

It too defaults to 10. A nice round random number.