diff options
Diffstat (limited to '')
-rw-r--r-- | emacs/custom/fcuny-git.el | 60 |
1 files changed, 7 insertions, 53 deletions
diff --git a/emacs/custom/fcuny-git.el b/emacs/custom/fcuny-git.el index 5a2f152..83a477d 100644 --- a/emacs/custom/fcuny-git.el +++ b/emacs/custom/fcuny-git.el @@ -1,5 +1,9 @@ +;;; fcuny-git --- configures git for emacs +;;; Commentary: +;;; Code: (require 'fcuny-defuns) (require 'fcuny-vars) +(require 'use-package) (use-package git-modes :ensure t @@ -17,7 +21,6 @@ :bind (("C-x g" . magit-status)) :custom (vc-follow-symlinks t) - :custom (magit-completing-read-function 'ivy-completing-read)) (use-package magit-repos @@ -38,62 +41,13 @@ (setq-local fill-column 72) (setq-local comment-auto-fill-only-comments nil))) -(use-package forge - :ensure t - :after (magit) - :custom - (forge-database-file (expand-file-name "forge-database-file.sqlite" fcuny/path-emacs-var)) - (auth-sources `(,(expand-file-name "authinfo.gpg" fcuny/path-emacs-etc))) - :config - (add-to-list 'forge-alist '("git.fcuny.net" "git.fcuny.net/api/v1" "git.fcuny.net" forge-gitea-repository))) - (use-package git-link :ensure t :after magit :bind (("C-c g l" . git-link) ("C-c g a" . git-link-commit)) - :config - (defun fcuny/get-sg-remote-from-hostname (hostname) - (format "sourcegraph.rbx.com/%s" hostname)) - - (defun fcuny/git-link-work-sourcegraph (hostname dirname filename _branch commit start end) - ;;; For a given repository, build the proper link for sourcegraph. - ;;; Use the default branch of the repository instead of the - ;;; current one (we might be on a feature branch that is not - ;;; available on the remote). - (require 'magit-branch) - (let ((sg-base-url (fcuny/get-sg-remote-from-hostname hostname)) - (main-branch (magit-main-branch))) - (git-link-sourcegraph sg-base-url dirname filename main-branch commit start end))) - - (defun fcuny/git-link-commit-work-sourcegraph (hostname dirname commit) - (let ((sg-base-url (fcuny/get-sg-remote-from-hostname hostname))) - (git-link-commit-sourcegraph sg-base-url dirname commit))) - - ;; for work related repositories, open them in our instance of sourcegraph - (add-to-list 'git-link-remote-alist '("github\\.rbx\\.com" fcuny/git-link-work-sourcegraph)) - (add-to-list 'git-link-commit-remote-alist '("github\\.rbx\\.com" fcuny/git-link-commit-work-sourcegraph)) - - ;; for personal code I use gitea, which is similar to codeberg - (add-to-list 'git-link-remote-alist '("git\\.fcuny\\.net" git-link-codeberg)) - (add-to-list 'git-link-commit-remote-alist '("git\\.fcuny\\.net" git-link-commit-codeberg)) - - (setq git-link-open-in-browser 't)) - -;; https://magit.vc/manual/magit/Per_002dRepository-Configuration.html -;; we don't want to refresh buffers in source. This should help with -;; performances. -(dir-locals-set-class-variables 'huge-git-repository - '((nil . ((magit-refresh-buffers . nil))))) - -(dir-locals-set-directory-class - "/Users/fcuny/workspace/source" 'huge-git-repository) - -(defun fcuny/clone-repo (url) - "Clone a repository in the workspace" - (interactive "sURL:") - (let* ((repo-name (magit-clone--url-to-name url)) - (target-dir (concat fcuny/path-workspace "/" repo-name))) - (magit-clone-regular url target-dir nil))) + :custom + (git-link-open-in-browser 't)) (provide 'fcuny-git) +;;; fcuny-git.el ends here |