Commit 9f57fd64 by Vicent Marti

Merge pull request #2594 from libgit2/vmg/hashsig

hashsig: Export as a `sys` header
parents 5451754d 737b5051
...@@ -4,10 +4,12 @@ ...@@ -4,10 +4,12 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with * This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file. * a Linking Exception. For full terms see the included COPYING file.
*/ */
#ifndef INCLUDE_hashsig_h__ #ifndef INCLUDE_sys_hashsig_h__
#define INCLUDE_hashsig_h__ #define INCLUDE_sys_hashsig_h__
#include "common.h" #include "git2/common.h"
GIT_BEGIN_DECL
/** /**
* Similarity signature of line hashes for a buffer * Similarity signature of line hashes for a buffer
...@@ -35,7 +37,7 @@ typedef enum { ...@@ -35,7 +37,7 @@ typedef enum {
* @param buflen The length of the data at `buf` * @param buflen The length of the data at `buf`
* @param generate_pairwise_hashes Should pairwise runs be hashed * @param generate_pairwise_hashes Should pairwise runs be hashed
*/ */
extern int git_hashsig_create( GIT_EXTERN(int) git_hashsig_create(
git_hashsig **out, git_hashsig **out,
const char *buf, const char *buf,
size_t buflen, size_t buflen,
...@@ -50,7 +52,7 @@ extern int git_hashsig_create( ...@@ -50,7 +52,7 @@ extern int git_hashsig_create(
* This will return an error if the file doesn't contain enough data to * This will return an error if the file doesn't contain enough data to
* compute a valid signature. * compute a valid signature.
*/ */
extern int git_hashsig_create_fromfile( GIT_EXTERN(int) git_hashsig_create_fromfile(
git_hashsig **out, git_hashsig **out,
const char *path, const char *path,
git_hashsig_option_t opts); git_hashsig_option_t opts);
...@@ -58,15 +60,17 @@ extern int git_hashsig_create_fromfile( ...@@ -58,15 +60,17 @@ extern int git_hashsig_create_fromfile(
/** /**
* Release memory for a content similarity signature * Release memory for a content similarity signature
*/ */
extern void git_hashsig_free(git_hashsig *sig); GIT_EXTERN(void) git_hashsig_free(git_hashsig *sig);
/** /**
* Measure similarity between two files * Measure similarity between two files
* *
* @return <0 for error, [0 to 100] as similarity score * @return <0 for error, [0 to 100] as similarity score
*/ */
extern int git_hashsig_compare( GIT_EXTERN(int) git_hashsig_compare(
const git_hashsig *a, const git_hashsig *a,
const git_hashsig *b); const git_hashsig *b);
GIT_END_DECL
#endif #endif
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
#include "git2/config.h" #include "git2/config.h"
#include "git2/blob.h" #include "git2/blob.h"
#include "git2/sys/hashsig.h"
#include "diff.h" #include "diff.h"
#include "hashsig.h"
#include "path.h" #include "path.h"
#include "fileops.h" #include "fileops.h"
#include "config.h" #include "config.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with * This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file. * a Linking Exception. For full terms see the included COPYING file.
*/ */
#include "hashsig.h" #include "git2/sys/hashsig.h"
#include "fileops.h" #include "fileops.h"
#include "util.h" #include "util.h"
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "tree.h" #include "tree.h"
#include "merge_file.h" #include "merge_file.h"
#include "blob.h" #include "blob.h"
#include "hashsig.h"
#include "oid.h" #include "oid.h"
#include "index.h" #include "index.h"
#include "filebuf.h" #include "filebuf.h"
...@@ -42,6 +41,7 @@ ...@@ -42,6 +41,7 @@
#include "git2/tree.h" #include "git2/tree.h"
#include "git2/oidarray.h" #include "git2/oidarray.h"
#include "git2/sys/index.h" #include "git2/sys/index.h"
#include "git2/sys/hashsig.h"
#define GIT_MERGE_INDEX_ENTRY_EXISTS(X) ((X).mode != 0) #define GIT_MERGE_INDEX_ENTRY_EXISTS(X) ((X).mode != 0)
#define GIT_MERGE_INDEX_ENTRY_ISFILE(X) S_ISREG((X).mode) #define GIT_MERGE_INDEX_ENTRY_ISFILE(X) S_ISREG((X).mode)
......
#include "clar_libgit2.h" #include "clar_libgit2.h"
#include "buffer.h" #include "buffer.h"
#include "buf_text.h" #include "buf_text.h"
#include "hashsig.h" #include "git2/sys/hashsig.h"
#include "fileops.h" #include "fileops.h"
#define TESTSTR "Have you seen that? Have you seeeen that??" #define TESTSTR "Have you seen that? Have you seeeen that??"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "merge.h" #include "merge.h"
#include "../merge_helpers.h" #include "../merge_helpers.h"
#include "diff.h" #include "diff.h"
#include "hashsig.h" #include "git2/sys/hashsig.h"
static git_repository *repo; static git_repository *repo;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment