THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.0KB

  1. #ifndef XDIFF_INTERFACE_H
  2. #define XDIFF_INTERFACE_H
  3. #include "cache.h"
  4. #include "xdiff/xdiff.h"
  5. /*
  6. * xdiff isn't equipped to handle content over a gigabyte;
  7. * we make the cutoff 1GB - 1MB to give some breathing
  8. * room for constant-sized additions (e.g., merge markers)
  9. */
  10. #define MAX_XDIFF_SIZE (1024UL * 1024 * 1023)
  11. typedef void (*xdiff_emit_line_fn)(void *, char *, unsigned long);
  12. typedef void (*xdiff_emit_hunk_fn)(void *data,
  13. long old_begin, long old_nr,
  14. long new_begin, long new_nr,
  15. const char *func, long funclen);
  16. int xdi_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp, xdemitconf_t const *xecfg, xdemitcb_t *ecb);
  17. int xdi_diff_outf(mmfile_t *mf1, mmfile_t *mf2,
  18. xdiff_emit_hunk_fn hunk_fn,
  19. xdiff_emit_line_fn line_fn,
  20. void *consume_callback_data,
  21. xpparam_t const *xpp, xdemitconf_t const *xecfg);
  22. int read_mmfile(mmfile_t *ptr, const char *filename);
  23. void read_mmblob(mmfile_t *ptr, const struct object_id *oid);
  24. int buffer_is_binary(const char *ptr, unsigned long size);
  25. void xdiff_set_find_func(xdemitconf_t *xecfg, const char *line, int cflags);
  26. void xdiff_clear_find_func(xdemitconf_t *xecfg);
  27. int git_xmerge_config(const char *var, const char *value, void *cb);
  28. extern int git_xmerge_style;
  29. /*
  30. * Can be used as a no-op hunk_fn for xdi_diff_outf(), since a NULL
  31. * one just sends the hunk line to the line_fn callback).
  32. */
  33. void discard_hunk_line(void *priv,
  34. long ob, long on, long nb, long nn,
  35. const char *func, long funclen);
  36. /*
  37. * Compare the strings l1 with l2 which are of size s1 and s2 respectively.
  38. * Returns 1 if the strings are deemed equal, 0 otherwise.
  39. * The `flags` given as XDF_WHITESPACE_FLAGS determine how white spaces
  40. * are treated for the comparision.
  41. */
  42. int xdiff_compare_lines(const char *l1, long s1,
  43. const char *l2, long s2, long flags);
  44. /*
  45. * Returns a hash of the string s of length len.
  46. * The `flags` given as XDF_WHITESPACE_FLAGS determine how white spaces
  47. * are treated for the hash.
  48. */
  49. unsigned long xdiff_hash_string(const char *s, size_t len, long flags);
  50. #endif