Skip to content

Commit

Permalink
legit: don't shadow cl:push, add notification on git push
Browse files Browse the repository at this point in the history
  • Loading branch information
vindarel committed Nov 20, 2024
1 parent fdead4f commit 7c4d419
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 3 additions & 1 deletion extensions/legit/legit.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,9 @@ Currently Git-only. Concretely, this calls Git with the -w option.")
(define-command legit-push () ()
"Push changes to the current remote."
(with-current-project (vcs)
(run-function (lambda () (lem/porcelain:push vcs)))))
(run-function (lambda ()
(lem/porcelain:push-default vcs))
:message "Done")))

(define-command legit-rebase-interactive () ()
"Rebase interactively, from the commit the point is on.
Expand Down
4 changes: 1 addition & 3 deletions extensions/legit/porcelain-git.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
(:use :cl
;; let's import all the classes and methods defined in the main porcelain:
:lem/porcelain)
;; beware, we still shadow cl:push to have a "push" method:
(:shadow :push)
(:import-from :trivial-types
:proper-list)
(:export :git-project-p)
Expand Down Expand Up @@ -166,7 +164,7 @@ allows to learn about the file state: modified, deleted, ignored… "
;; xxx: recurse submodules, etc.
(run-git (list "pull")))

(defmethod push ((vcs vcs-git))
(defmethod push-default ((vcs vcs-git))
(run-git (list "push")))

(defmethod current-branch ((vcs vcs-git))
Expand Down
10 changes: 4 additions & 6 deletions extensions/legit/porcelain.lisp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

(uiop:define-package :lem/porcelain
(:use :cl)
;; beware, we shadow cl:push to have a "push" method:
(:shadow :push)
(:import-from :trivial-types
:proper-list)
(:export
Expand All @@ -19,7 +17,7 @@
:file-diff
:latest-commits
:pull
:push
:push-default
:rebase-abort
:rebase-continue
:rebase-interactively
Expand Down Expand Up @@ -237,10 +235,10 @@ M src/ext/porcelain.lisp
(:method (vcs)
(porcelain-error "lem/porcelain:pull not implemented for vcs ~a" (vcs-name vcs))))

(defgeneric push (vcs)
(:documentation "Pushes to remotes")
(defgeneric push-default (vcs)
(:documentation "Pushes to default remote.")
(:method (vcs)
(porcelain-error "lem/porcelain:push not implemented for vcs ~a" (vcs-name vcs))))
(porcelain-error "lem/porcelain:push-default not implemented for vcs ~a" (vcs-name vcs))))

;; Interactive rebase
(defgeneric rebase-interactively (vcs &key from)
Expand Down

0 comments on commit 7c4d419

Please sign in to comment.