Skip to content

Commit 1e0f8c4

Browse files
Ramsay Jonesgitster
authored andcommitted
sparse: Fix an "symbol 'merge_file' not decared" warning
In order to fix the warning, we add a new "merge-file.h" header containing the extern declaration of the merge_file() function, and include the header in the source files that require the declaration. Signed-off-by: Ramsay Jones <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c8f1444 commit 1e0f8c4

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ LIB_H += list-objects.h
525525
LIB_H += ll-merge.h
526526
LIB_H += log-tree.h
527527
LIB_H += mailmap.h
528+
LIB_H += merge-file.h
528529
LIB_H += merge-recursive.h
529530
LIB_H += notes.h
530531
LIB_H += notes-cache.h

builtin/merge-tree.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "xdiff-interface.h"
44
#include "blob.h"
55
#include "exec_cmd.h"
6+
#include "merge-file.h"
67

78
static const char merge_tree_usage[] = "git merge-tree <base-tree> <branch1> <branch2>";
89
static int resolve_directories = 1;
@@ -54,8 +55,6 @@ static const char *explanation(struct merge_list *entry)
5455
return "removed in remote";
5556
}
5657

57-
extern void *merge_file(const char *, struct blob *, struct blob *, struct blob *, unsigned long *);
58-
5958
static void *result(struct merge_list *entry, unsigned long *size)
6059
{
6160
enum object_type type;

merge-file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "xdiff-interface.h"
44
#include "ll-merge.h"
55
#include "blob.h"
6+
#include "merge-file.h"
67

78
static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
89
{

merge-file.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifndef MERGE_FILE_H
2+
#define MERGE_FILE_H
3+
4+
extern void *merge_file(const char *path, struct blob *base, struct blob *our,
5+
struct blob *their, unsigned long *size);
6+
7+
#endif

0 commit comments

Comments
 (0)