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-12 03:37:32 +04:00
|
|
|
#include "cache.h"
|
2007-10-16 01:06:02 +04:00
|
|
|
#include "parse-options.h"
|
2008-06-15 18:05:06 +04:00
|
|
|
#include "pack-refs.h"
|
2006-09-21 11:06:06 +04:00
|
|
|
|
2007-10-16 01:06:02 +04:00
|
|
|
static char const * const pack_refs_usage[] = {
|
2008-07-13 17:36:15 +04:00
|
|
|
"git pack-refs [options]",
|
2007-10-16 01:06:02 +04:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2007-05-26 20:25:31 +04:00
|
|
|
int cmd_pack_refs(int argc, const char **argv, const char *prefix)
|
|
|
|
{
|
2007-11-07 13:20:30 +03:00
|
|
|
unsigned int flags = PACK_REFS_PRUNE;
|
2007-10-16 01:06:02 +04:00
|
|
|
struct option opts[] = {
|
2007-11-07 13:20:30 +03:00
|
|
|
OPT_BIT(0, "all", &flags, "pack everything", PACK_REFS_ALL),
|
|
|
|
OPT_BIT(0, "prune", &flags, "prune loose refs (default)", PACK_REFS_PRUNE),
|
2007-10-16 01:06:02 +04:00
|
|
|
OPT_END(),
|
|
|
|
};
|
2009-05-23 22:53:12 +04:00
|
|
|
if (parse_options(argc, argv, prefix, opts, pack_refs_usage, 0))
|
2007-10-16 01:06:02 +04:00
|
|
|
usage_with_options(pack_refs_usage, opts);
|
2007-05-26 20:25:31 +04:00
|
|
|
return pack_refs(flags);
|
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-12 03:37:32 +04:00
|
|
|
}
|