aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustav Hållberg <gustav@gmail.com>2012-04-10 09:27:40 +0200
committerGustav Hållberg <gustav@gmail.com>2012-04-10 09:27:40 +0200
commit4d2357db5d92bbf0370f391f3693899da0c9ed1d (patch)
tree1c0ca6f2ec74f3083a4c875ee1d7aa33dbac60c2
parent55deb9290c6bbf8121667028912668d4d3a4570a (diff)
downloadstgit-4d2357db5d92bbf0370f391f3693899da0c9ed1d.tar.gz
stgit.el: Make stgit-commit commit at most as many patches as are available
Signed-off-by: Gustav Hållberg <gustav@gmail.com>
-rw-r--r--contrib/stgit.el7
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/stgit.el b/contrib/stgit.el
index e3ffcb4..e25d433 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -2050,20 +2050,21 @@ what git-config branch.<branch>.stgit.parentbranch is set to."
(stgit-reload))
(defun stgit-commit (count)
- "Run stg commit on COUNT commits.
+ "Run stg commit on (at most) COUNT commits.
Interactively, the prefix argument is used as COUNT.
-A negative COUNT will uncommit instead."
+A negative COUNT will uncommit using `stgit-uncommit' instead."
(interactive "p")
(stgit-assert-mode)
(if (< count 0)
(stgit-uncommit (- count))
+ (setq count (min count (length (stgit-applied-patches t))))
(stgit-capture-output nil (stgit-run "commit" "-n" count))
(stgit-reload)))
(defun stgit-uncommit (count)
"Run stg uncommit on COUNT commits.
Interactively, the prefix argument is used as COUNT.
-A negative COUNT will commit instead."
+A negative COUNT will commit using `stgit-commit' instead."
(interactive "p")
(stgit-assert-mode)
(if (< count 0)