Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

installing merge drivers works with git worktrees (#67199)

bryan6c8e8aac1d17
diff --git a/bb.edn b/bb.edn
index 6a1dce33435..a8cc34f3dc9 100644
--- a/bb.edn
+++ b/bb.edn
@@ -274,31 +274,34 @@
;; - hidden from `./bin/mage` listing and `bb tasks`, these all - start with a `-`
-install-merge-drivers
- {:doc "Installs custom git merge drivers for YAML migration files."
- :requires [[clojure.string :as str]
- [mage.util :as u]]
- :task (task!
- (let [git-config-file (str u/project-root-directory "/.git/config")
- the-include (str "\n"
- "[include]\n"
- " path=../.gitconfig\n")]
- (when-not (str/includes? (slurp git-config-file) the-include)
- (spit git-config-file the-include :append true))))}
+ {:doc "Installs custom git merge drivers for YAML migration files."
+ :requires [[mage.util :as u]
+ [clojure.string :as str]]
+ :task (task!
+ (let [git-dir (u/sh "git rev-parse --git-dir")
+ git-config-file (str git-dir "/config")
+ the-include (str "\n"
+ "[include]\n"
+ " path=../.gitconfig\n")]
+ (when-not (str/includes? (slurp git-config-file) the-include)
+ (println "Merge driver not installed, installing now.")
+ (spit git-config-file the-include :append true))))}
;; opposite of -install-merge-drivers, removes the include while it's causing issues.
-uninstall-merge-drivers
- {:doc "Uninstalls custom git merge drivers for YAML migration files."
+ {:doc "Uninstalls custom git merge drivers for YAML migration files."
:requires [[clojure.string :as str]
[mage.util :as u]]
- :task (task!
- (let [git-config-file (str u/project-root-directory "/.git/config")
- the-include (str "\n"
- "[include]\n"
- " path=../.gitconfig\n")]
- (when (str/includes? (slurp git-config-file) the-include)
- (let [includeless (-> (slurp git-config-file)
- (str/replace the-include ""))]
- (spit git-config-file includeless)))))}
+ :task (task!
+ (let [git-dir (u/sh "git rev-parse --git-dir")
+ git-config-file (str git-dir "/config")
+ the-include (str "\n"
+ "[include]\n"
+ " path=../.gitconfig\n")]
+ (when (str/includes? (slurp git-config-file) the-include)
+ (println "Merge driver is installed, uninstalling now.")
+ (let [includeless (-> (slurp git-config-file) (str/replace the-include ""))]
+ (spit git-config-file includeless)))))}
-merge-yaml-migrations
{:doc "Custom git merge driver for YAML migration files."