mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-21 15:07:23 +00:00

This improves the naming for the rename related functionality moving it to be called `git_diff_find_similar()` and renaming all the associated constants, etc. to make more sense. I also moved the new code (plus the existing `git_diff_merge`) into a new file `diff_tform.c` where I can put new functions related to manipulating git diff lists. This also updates the implementation significantly from the last revision fixing some ordering issues (where break-rewrite needs to be handled prior to copy and rename detection) and improving config option handling.
58 lines
1.5 KiB
C
58 lines
1.5 KiB
C
/*
|
|
* Copyright (C) 2009-2012 the libgit2 contributors
|
|
*
|
|
* 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_h__
|
|
#define INCLUDE_diff_h__
|
|
|
|
#include "git2/diff.h"
|
|
#include "git2/oid.h"
|
|
|
|
#include <stdio.h>
|
|
#include "vector.h"
|
|
#include "buffer.h"
|
|
#include "iterator.h"
|
|
#include "repository.h"
|
|
#include "pool.h"
|
|
|
|
#define DIFF_OLD_PREFIX_DEFAULT "a/"
|
|
#define DIFF_NEW_PREFIX_DEFAULT "b/"
|
|
|
|
enum {
|
|
GIT_DIFFCAPS_HAS_SYMLINKS = (1 << 0), /* symlinks on platform? */
|
|
GIT_DIFFCAPS_ASSUME_UNCHANGED = (1 << 1), /* use stat? */
|
|
GIT_DIFFCAPS_TRUST_MODE_BITS = (1 << 2), /* use st_mode? */
|
|
GIT_DIFFCAPS_TRUST_CTIME = (1 << 3), /* use st_ctime? */
|
|
GIT_DIFFCAPS_USE_DEV = (1 << 4), /* use st_dev? */
|
|
};
|
|
|
|
#define GIT_DELTA__TO_DELETE 10
|
|
#define GIT_DELTA__TO_SPLIT 11
|
|
|
|
struct git_diff_list {
|
|
git_refcount rc;
|
|
git_repository *repo;
|
|
git_diff_options opts;
|
|
git_vector pathspec;
|
|
git_vector deltas; /* vector of git_diff_delta */
|
|
git_pool pool;
|
|
git_iterator_type_t old_src;
|
|
git_iterator_type_t new_src;
|
|
uint32_t diffcaps;
|
|
};
|
|
|
|
extern void git_diff__cleanup_modes(
|
|
uint32_t diffcaps, uint32_t *omode, uint32_t *nmode);
|
|
|
|
extern void git_diff_list_addref(git_diff_list *diff);
|
|
|
|
extern int git_diff_delta__cmp(const void *a, const void *b);
|
|
|
|
extern bool git_diff_delta__should_skip(
|
|
const git_diff_options *opts, const git_diff_delta *delta);
|
|
|
|
#endif
|
|
|