1
0
mirror of https://github.com/git/git.git synced 2024-09-30 21:51:32 +02:00
Commit Graph

11 Commits

Author SHA1 Message Date
Alexandre Julliard
ca8e2d86c4 pack-refs: Store the full name of the ref even when packing only tags.
Using for_each_tag_ref() to enumerate tags is wrong since it removes
the refs/tags/ prefix, we need to always use for_each_ref() and filter
out non-tag references in the callback.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-02 18:04:40 -08:00
Junio C Hamano
b3d4204fc4 git-pack-refs --all
This changes 'git-pack-refs' to pack only tags by default.
Branches are meant to be updated, either by committing onto it
yourself or tracking remote branches, and packed entries can
become stale easily, but tags are usually "create once and live
forever" and benefit more from packing.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-08 01:36:08 -07:00
Junio C Hamano
422b4a0e03 pack-refs: call fflush before fsync.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-04 21:37:15 -07:00
Junio C Hamano
03a182107f pack-refs: use lockfile as everybody else does.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-03 02:15:18 -07:00
Junio C Hamano
4431fcc4b1 Clean-up lock-ref implementation
This drops "mustexist" parameter lock_ref_sha1() and lock_any_ref_forupdate()
functions take.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 01:42:44 -07:00
Junio C Hamano
6d15987c1e pack-refs: fix git_path() usage.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-22 21:31:40 -07:00
Junio C Hamano
9688460152 git-pack-refs --prune
"git pack-refs --prune", after successfully packing the existing
refs, removes the loose ref files.  It tries to protect against
race by doing the usual lock_ref_sha1() which makes sure the
contents of the ref has not changed since we last looked at.

Also we do not bother trying to prune what was already packed, and
we do not try pruning symbolic refs.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-21 00:06:54 -07:00
Junio C Hamano
13e4aa90ac pack-refs: do not pack symbolic refs.
Now we can tell which one is symbolic and which one is not, it
is easy to do so.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-21 00:06:50 -07:00
Junio C Hamano
8da1977554 Tell between packed, unpacked and symbolic refs.
This adds a "int *flag" parameter to resolve_ref() and makes
for_each_ref() family to call callback function with an extra
"int flag" parameter.  They are used to give two bits of
information (REF_ISSYMREF and REF_ISPACKED) about the ref.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-20 22:02:01 -07:00
Junio C Hamano
cb5d709ff8 Add callback data to for_each_ref() family.
This is a long overdue fix to the API for for_each_ref() family
of functions.  It allows the callers to specify a callback data
pointer, so that the caller does not have to use static
variables to communicate with the callback funciton.

The updated for_each_ref() family takes a function of type

	int (*fn)(const char *, const unsigned char *, void *)

and a void pointer as parameters, and calls the function with
the name of the ref and its SHA-1 with the caller-supplied void
pointer as parameters.

The commit updates two callers, builtin-name-rev.c and
builtin-pack-refs.c as an example.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-20 21:47:42 -07:00
Linus Torvalds
e1e22e37f4 Start handling references internally as a sorted in-memory list
This also adds some very rudimentary support for the notion of packed
refs.  HOWEVER! At this point it isn't used to actually look up a ref
yet, only for listing them (ie "for_each_ref()" and friends see the
packed refs, but none of the other single-ref lookup routines).

Note how we keep two separate lists: one for the loose refs, and one for
the packed refs we read. That's so that we can easily keep the two apart,
and read only one set or the other (and still always make sure that the
loose refs take precedence).

[ From this, it's not actually obvious why we'd keep the two separate
  lists, but it's important to have the packed refs on their own list
  later on, when I add support for looking up a single loose one.

  For that case, we will want to read _just_ the packed refs in case the
  single-ref lookup fails, yet we may end up needing the other list at
  some point in the future, so keeping them separated is important ]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-17 19:09:11 -07:00