<commit_before>(ns github-changelog.git
  (:require
   [clojure.string :as string]
   [clj-jgit.porcelain :as git]
   [clj-jgit.util :refer [name-from-uri]])
  (:import (java.io FileNotFoundException)
           (org.eclipse.jgit.api Git)
           (org.eclipse.jgit.lib Repository Ref)
           (org.eclipse.jgit.revwalk RevCommit)))

(def git-path name-from-uri)

(defn- clone-or-load [uri dir]
  (try
    (git/load-repo dir)
    (catch FileNotFoundException _
      (git/git-clone uri dir))))

(defn clone [uri dir]
  (let [path (or dir (git-path uri))
        repo (clone-or-load uri path)]
    (git/git-fetch-all repo)
    repo))

(defn- get-merge-sha [^Repository repo ^Ref tag]<commit_msg>Extract repository update to a function<commit_after>(ns github-changelog.git
  (:require
   [clojure.string :as string]
   [clj-jgit.porcelain :as git]
   [clj-jgit.util :refer [name-from-uri]])
  (:import (java.io FileNotFoundException)
           (org.eclipse.jgit.api Git)
           (org.eclipse.jgit.lib Repository Ref)
           (org.eclipse.jgit.revwalk RevCommit)))

(def git-path name-from-uri)

(defn- clone-or-load [uri dir]
  (try
    (git/load-repo dir)
    (catch FileNotFoundException _
      (git/git-clone uri dir))))

(defn- refresh [^Repository repo]
  (git/git-fetch-all repo)
  repo)

(defn clone [uri dir]
  (->> (or dir (git-path uri))
       (clone-or-load uri)
       refresh))

(defn- get-merge-sha [^Repository repo ^Ref tag]
{'fraction_non_alphanumeric': 0.14659325533379217, 'fraction_numerical': 0.0, 'mean_word_length': 2.856763925729443, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '2461998', 'n_tokens_mistral': 534, 'n_tokens_neox': 531, 'n_words': 125}