[libgit2-glib] Added GgitDiffFindOptions



commit 6b363635a486fa84d8688fe1b36c624c6befab7f
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Thu Jun 26 16:33:21 2014 +0200

    Added GgitDiffFindOptions

 libgit2-glib/Makefile.am              |    2 +
 libgit2-glib/ggit-diff-find-options.c |  474 +++++++++++++++++++++++++++++++++
 libgit2-glib/ggit-diff-find-options.h |  106 ++++++++
 libgit2-glib/ggit-types.c             |   17 ++
 libgit2-glib/ggit-types.h             |   27 ++
 5 files changed, 626 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/Makefile.am b/libgit2-glib/Makefile.am
index d2a7090..bc13c14 100644
--- a/libgit2-glib/Makefile.am
+++ b/libgit2-glib/Makefile.am
@@ -34,6 +34,7 @@ INST_H_FILES =                                \
        ggit-diff.h                     \
        ggit-diff-delta.h               \
        ggit-diff-file.h                \
+       ggit-diff-find-options.h        \
        ggit-diff-hunk.h                \
        ggit-diff-line.h                \
        ggit-diff-options.h             \
@@ -95,6 +96,7 @@ C_FILES =                             \
        ggit-diff.c                     \
        ggit-diff-delta.c               \
        ggit-diff-file.c                \
+       ggit-diff-find-options.c        \
        ggit-diff-hunk.c                \
        ggit-diff-line.c                \
        ggit-diff-options.c             \
diff --git a/libgit2-glib/ggit-diff-find-options.c b/libgit2-glib/ggit-diff-find-options.c
new file mode 100644
index 0000000..67783c7
--- /dev/null
+++ b/libgit2-glib/ggit-diff-find-options.c
@@ -0,0 +1,474 @@
+/*
+ * ggit-diff-find-options.c
+ * This file is part of libgit2-glib
+ *
+ * Copyright (C) 2014 - Jesse van den Kieboom
+ *
+ * libgit2-glib is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * libgit2-glib is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libgit2-glib. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ggit-diff-find-options.h"
+#include "ggit-diff-similarity-metric.h"
+#include "ggit-enum-types.h"
+
+#define GGIT_DIFF_FIND_OPTIONS_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), 
GGIT_TYPE_DIFF_FIND_OPTIONS, GgitDiffFindOptionsPrivate))
+
+struct _GgitDiffFindOptionsPrivate
+{
+       git_diff_find_options diff_find_options;
+
+       GgitDiffSimilarityMetric *metric;
+};
+
+G_DEFINE_TYPE (GgitDiffFindOptions, ggit_diff_find_options, G_TYPE_OBJECT)
+
+enum
+{
+       PROP_0,
+       PROP_FLAGS,
+       PROP_RENAME_THRESHOLD,
+       PROP_RENAME_FROM_REWRITE_THRESHOLD,
+       PROP_COPY_THRESHOLD,
+       PROP_RENAME_LIMIT,
+       PROP_SIMILARITY_METRIC
+};
+
+static void
+ggit_diff_find_options_finalize (GObject *object)
+{
+       GgitDiffFindOptions *options;
+
+       options = GGIT_DIFF_FIND_OPTIONS (object);
+
+       if (options->priv->metric)
+       {
+               ggit_diff_similarity_metric_free (options->priv->metric);
+       }
+
+       G_OBJECT_CLASS (ggit_diff_find_options_parent_class)->finalize (object);
+}
+
+static void
+ggit_diff_find_options_set_property (GObject      *object,
+                                     guint         prop_id,
+                                     const GValue *value,
+                                     GParamSpec   *pspec)
+{
+       GgitDiffFindOptions *self = GGIT_DIFF_FIND_OPTIONS (object);
+
+       switch (prop_id)
+       {
+       case PROP_FLAGS:
+               self->priv->diff_find_options.flags =
+                       (GgitDiffFindFlags)g_value_get_flags (value);
+               break;
+       case PROP_RENAME_THRESHOLD:
+               self->priv->diff_find_options.rename_threshold =
+                       g_value_get_uint (value);
+               break;
+       case PROP_RENAME_FROM_REWRITE_THRESHOLD:
+               self->priv->diff_find_options.rename_from_rewrite_threshold =
+                       g_value_get_uint (value);
+               break;
+       case PROP_COPY_THRESHOLD:
+               self->priv->diff_find_options.copy_threshold =
+                       g_value_get_uint (value);
+               break;
+       case PROP_RENAME_LIMIT:
+               self->priv->diff_find_options.rename_limit =
+                       g_value_get_uint (value);
+               break;
+       case PROP_SIMILARITY_METRIC:
+               ggit_diff_find_options_set_metric (self,
+                                                  g_value_get_boxed (value));
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+ggit_diff_find_options_get_property (GObject    *object,
+                                     guint       prop_id,
+                                     GValue     *value,
+                                     GParamSpec *pspec)
+{
+       GgitDiffFindOptions *self = GGIT_DIFF_FIND_OPTIONS (object);
+
+       switch (prop_id)
+       {
+       case PROP_FLAGS:
+               g_value_set_flags (value, self->priv->diff_find_options.flags);
+               break;
+       case PROP_RENAME_THRESHOLD:
+               g_value_set_uint (value, self->priv->diff_find_options.rename_threshold);
+               break;
+       case PROP_RENAME_FROM_REWRITE_THRESHOLD:
+               g_value_set_uint (value, self->priv->diff_find_options.rename_from_rewrite_threshold);
+               break;
+       case PROP_COPY_THRESHOLD:
+               g_value_set_uint (value, self->priv->diff_find_options.copy_threshold);
+               break;
+       case PROP_RENAME_LIMIT:
+               g_value_set_uint (value, self->priv->diff_find_options.rename_limit);
+               break;
+       case PROP_SIMILARITY_METRIC:
+               g_value_set_boxed (value, self->priv->diff_find_options.metric);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+ggit_diff_find_options_class_init (GgitDiffFindOptionsClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+       object_class->finalize = ggit_diff_find_options_finalize;
+
+       object_class->get_property = ggit_diff_find_options_get_property;
+       object_class->set_property = ggit_diff_find_options_set_property;
+
+       g_type_class_add_private (object_class, sizeof (GgitDiffFindOptionsPrivate));
+
+       g_object_class_install_property (object_class,
+                                        PROP_FLAGS,
+                                        g_param_spec_flags ("flags",
+                                                            "Flags",
+                                                            "Flags",
+                                                            GGIT_TYPE_DIFF_FIND_FLAGS,
+                                                            0,
+                                                            G_PARAM_READWRITE |
+                                                            G_PARAM_STATIC_STRINGS));
+
+       g_object_class_install_property (object_class,
+                                        PROP_RENAME_THRESHOLD,
+                                        g_param_spec_uint ("rename-threshold",
+                                                           "Rename Threshold",
+                                                           "Rename threshold",
+                                                           0,
+                                                           G_MAXUINT,
+                                                           0,
+                                                           G_PARAM_READWRITE |
+                                                           G_PARAM_STATIC_STRINGS));
+
+       g_object_class_install_property (object_class,
+                                        PROP_RENAME_FROM_REWRITE_THRESHOLD,
+                                        g_param_spec_uint ("rename-from-rewrite-threshold",
+                                                           "Rename From Rewrite Threshold",
+                                                           "Rename from rewrite threshold",
+                                                           0,
+                                                           G_MAXUINT,
+                                                           0,
+                                                           G_PARAM_READWRITE |
+                                                           G_PARAM_STATIC_STRINGS));
+
+       g_object_class_install_property (object_class,
+                                        PROP_COPY_THRESHOLD,
+                                        g_param_spec_uint ("copy-threshold",
+                                                           "Copy Threshold",
+                                                           "Copy threshold",
+                                                           0,
+                                                           G_MAXUINT,
+                                                           0,
+                                                           G_PARAM_READWRITE |
+                                                           G_PARAM_STATIC_STRINGS));
+
+       g_object_class_install_property (object_class,
+                                        PROP_RENAME_LIMIT,
+                                        g_param_spec_uint ("rename-limit",
+                                                           "Rename Limit",
+                                                           "Rename limit",
+                                                           0,
+                                                           G_MAXUINT,
+                                                           0,
+                                                           G_PARAM_READWRITE |
+                                                           G_PARAM_STATIC_STRINGS));
+
+       g_object_class_install_property (object_class,
+                                        PROP_SIMILARITY_METRIC,
+                                        g_param_spec_boxed ("metric",
+                                                            "Metric",
+                                                            "Metric",
+                                                            GGIT_TYPE_DIFF_SIMILARITY_METRIC,
+                                                            G_PARAM_READWRITE |
+                                                            G_PARAM_STATIC_STRINGS));
+}
+
+static void
+ggit_diff_find_options_init (GgitDiffFindOptions *self)
+{
+       self->priv = GGIT_DIFF_FIND_OPTIONS_GET_PRIVATE (self);
+
+       git_diff_find_init_options (&self->priv->diff_find_options,
+                                   GIT_DIFF_FIND_OPTIONS_VERSION);
+
+}
+
+const git_diff_find_options *
+_ggit_diff_find_options_get_diff_find_options (GgitDiffFindOptions *diff_find_options)
+{
+       /* NULL is common for diff_find_options as it specifies to use the default
+        * so handle a NULL diff_find_options here instead of in every caller.
+        */
+       if (diff_find_options == NULL)
+       {
+               return NULL;
+       }
+
+       return (const git_diff_find_options *)&diff_find_options->priv->diff_find_options;
+}
+/**
+ * ggit_diff_find_options_new:
+ *
+ * Creates a new #GgitDiffFindOptions.
+ *
+ * Returns: a newly allocated #GgitDiffFindOptions.
+ */
+GgitDiffFindOptions *
+ggit_diff_find_options_new ()
+{
+       return g_object_new (GGIT_TYPE_DIFF_FIND_OPTIONS, NULL);
+}
+
+/**
+ * ggit_diff_find_options_get_flags:
+ * @options: a #GgitDiffFindOptions.
+ *
+ * Get the find options flags.
+ *
+ * Returns: the find options flags.
+ *
+ **/
+GgitDiffFindFlags
+ggit_diff_find_options_get_flags (GgitDiffFindOptions *options)
+{
+       g_return_val_if_fail (GGIT_IS_DIFF_FIND_OPTIONS (options), 0);
+
+       return (GgitDiffFindFlags)options->priv->diff_find_options.flags;
+}
+
+/**
+ * ggit_diff_find_options_set_flags:
+ * @options: a #GgitDiffFindOptions.
+ * @flags: a #GgitDiffFindFlags.
+ *
+ * Set the find options flags.
+ *
+ **/
+void
+ggit_diff_find_options_set_flags (GgitDiffFindOptions *options,
+                                  GgitDiffFindFlags    flags)
+{
+       g_return_if_fail (GGIT_IS_DIFF_FIND_OPTIONS (options));
+
+       options->priv->diff_find_options.flags = flags;
+       g_object_notify (G_OBJECT (options), "flags");
+}
+
+/**
+ * ggit_diff_find_options_get_rename_threshold:
+ * @options: a #GgitDiffFindOptions.
+ *
+ * Get the find options rename threshold.
+ *
+ * Returns: the rename threshold.
+ *
+ **/
+guint
+ggit_diff_find_options_get_rename_threshold (GgitDiffFindOptions *options)
+{
+       g_return_val_if_fail (GGIT_IS_DIFF_FIND_OPTIONS (options), 0);
+
+       return options->priv->diff_find_options.rename_threshold;
+}
+
+/**
+ * ggit_diff_find_options_set_rename_threshold:
+ * @options: a #GgitDiffFindOptions.
+ * @threshold: the threshold.
+ *
+ * Set the find options rename threshold.
+ *
+ **/
+void
+ggit_diff_find_options_set_rename_threshold (GgitDiffFindOptions *options,
+                                             guint                threshold)
+{
+       g_return_if_fail (GGIT_IS_DIFF_FIND_OPTIONS (options));
+
+       options->priv->diff_find_options.rename_threshold = threshold;
+       g_object_notify (G_OBJECT (options), "rename-threshold");
+}
+
+/**
+ * ggit_diff_find_options_get_rename_from_rewrite_threshold:
+ * @options: a #GgitDiffFindOptions.
+ *
+ * Get the find options rename from rewrite threshold.
+ *
+ * Returns: the rename from rewrite threshold.
+ *
+ **/
+guint
+ggit_diff_find_options_get_rename_from_rewrite_threshold (GgitDiffFindOptions *options)
+{
+       g_return_val_if_fail (GGIT_IS_DIFF_FIND_OPTIONS (options), 0);
+
+       return options->priv->diff_find_options.rename_from_rewrite_threshold;
+}
+
+/**
+ * ggit_diff_find_options_set_rename_from_rewrite_threshold:
+ * @options: a #GgitDiffFindOptions.
+ * @threshold: the threshold.
+ *
+ * Set the find options rename from rewrite threshold.
+ *
+ **/
+void
+ggit_diff_find_options_set_rename_from_rewrite_threshold (GgitDiffFindOptions *options,
+                                                          guint                threshold)
+{
+       g_return_if_fail (GGIT_IS_DIFF_FIND_OPTIONS (options));
+
+       options->priv->diff_find_options.rename_from_rewrite_threshold = threshold;
+       g_object_notify (G_OBJECT (options), "rename-from-rewrite-threshold");
+}
+
+/**
+ * ggit_diff_find_options_get_copy_threshold:
+ * @options: a #GgitDiffFindOptions.
+ *
+ * Get the find options copy threshold.
+ *
+ * Returns: the copy threshold.
+ *
+ **/
+guint
+ggit_diff_find_options_get_copy_threshold (GgitDiffFindOptions *options)
+{
+       g_return_val_if_fail (GGIT_IS_DIFF_FIND_OPTIONS (options), 0);
+
+       return options->priv->diff_find_options.copy_threshold;
+}
+
+/**
+ * ggit_diff_find_options_set_copy_threshold:
+ * @options: a #GgitDiffFindOptions.
+ * @threshold: the threshold.
+ *
+ * Set the find options copy threshold.
+ *
+ **/
+void
+ggit_diff_find_options_set_copy_threshold (GgitDiffFindOptions *options,
+                                           guint                threshold)
+{
+       g_return_if_fail (GGIT_IS_DIFF_FIND_OPTIONS (options));
+
+       options->priv->diff_find_options.copy_threshold = threshold;
+       g_object_notify (G_OBJECT (options), "copy-threshold");
+}
+
+/**
+ * ggit_diff_find_options_get_rename_limit:
+ * @options: a #GgitDiffFindOptions.
+ *
+ * Get the find options rename limit.
+ *
+ * Returns: the rename limit.
+ *
+ **/
+gsize
+ggit_diff_find_options_get_rename_limit (GgitDiffFindOptions *options)
+{
+       g_return_val_if_fail (GGIT_IS_DIFF_FIND_OPTIONS (options), 0);
+
+       return options->priv->diff_find_options.rename_limit;
+}
+
+/**
+ * ggit_diff_find_options_set_rename_limit:
+ * @options: a #GgitDiffFindOptions.
+ * @limit: the limit.
+ *
+ * Set the find options rename limit.
+ *
+ **/
+void
+ggit_diff_find_options_set_rename_limit (GgitDiffFindOptions *options,
+                                         gsize                limit)
+{
+       g_return_if_fail (GGIT_IS_DIFF_FIND_OPTIONS (options));
+
+       options->priv->diff_find_options.rename_limit = limit;
+       g_object_notify (G_OBJECT (options), "rename-limit");
+}
+
+/**
+ * ggit_diff_find_options_get_metric:
+ * @options: a #GgitDiffFindOptions.
+ *
+ * Get the find options metric.
+ *
+ * Returns: (transfer none): a #GgitDiffSimilarityMetric or %NULL.
+ *
+ **/
+GgitDiffSimilarityMetric *
+ggit_diff_find_options_get_metric (GgitDiffFindOptions *options)
+{
+       g_return_val_if_fail (GGIT_IS_DIFF_FIND_OPTIONS (options), 0);
+
+       return options->priv->metric;
+}
+
+/**
+ * ggit_diff_find_options_set_metric:
+ * @options: a #GgitDiffFindOptions.
+ * @metric: a #GgitDiffSimilarityMetric.
+ *
+ * Set the find options metric.
+ *
+ **/
+void
+ggit_diff_find_options_set_metric (GgitDiffFindOptions      *options,
+                                   GgitDiffSimilarityMetric *metric)
+{
+       g_return_if_fail (GGIT_IS_DIFF_FIND_OPTIONS (options));
+
+       if (options->priv->metric)
+       {
+               ggit_diff_similarity_metric_free (options->priv->metric);
+
+               options->priv->metric = NULL;
+               options->priv->diff_find_options.metric = NULL;
+       }
+
+       if (metric)
+       {
+               options->priv->metric =
+                       ggit_diff_similarity_metric_copy (metric);
+
+               options->priv->diff_find_options.metric =
+                       _ggit_diff_similarity_metric_get_similarity_metric (options->priv->metric);
+       }
+
+       g_object_notify (G_OBJECT (options), "metric");
+}
+
+/* ex:set ts=8 noet: */
diff --git a/libgit2-glib/ggit-diff-find-options.h b/libgit2-glib/ggit-diff-find-options.h
new file mode 100644
index 0000000..81d8812
--- /dev/null
+++ b/libgit2-glib/ggit-diff-find-options.h
@@ -0,0 +1,106 @@
+/*
+ * ggit-diff-find-options.h
+ * This file is part of libgit2-glib
+ *
+ * Copyright (C) 2014 - Jesse van den Kieboom
+ *
+ * libgit2-glib is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * libgit2-glib is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libgit2-glib. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GGIT_DIFF_FIND_OPTIONS_H__
+#define __GGIT_DIFF_FIND_OPTIONS_H__
+
+#include <glib-object.h>
+#include <git2.h>
+
+#include "ggit-types.h"
+
+G_BEGIN_DECLS
+
+#define GGIT_TYPE_DIFF_FIND_OPTIONS            (ggit_diff_find_options_get_type ())
+#define GGIT_DIFF_FIND_OPTIONS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GGIT_TYPE_DIFF_FIND_OPTIONS, GgitDiffFindOptions))
+#define GGIT_DIFF_FIND_OPTIONS_CONST(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GGIT_TYPE_DIFF_FIND_OPTIONS, GgitDiffFindOptions const))
+#define GGIT_DIFF_FIND_OPTIONS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), 
GGIT_TYPE_DIFF_FIND_OPTIONS, GgitDiffFindOptionsClass))
+#define GGIT_IS_DIFF_FIND_OPTIONS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GGIT_TYPE_DIFF_FIND_OPTIONS))
+#define GGIT_IS_DIFF_FIND_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GGIT_TYPE_DIFF_FIND_OPTIONS))
+#define GGIT_DIFF_FIND_OPTIONS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GGIT_TYPE_DIFF_FIND_OPTIONS, GgitDiffFindOptionsClass))
+
+typedef struct _GgitDiffFindOptionsClass       GgitDiffFindOptionsClass;
+typedef struct _GgitDiffFindOptionsPrivate     GgitDiffFindOptionsPrivate;
+
+struct _GgitDiffFindOptions
+{
+       GObject parent;
+
+       GgitDiffFindOptionsPrivate *priv;
+};
+
+struct _GgitDiffFindOptionsClass
+{
+       GObjectClass parent_class;
+};
+
+GType                ggit_diff_find_options_get_type  (void) G_GNUC_CONST;
+
+const git_diff_find_options *
+                     _ggit_diff_find_options_get_diff_find_options (
+                                                       GgitDiffFindOptions *options);
+
+GgitDiffFindOptions *ggit_diff_find_options_new       (void);
+
+GgitDiffFindFlags    ggit_diff_find_options_get_flags (GgitDiffFindOptions *options);
+void                 ggit_diff_find_options_set_flags (GgitDiffFindOptions *options,
+                                                       GgitDiffFindFlags    flags);
+
+guint                ggit_diff_find_options_get_rename_threshold (
+                                                       GgitDiffFindOptions *options);
+
+void                 ggit_diff_find_options_set_rename_threshold (
+                                                       GgitDiffFindOptions *options,
+                                                       guint                threshold);
+
+guint                ggit_diff_find_options_get_rename_from_rewrite_threshold (
+                                                       GgitDiffFindOptions *options);
+
+void                 ggit_diff_find_options_set_rename_from_rewrite_threshold (
+                                                       GgitDiffFindOptions *options,
+                                                       guint                threshold);
+
+guint                ggit_diff_find_options_get_copy_threshold (
+                                                       GgitDiffFindOptions *options);
+
+void                 ggit_diff_find_options_set_copy_threshold (
+                                                       GgitDiffFindOptions *options,
+                                                       guint                threshold);
+
+gsize                ggit_diff_find_options_get_rename_limit (
+                                                       GgitDiffFindOptions *options);
+
+void                 ggit_diff_find_options_set_rename_limit (
+                                                       GgitDiffFindOptions *options,
+                                                       gsize                limit);
+
+GgitDiffSimilarityMetric *
+                     ggit_diff_find_options_get_metric (
+                                                       GgitDiffFindOptions *options);
+
+void                 ggit_diff_find_options_set_metric (
+                                                       GgitDiffFindOptions *options,
+                                                       GgitDiffSimilarityMetric *metric);
+
+G_END_DECLS
+
+#endif /* __GGIT_DIFF_FIND_OPTIONS_H__ */
+
+/* ex:set ts=8 noet: */
diff --git a/libgit2-glib/ggit-types.c b/libgit2-glib/ggit-types.c
index e235892..9fd31f5 100644
--- a/libgit2-glib/ggit-types.c
+++ b/libgit2-glib/ggit-types.c
@@ -245,4 +245,21 @@ ASSERT_ENUM (GGIT_CHECKOUT_NOTIFY_UNTRACKED, GIT_CHECKOUT_NOTIFY_UNTRACKED);
 ASSERT_ENUM (GGIT_CHECKOUT_NOTIFY_IGNORED,   GIT_CHECKOUT_NOTIFY_IGNORED);
 ASSERT_ENUM (GGIT_CHECKOUT_NOTIFY_ALL,       GIT_CHECKOUT_NOTIFY_ALL);
 
+ASSERT_ENUM (GGIT_DIFF_FIND_BY_CONFIG,                  GIT_DIFF_FIND_BY_CONFIG);
+ASSERT_ENUM (GGIT_DIFF_FIND_RENAMES,                    GIT_DIFF_FIND_RENAMES);
+ASSERT_ENUM (GGIT_DIFF_FIND_RENAMES_FROM_REWRITES,      GIT_DIFF_FIND_RENAMES_FROM_REWRITES);
+ASSERT_ENUM (GGIT_DIFF_FIND_COPIES,                     GIT_DIFF_FIND_COPIES);
+ASSERT_ENUM (GGIT_DIFF_FIND_COPIES_FROM_UNMODIFIED,     GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED);
+ASSERT_ENUM (GGIT_DIFF_FIND_REWRITES,                   GIT_DIFF_FIND_REWRITES);
+ASSERT_ENUM (GGIT_DIFF_BREAK_REWRITES,                  GIT_DIFF_BREAK_REWRITES);
+ASSERT_ENUM (GGIT_DIFF_FIND_AND_BREAK_REWRITES,         GIT_DIFF_FIND_AND_BREAK_REWRITES);
+ASSERT_ENUM (GGIT_DIFF_FIND_FOR_UNTRACKED,              GIT_DIFF_FIND_FOR_UNTRACKED);
+ASSERT_ENUM (GGIT_DIFF_FIND_ALL,                        GIT_DIFF_FIND_ALL);
+ASSERT_ENUM (GGIT_DIFF_FIND_IGNORE_LEADING_WHITESPACE,  GIT_DIFF_FIND_IGNORE_LEADING_WHITESPACE);
+ASSERT_ENUM (GGIT_DIFF_FIND_IGNORE_WHITESPACE,          GIT_DIFF_FIND_IGNORE_WHITESPACE);
+ASSERT_ENUM (GGIT_DIFF_FIND_DONT_IGNORE_WHITESPACE,     GIT_DIFF_FIND_DONT_IGNORE_WHITESPACE);
+ASSERT_ENUM (GGIT_DIFF_FIND_EXACT_MATCH_ONLY,           GIT_DIFF_FIND_EXACT_MATCH_ONLY);
+ASSERT_ENUM (GGIT_DIFF_BREAK_REWRITES_FOR_RENAMES_ONLY, GIT_DIFF_BREAK_REWRITES_FOR_RENAMES_ONLY);
+ASSERT_ENUM (GGIT_DIFF_FIND_REMOVE_UNMODIFIED,          GIT_DIFF_FIND_REMOVE_UNMODIFIED);
+
 /* ex:set ts=8 noet: */
