Commit bbea37f99e3bf6c0028d2fefdefce52019af84d8 introduced borg-top-level-directory, which uses git rev-parse --show-toplevel. Unfortunately because I use a CI/CD process to build my Emacs init into an OS package instead of cloning my init source repo, I do not have .git dirs so the git rev-parse command errors. Could you add a fallback for this, please? It looks like you already have fallback logic in a few places such as for borg-drones-dir, so adding something similar to borg-top-level-directory should work:
https://github.com/emacscollective/borg/blob/6ea061f30065493e206132ff3f7a2d8febb859d0/borg.el#L78-L94
Personally I have no plans to use a monorepo layout so I would be fine if the fallback assumes borg-user-emacs-directory is at the top level of repo like the past behavior. Or maybe you could change borg-user-emacs-directory from defconst to defvar so that I could define it in my own init before loading borg. Your elisp skills are far superior to mine though, so I'm probably pointing out the obvious.
Here's the error with /usr/bin/emacs --debug-init:
caleb@arch-as-code-desktop> ls -l ~/.emacs.d
lrwxrwxrwx 1 caleb caleb 10 Dec 11 2020 /home/caleb/.emacs.d -> /etc/emacs
caleb@arch-as-code-desktop> cd /etc/emacs
caleb@arch-as-code-desktop> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git
[128] caleb@arch-as-code-desktop> ls -la
total 480
drwxr-xr-x 1 root root 228 Aug 11 19:02 .
drwxr-xr-x 1 root root 2944 Aug 11 19:02 ..
-rw-r--r-- 1 root root 296 Aug 11 19:02 authinfo.gpg
-rwxr-xr-x 1 root root 1318 Aug 11 19:02 do-borg.el
-rw-r--r-- 1 root root 977 Aug 11 19:02 early-init.el
-rw-r--r-- 1 root root 9710 Aug 11 19:02 .gitmodules
-rw-r--r-- 1 root root 106591 Aug 11 19:02 init.el
-rw-r--r-- 1 root root 336883 Aug 11 19:02 init.elc
-rw-r--r-- 1 root root 477 Aug 11 19:02 init-helm-tramp.el
drwxr-xr-x 1 root root 1628 Aug 5 17:03 lib
-rw-r--r-- 1 root root 1068 Aug 11 19:02 LICENSE
-rw-r--r-- 1 root root 85 Aug 11 19:02 Makefile
-rw-r--r-- 1 root root 839 Aug 11 19:02 README.md
drwxr-xr-x 1 root root 30 Dec 11 2020 snippets
caleb@arch-as-code-desktop> find . -type d -name '.git' | wc -l
0
I'm open to making a PR if that would help, just point me in the right direction towards what solution you would prefer.
For context, you might remember me from this magit issue with the same edge case - although with magit it was just a warning message, whereas in this case borg crashes so it's a bigger problem.
Commit bbea37f99e3bf6c0028d2fefdefce52019af84d8 introduced
borg-top-level-directory
, which usesgit rev-parse --show-toplevel
. Unfortunately because I use a CI/CD process to build my Emacs init into an OS package instead of cloning my init source repo, I do not have.git
dirs so thegit rev-parse
command errors. Could you add a fallback for this, please? It looks like you already have fallback logic in a few places such as forborg-drones-dir
, so adding something similar toborg-top-level-directory
should work: https://github.com/emacscollective/borg/blob/6ea061f30065493e206132ff3f7a2d8febb859d0/borg.el#L78-L94Personally I have no plans to use a monorepo layout so I would be fine if the fallback assumes
borg-user-emacs-directory
is at the top level of repo like the past behavior. Or maybe you could changeborg-user-emacs-directory
fromdefconst
todefvar
so that I could define it in my own init before loadingborg
. Your elisp skills are far superior to mine though, so I'm probably pointing out the obvious.Here's the error with
/usr/bin/emacs --debug-init
:To make it more obvious what's going on:
I'm open to making a PR if that would help, just point me in the right direction towards what solution you would prefer.
For context, you might remember me from this magit issue with the same edge case - although with magit it was just a warning message, whereas in this case borg crashes so it's a bigger problem.
Thanks!