Fix sparse warnings
Fix warnings from 'make check'.
- These files don't include 'builtin.h' causing sparse to complain that
cmd_* isn't declared:
builtin/clone.c:364, builtin/fetch-pack.c:797,
builtin/fmt-merge-msg.c:34, builtin/hash-object.c:78,
builtin/merge-index.c:69, builtin/merge-recursive.c:22
builtin/merge-tree.c:341, builtin/mktag.c:156, builtin/notes.c:426
builtin/notes.c:822, builtin/pack-redundant.c:596,
builtin/pack-refs.c:10, builtin/patch-id.c:60, builtin/patch-id.c:149,
builtin/remote.c:1512, builtin/remote-ext.c:240,
builtin/remote-fd.c:53, builtin/reset.c:236, builtin/send-pack.c:384,
builtin/unpack-file.c:25, builtin/var.c:75
- These files have symbols which should be marked static since they're
only file scope:
submodule.c:12, diff.c:631, replace_object.c:92, submodule.c:13,
submodule.c:14, trace.c:78, transport.c:195, transport-helper.c:79,
unpack-trees.c:19, url.c:3, url.c:18, url.c:104, url.c:117, url.c:123,
url.c:129, url.c:136, thread-utils.c:21, thread-utils.c:48
- These files redeclare symbols to be different types:
builtin/index-pack.c:210, parse-options.c:564, parse-options.c:571,
usage.c:49, usage.c:58, usage.c:63, usage.c:72
- These files use a literal integer 0 when they really should use a NULL
pointer:
daemon.c:663, fast-import.c:2942, imap-send.c:1072, notes-merge.c:362
While we're in the area, clean up some unused #includes in builtin files
(mostly exec_cmd.h).
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-22 15:51:05 +08:00
|
|
|
#include "builtin.h"
|
2007-10-16 05:06:02 +08:00
|
|
|
#include "parse-options.h"
|
2013-04-23 03:52:32 +08:00
|
|
|
#include "refs.h"
|
2006-09-21 15:06:06 +08:00
|
|
|
|
2007-10-16 05:06:02 +08:00
|
|
|
static char const * const pack_refs_usage[] = {
|
2015-01-13 15:44:47 +08:00
|
|
|
N_("git pack-refs [<options>]"),
|
2007-10-16 05:06:02 +08:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2007-05-27 00:25:31 +08:00
|
|
|
int cmd_pack_refs(int argc, const char **argv, const char *prefix)
|
|
|
|
{
|
2007-11-07 18:20:30 +08:00
|
|
|
unsigned int flags = PACK_REFS_PRUNE;
|
2007-10-16 05:06:02 +08:00
|
|
|
struct option opts[] = {
|
2012-08-20 20:32:30 +08:00
|
|
|
OPT_BIT(0, "all", &flags, N_("pack everything"), PACK_REFS_ALL),
|
|
|
|
OPT_BIT(0, "prune", &flags, N_("prune loose refs (default)"), PACK_REFS_PRUNE),
|
2007-10-16 05:06:02 +08:00
|
|
|
OPT_END(),
|
|
|
|
};
|
2009-05-24 02:53:12 +08:00
|
|
|
if (parse_options(argc, argv, prefix, opts, pack_refs_usage, 0))
|
2007-10-16 05:06:02 +08:00
|
|
|
usage_with_options(pack_refs_usage, opts);
|
2007-05-27 00:25:31 +08: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 07:37:32 +08:00
|
|
|
}
|