Skip to content

Commit ad6f348

Browse files
committed
[Emacs] autocommit id nested folders bug
1 parent 180eb6f commit ad6f348

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.emacs.rc/autocommit-rc.el

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,16 @@
55
(defvar rc/autocommit-local-locks
66
(make-hash-table :test 'equal))
77

8+
(defun rc/file-truename-nilable (filename)
9+
(when filename
10+
(file-truename filename)))
11+
812
(defun rc/autocommit--id ()
9-
(let ((id (file-truename default-directory)))
13+
(let ((id (-> default-directory
14+
(locate-dominating-file ".git")
15+
(rc/file-truename-nilable))))
16+
(when (not id)
17+
(error "%s is not inside of a git repository" default-directory))
1018
(unless (gethash id rc/autocommit-local-locks)
1119
(puthash id nil rc/autocommit-local-locks))
1220
id))

0 commit comments

Comments
 (0)