* [RFC][PATCH 06/10] Sparse: fix "'add_head' not declared" warning
@ 2007-06-08 22:16 Ramsay Jones
0 siblings, 0 replies; only message in thread
From: Ramsay Jones @ 2007-06-08 22:16 UTC (permalink / raw)
To: Junio C Hamano; +Cc: GIT Mailing-list
This function was defined in builtin-diff.c and also used in
builtin-log.c. Since it has demonstrated its utility, move the
function definition to revision.c, which is a more logical place
for it, and add a declaration to revision.h.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
builtin-diff.c | 12 ------------
builtin-log.c | 3 ---
revision.c | 12 ++++++++++++
revision.h | 1 +
4 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/builtin-diff.c b/builtin-diff.c
index 7f367b6..e00a212 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -176,18 +176,6 @@ static int builtin_diff_combined(struct rev_info *revs,
return 0;
}
-void add_head(struct rev_info *revs)
-{
- unsigned char sha1[20];
- struct object *obj;
- if (get_sha1("HEAD", sha1))
- return;
- obj = parse_object(sha1);
- if (!obj)
- return;
- add_pending_object(revs, obj, "HEAD");
-}
-
int cmd_diff(int argc, const char **argv, const char *prefix)
{
int i;
diff --git a/builtin-log.c b/builtin-log.c
index 3744712..d40a0fc 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -17,9 +17,6 @@
static int default_show_root = 1;
-/* this is in builtin-diff.c */
-void add_head(struct rev_info *revs);
-
static void add_name_decoration(const char *prefix, const char *name, struct object *obj)
{
int plen = strlen(prefix);
diff --git a/revision.c b/revision.c
index 0125d41..1bfe80c 100644
--- a/revision.c
+++ b/revision.c
@@ -129,6 +129,18 @@ void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, con
(struct commit *)obj, name);
}
+void add_head(struct rev_info *revs)
+{
+ unsigned char sha1[20];
+ struct object *obj;
+ if (get_sha1("HEAD", sha1))
+ return;
+ obj = parse_object(sha1);
+ if (!obj)
+ return;
+ add_pending_object(revs, obj, "HEAD");
+}
+
static struct object *get_reference(struct rev_info *revs, const char *name, const unsigned char *sha1, unsigned int flags)
{
struct object *object;
diff --git a/revision.h b/revision.h
index 2845167..2fa6286 100644
--- a/revision.h
+++ b/revision.h
@@ -132,5 +132,6 @@ extern void add_object(struct object *obj,
extern void add_pending_object(struct rev_info *revs, struct object *obj, const char *name);
extern void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, const char *name, unsigned mode);
+extern void add_head(struct rev_info *revs);
#endif
--
1.5.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2007-06-09 3:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-08 22:16 [RFC][PATCH 06/10] Sparse: fix "'add_head' not declared" warning Ramsay Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox