summaryrefslogtreecommitdiff
path: root/src/diff_output.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-06-10 10:10:39 -0700
committerRussell Belfer <rb@github.com>2013-06-10 10:10:39 -0700
commit114f5a6c41ea03393e00ae41126a6ddb0ef39a15 (patch)
treef579e849a72749123a54483180726396244177b2 /src/diff_output.h
parent7000f3fa7bad25ec07355d6afb640ea272201dff (diff)
downloadlibgit2-114f5a6c41ea03393e00ae41126a6ddb0ef39a15.tar.gz
Reorganize diff and add basic diff driver
This is a significant reorganization of the diff code to break it into a set of more clearly distinct files and to document the new organization. Hopefully this will make the diff code easier to understand and to extend. This adds a new `git_diff_driver` object that looks of diff driver information from the attributes and the config so that things like function content in diff headers can be provided. The full driver spec is not implemented in the commit - this is focused on the reorganization of the code and putting the driver hooks in place. This also removes a few #includes from src/repository.h that were overbroad, but as a result required extra #includes in a variety of places since including src/repository.h no longer results in pulling in the whole world.
Diffstat (limited to 'src/diff_output.h')
-rw-r--r--src/diff_output.h93
1 files changed, 0 insertions, 93 deletions
diff --git a/src/diff_output.h b/src/diff_output.h
deleted file mode 100644
index 083355676..000000000
--- a/src/diff_output.h
+++ /dev/null
@@ -1,93 +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_diff_output_h__
-#define INCLUDE_diff_output_h__
-
-#include "git2/blob.h"
-#include "diff.h"
-#include "map.h"
-#include "xdiff/xdiff.h"
-
-#define MAX_DIFF_FILESIZE 0x20000000
-
-enum {
- GIT_DIFF_PATCH_ALLOCATED = (1 << 0),
- GIT_DIFF_PATCH_PREPPED = (1 << 1),
- GIT_DIFF_PATCH_LOADED = (1 << 2),
- GIT_DIFF_PATCH_DIFFABLE = (1 << 3),
- GIT_DIFF_PATCH_DIFFED = (1 << 4),
-};
-
-/* context for performing diffs */
-typedef struct {
- git_repository *repo;
- git_diff_list *diff;
- const git_diff_options *opts;
- git_diff_file_cb file_cb;
- git_diff_hunk_cb hunk_cb;
- git_diff_data_cb data_cb;
- void *payload;
- int error;
- git_diff_range range;
- xdemitconf_t xdiff_config;
- xpparam_t xdiff_params;
-} diff_context;
-
-/* cached information about a single span in a diff */
-typedef struct diff_patch_line diff_patch_line;
-struct diff_patch_line {
- const char *ptr;
- size_t len;
- size_t lines, oldno, newno;
- char origin;
-};
-
-/* cached information about a hunk in a diff */
-typedef struct diff_patch_hunk diff_patch_hunk;
-struct diff_patch_hunk {
- git_diff_range range;
- char header[128];
- size_t header_len;
- size_t line_start;
- size_t line_count;
-};
-
-struct git_diff_patch {
- git_refcount rc;
- git_diff_list *diff; /* for refcount purposes, maybe NULL for blob diffs */
- git_diff_delta *delta;
- diff_context *ctxt; /* only valid while generating patch */
- git_iterator_type_t old_src;
- git_iterator_type_t new_src;
- git_blob *old_blob;
- git_blob *new_blob;
- git_map old_data;
- git_map new_data;
- uint32_t flags;
- diff_patch_hunk *hunks;
- size_t hunks_asize, hunks_size;
- diff_patch_line *lines;
- size_t lines_asize, lines_size;
- size_t oldno, newno;
-};
-
-/* context for performing diff on a single delta */
-typedef struct {
- git_diff_patch *patch;
- uint32_t prepped : 1;
- uint32_t loaded : 1;
- uint32_t diffable : 1;
- uint32_t diffed : 1;
-} diff_delta_context;
-
-extern int git_diff__paired_foreach(
- git_diff_list *idx2head,
- git_diff_list *wd2idx,
- int (*cb)(git_diff_delta *i2h, git_diff_delta *w2i, void *payload),
- void *payload);
-
-#endif