<commit_before>{
  kdeDerivation, kdeWrapper, lib, fetchgit,
  extra-cmake-modules, kdoctools, kconfig, kinit, kparts
}:

let
  rev = "468652ce70b1214842cef0a021c81d056ec6aa01";

  unwrapped = kdeDerivation rec {
    name = "kdiff3-${version}";
    version = "1.7.0-${lib.strings.substring 0 7 rev}";

    src = fetchgit {
      url = "https://gitlab.com/tfischer/kdiff3";
      sha256 = "126xl7jbb26v2970ba1rw1d6clhd14p1f2avcwvj8wzqmniq5y5m";
      inherit rev;
    };

    setSourceRoot = ''sourceRoot="$(echo */kdiff3/)"'';

    postPatch = ''
      sed -re "s/(p\\[[^]]+] *== *)('([^']|\\\\')+')/\\1QChar(\\2)/g" -i src/diff.cpp
    '';

    nativeBuildInputs = [ extra-cmake-modules kdoctools ];

    propagatedBuildInputs = [ kconfig kinit kparts ];

    meta = with lib; {
      homepage = http://kdiff3.sourceforge.net/;
      license = licenses.gpl2Plus;
      description = "Compares and merges 2 or 3 files or directories";
      maintainers = with maintainers; [ <NAME> ];
      platforms = with platforms; linux;
    };
  };

in kdeWrapper {
  inherit unwrapped;
  targets = [ "bin/kdiff3" ];
}<commit_msg>kdiff3: fix with git mergetool<commit_after>{
  kdeDerivation, kdeWrapper, lib, fetchgit, fetchpatch,
  extra-cmake-modules, kdoctools, kconfig, kinit, kparts
}:

let
  rev = "468652ce70b1214842cef0a021c81d056ec6aa01";

  unwrapped = kdeDerivation rec {
    name = "kdiff3-${version}";
    version = "1.7.0-${lib.strings.substring 0 7 rev}";

    src = fetchgit {
      url = "https://gitlab.com/tfischer/kdiff3";
      sha256 = "126xl7jbb26v2970ba1rw1d6clhd14p1f2avcwvj8wzqmniq5y5m";
      inherit rev;
    };

    setSourceRoot = ''sourceRoot="$(echo */kdiff3/)"'';

    patches = [
      (fetchpatch {
        name = "git-mergetool.diff"; # see https://gitlab.com/tfischer/kdiff3/merge_requests/2
        url = "https://gitlab.com/vcunat/kdiff3/commit/6106126216.patch";
        sha256 = "16xqc24y8bg8gzkdbwapiwi68rzqnkpz4hgn586mi01ngig2fd7y";
      })
    ];
    patchFlags = "-p 2";

    postPatch = ''
      sed -re "s/(p\\[[^]]+] *== *)('([^']|\\\\')+')/\\1QChar(\\2)/g" -i src/diff.cpp
    '';

    nativeBuildInputs = [ extra-cmake-modules kdoctools ];

    propagatedBuildInputs = [ kconfig kinit kparts ];

    enableParallelBuilding = true;

    meta = with lib; {
      homepage = http://kdiff3.sourceforge.net/;
      license = licenses.gpl2Plus;
      description = "Compares and merges 2 or 3 files or directories";
      maintainers = with maintainers; [ <NAME> ];
      platforms = with platforms; linux;
    };
  };

in kdeWrapper {
  inherit unwrapped;
  targets = [ "bin/kdiff3" ];
}
{'fraction_non_alphanumeric': 0.15669081204727411, 'fraction_numerical': 0.06252382767823103, 'mean_word_length': 2.9757575757575756, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3609927', 'n_tokens_mistral': 1095, 'n_tokens_neox': 992, 'n_words': 178}