aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2026-03-31 22:45:43 +0200
committerJonas Bernoulli <jonas@bernoul.li>2026-03-31 22:45:43 +0200
commit28878dd879aa2591b971a09848fdf800e92f3a2b (patch)
treeb671023d7b7152ac1c0005f8490938470811b789 /lisp
parent11a8538541efb02bf4ec875c9ff51f2da6ade820 (diff)
magit-gitignore-in-subdir: Pick up initial directory from current file
Diffstat (limited to 'lisp')
-rw-r--r--lisp/magit-gitignore.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/magit-gitignore.el b/lisp/magit-gitignore.el
index e685b82..8fd239b 100644
--- a/lisp/magit-gitignore.el
+++ b/lisp/magit-gitignore.el
@@ -66,7 +66,11 @@ tracked, they are shared with other clones of the repository.
Also stage the file."
:description "shared in subdirectory (path/to/.gitignore)"
(interactive (let ((dir (expand-file-name
- (read-directory-name "Limit rule to files in: "))))
+ (read-directory-name
+ "Limit rule to files in: "
+ (and$ (magit-current-file)
+ (file-name-directory
+ (expand-file-name $ (magit-toplevel))))))))
(list (magit-gitignore-read-pattern dir) dir)))
(magit--gitignore rule (expand-file-name ".gitignore" directory) t))