diff --git a/libgit2-glib/ggit-types.h b/libgit2-glib/ggit-types.h
index 8f2f39d..770b846 100644
--- a/libgit2-glib/ggit-types.h
+++ b/libgit2-glib/ggit-types.h
@@ -145,6 +145,13 @@ typedef struct _GgitDiffDelta GgitDiffDelta;
 typedef struct _GgitDiffFile GgitDiffFile;
 
 /**
+ * GgitDiffFindOptions:
+ *
+ * Represents options for finding diff similarity.
+ */
+typedef struct _GgitDiffFindOptions GgitDiffFindOptions;
+
+/**
  * GgitDiffHunk:
  *
  * Represents the hunk of a diff.
@@ -1023,6 +1030,26 @@ typedef enum {
        GGIT_CHECKOUT_NOTIFY_ALL       = 0x0FFFFu
 } GgitCheckoutNotifyFlags;
 
+typedef enum {
+       GGIT_DIFF_FIND_BY_CONFIG                  = 0,
+       GGIT_DIFF_FIND_RENAMES                    = (1u << 0),
+       GGIT_DIFF_FIND_RENAMES_FROM_REWRITES      = (1u << 1),
+       GGIT_DIFF_FIND_COPIES                     = (1u << 2),
+       GGIT_DIFF_FIND_COPIES_FROM_UNMODIFIED     = (1u << 3),
+       GGIT_DIFF_FIND_REWRITES                   = (1u << 4),
+       GGIT_DIFF_BREAK_REWRITES                  = (1u << 5),
+       GGIT_DIFF_FIND_AND_BREAK_REWRITES         = (GGIT_DIFF_FIND_REWRITES |
+                                                    GGIT_DIFF_BREAK_REWRITES),
+       GGIT_DIFF_FIND_FOR_UNTRACKED              = (1u << 6),
+       GGIT_DIFF_FIND_ALL                        = (0x0ff),
+       GGIT_DIFF_FIND_IGNORE_LEADING_WHITESPACE  = 0,
+       GGIT_DIFF_FIND_IGNORE_WHITESPACE          = (1u << 12),
+       GGIT_DIFF_FIND_DONT_IGNORE_WHITESPACE     = (1u << 13),
+       GGIT_DIFF_FIND_EXACT_MATCH_ONLY           = (1u << 14),
+       GGIT_DIFF_BREAK_REWRITES_FOR_RENAMES_ONLY = (1u << 15),
+       GGIT_DIFF_FIND_REMOVE_UNMODIFIED          = (1u << 16),
+} GgitDiffFindFlags;
+
 /**
  * GgitConfigCallback:
  * @entry: a #GgitConfigEntry.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]