summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2014-10-01 12:03:24 +0200
committerVicent Marti <tanoku@gmail.com>2014-10-01 12:03:24 +0200
commit737b505116f263653ef4f0c80d888b1a87187a2b (patch)
tree9c3706135bd9d4d79b8aca5f067f595adf9e91e4 /src
parent5451754d4604daf88abb2069b061be402b3839a7 (diff)
downloadlibgit2-vmg/hashsig.tar.gz
hashsig: Export as a `sys` headervmg/hashsig
Diffstat (limited to 'src')
-rw-r--r--src/diff_tform.c2
-rw-r--r--src/hashsig.c2
-rw-r--r--src/hashsig.h72
-rw-r--r--src/merge.c2
4 files changed, 3 insertions, 75 deletions
diff --git a/src/diff_tform.c b/src/diff_tform.c
index 423a0ca33..9ebce06a0 100644
--- a/src/diff_tform.c
+++ b/src/diff_tform.c
@@ -8,9 +8,9 @@
#include "git2/config.h"
#include "git2/blob.h"
+#include "git2/sys/hashsig.h"
#include "diff.h"
-#include "hashsig.h"
#include "path.h"
#include "fileops.h"
#include "config.h"
diff --git a/src/hashsig.c b/src/hashsig.c
index 109f966ba..a6d5f2041 100644
--- a/src/hashsig.c
+++ b/src/hashsig.c
@@ -4,7 +4,7 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#include "hashsig.h"
+#include "git2/sys/hashsig.h"
#include "fileops.h"
#include "util.h"
diff --git a/src/hashsig.h b/src/hashsig.h
deleted file mode 100644
index 8c920cbf1..000000000
--- a/src/hashsig.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) the libgit2 contributors. All rights reserved.
- *
- * This file is part of libgit2, distributed under the GNU GPL v2 with
- * a Linking Exception. For full terms see the included COPYING file.
- */
-#ifndef INCLUDE_hashsig_h__
-#define INCLUDE_hashsig_h__
-
-#include "common.h"
-
-/**
- * Similarity signature of line hashes for a buffer
- */
-typedef struct git_hashsig git_hashsig;
-
-typedef enum {
- GIT_HASHSIG_NORMAL = 0, /* use all data */
- GIT_HASHSIG_IGNORE_WHITESPACE = 1, /* ignore whitespace */
- GIT_HASHSIG_SMART_WHITESPACE = 2, /* ignore \r and all space after \n */
-} git_hashsig_option_t;
-
-/**
- * Build a similarity signature for a buffer
- *
- * If you have passed a whitespace-ignoring buffer, then the whitespace
- * will be removed from the buffer while it is being processed, modifying
- * the buffer in place. Sorry about that!
- *
- * This will return an error if the buffer doesn't contain enough data to
- * compute a valid signature.
- *
- * @param out The array of hashed runs representing the file content
- * @param buf The contents of the file to hash
- * @param buflen The length of the data at `buf`
- * @param generate_pairwise_hashes Should pairwise runs be hashed
- */
-extern int git_hashsig_create(
- git_hashsig **out,
- const char *buf,
- size_t buflen,
- git_hashsig_option_t opts);
-
-/**
- * Build a similarity signature from a file
- *
- * This walks through the file, only loading a maximum of 4K of file data at
- * a time. Otherwise, it acts just like `git_hashsig_create`.
- *
- * This will return an error if the file doesn't contain enough data to
- * compute a valid signature.
- */
-extern int git_hashsig_create_fromfile(
- git_hashsig **out,
- const char *path,
- git_hashsig_option_t opts);
-
-/**
- * Release memory for a content similarity signature
- */
-extern void git_hashsig_free(git_hashsig *sig);
-
-/**
- * Measure similarity between two files
- *
- * @return <0 for error, [0 to 100] as similarity score
- */
-extern int git_hashsig_compare(
- const git_hashsig *a,
- const git_hashsig *b);
-
-#endif
diff --git a/src/merge.c b/src/merge.c
index ddeea8752..1e72520a4 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -22,7 +22,6 @@
#include "tree.h"
#include "merge_file.h"
#include "blob.h"
-#include "hashsig.h"
#include "oid.h"
#include "index.h"
#include "filebuf.h"
@@ -42,6 +41,7 @@
#include "git2/tree.h"
#include "git2/oidarray.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_ISFILE(X) S_ISREG((X).mode)