...
 
Commits (160)
......@@ -3,7 +3,9 @@ Alex Ott <alexott@gmail.com> <ott@flash.lan>
Andriy Kmit' <dev@madand.net>
Bar Magal <bmagamb@gmail.com>
Bradley Wright <brad@intranation.com> <bradley.wright@digital.cabinet-office.gov.uk>
Buster Copley <buster@buster.me.uk>
Chillar Anand <anand21nanda@gmail.com>
Christophe Junke <junke.christophe@gmail.com> <christophe.junke@parrot.com>
Damien Cassou <damien@cassou.me> <damien.cassou@gmail.com>
David Abrahams <dave@boostpro.com>
Dean Kariniemi <8913263+d3k4r@users.noreply.github.com>
......@@ -16,14 +18,15 @@ Graham Clark <grclark@gmail.com> <gcla@moria.(none)>
Ivan Brennan <ivan.brennan@gmail.com>
Jesse Alama <jesse.alama@gmail.com> <alama@stanford.edu>
Joakim Jalap <JOJA@stoneridge.com>
Jon Vanderwijk <jonathn@github.com>
Jonas Bernoulli <jonas@bernoul.li>
Jonas Bernoulli <jonas@bernoul.li> <jonasbernoulli@gmail.com>
Kan-Ru Chen <kanru@kanru.info> <koster@debian.org>
Leo Liu <sdl.web@gmail.com>
Luís Oliveira <luismbo@gmail.com> <loliveira@common-lisp.net>
Luís Oliveira <luismbo@gmail.com> Luís Borges de Oliveira <lbo@siscog.pt>
Marc Herbert <marc.herbert@gmail.com> <marc.herbert+git@gmail.com>
Marc Herbert <marc.herbert@gmail.com> <Marc.Herbert+git@gmail.com>
Marc Herbert <marc.herbert@gmail.com> <marc.herbert+git@gmail.com>
Marcel Wolf <mwolf@ml1.net> marcel-wolf
Marian Schubert <marian.schubert@gmail.com> <marian.schubert@gooddata.com>
Marius Vollmer <marius.vollmer@gmail.com> <marius.vollmer@nokia.com>
......@@ -35,9 +38,6 @@ Mark Karpov <markkarpov@opmbx.org>
Natalie Weizenbaum <nex342@gmail.com> Nathan Weizenbaum
Noam Postavsky <npostavs@users.sourceforge.net>
Noam Postavsky <npostavs@users.sourceforge.net> <github.10.npostavs@spamgourmet.com>
Óscar Fuentes <ofv@wanadoo.es> <ofv@wanadoo.es>
Óscar Fuentes <ofv@wanadoo.es> <oscar@nc10>
Óscar Fuentes <ofv@wanadoo.es> <oscar@qcore>
Peter J. Weisberg <pj@irregularexpressions.net>
Peter Vasil <mail@petervasil.net>
Phil Sainty <phil@catalyst.net.nz> <phil-s@users.noreply.github.com>
......@@ -45,11 +45,11 @@ Philippe Vaucher <philippe.vaucher@gmail.com> <philippe@stvs.ch>
Raimon Grau <raimon@3scale.net> <raimonster@gmail.com>
Rémi Vanicat <vanicat@debian.org> <github.20.vanicat@mamber.net>
Rüdiger Sonderfeld <ruediger@c-plusplus.net> <ruediger@c-plusplus.de>
Sébastien Gross <seb@chezwam.org> <seb•ɑƬ•chezwam•ɖɵʈ•org>
Seong-Kook Shin <cinsky@gmail.com>
Silent Sphere <silentsphere110@gmail.com>
Sylvain Rousseau <thisirs@gmail.com>
Syohei Yoshida <syohex@gmail.com>
Sébastien Gross <seb@chezwam.org> <seb•ɑƬ•chezwam•ɖɵʈ•org>
Tunc Uzlu <bb2020@users.noreply.github.com>
Wei Huang <weih@opera.com>
Wilfred Hughes <me@wilfred.me.uk> <whughes@ahl.com>
......@@ -58,3 +58,6 @@ Yann Hodique <yann.hodique@gmail.com> <hodiquey@vmware.com>
Yann Hodique <yann.hodique@gmail.com> <yann.hodique@bromium.com>
Yann Hodique <yann.hodique@gmail.com> <yhodique@vmware.com>
Yuichi Higashi <aaa707b@gmail.com>
Óscar Fuentes <ofv@wanadoo.es> <ofv@wanadoo.es>
Óscar Fuentes <ofv@wanadoo.es> <oscar@nc10>
Óscar Fuentes <ofv@wanadoo.es> <oscar@qcore>
......@@ -39,6 +39,7 @@ Contributors
------------
- Aaron Culich <aculich@gmail.com>
- Aaron Madlon-Kay <aaron@madlon-kay.com>
- Abdo Roig-Maranges <abdo.roig@gmail.com>
- Adam Benanti <0entropy@protonmail.com>
- Adam Porter <adam@alphapapa.net>
......@@ -46,6 +47,7 @@ Contributors
- Adeodato Simó <dato@net.com.org.es>
- Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Alan Falloon <alan.falloon@gmail.com>
- Alban Gruin <alban@pa1ch.fr>
- Aleksey Uimanov <s9gf4ult@gmail.com>
- Alexander Gramiak <fice-t@protonmail.com>
- Alex Dunn <adunn@ucsb.edu>
......@@ -74,6 +76,7 @@ Contributors
- Brandon W Maister <quodlibetor@gmail.com>
- Brian Warner <warner@lothar.com>
- Bryan Shell <bryan.shell@orbitz.com>
- Buster Copley <buster@buster.me.uk>
- Carl Lieberman <liebermancarl@gmail.com>
- Chillar Anand <anand21nanda@gmail.com>
- Chris Bernard <cebernard@gmail.com>
......@@ -84,6 +87,7 @@ Contributors
- Chris Shoemaker <chris@mojotech.com>
- Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
- Christian Kluge <ckfrakturfreak@web.de>
- Christophe Junke <junke.christophe@gmail.com>
- Christopher Monsanto <chris@monsan.to>
- Cornelius Mika <cornelius.mika@gmail.com>
- Craig Andera <candera@wangdera.com>
......@@ -146,7 +150,9 @@ Contributors
- John Mastro <john.b.mastro@gmail.com>
- John Wiegley <johnw@newartisans.com>
- Jonas Bernoulli <jonas@bernoul.li>
- Jonathan Leech-Pepin <jonathan.leechpepin@gmail.com>
- Jonathan Roes <jroes@jroes.net>
- Jon Vanderwijk <jonathn@github.com>
- Jordan Greenberg <jordan@softwareslave.com>
- Josiah Schwab <jschwab@gmail.com>
- Julien Danjou <julien@danjou.info>
......@@ -167,6 +173,7 @@ Contributors
- Leo Liu <sdl.web@gmail.com>
- Leonardo Etcheverry <leo@kalio.net>
- Lingchao Xin <douglarek@users.noreply.github.com>
- Li-Yun Chang <michael142536@gmail.com>
- Lluís Vilanova <vilanova@ac.upc.edu>
- Loic Dachary <loic@dachary.org>
- Luís Oliveira <luismbo@gmail.com>
......
......@@ -18,6 +18,13 @@ and https://emacsair.me/2017/09/01/campaign-articles.
Magit v2.12.0 Release Notes
===========================
Released 29th March 2018 by Jonas Bernoulli.
I am pleased to announce the release of Magit version 2.12.0,
representing 610 commits by 30 contributors over six months.
Also see https://emacsair.me/2018/03/29/magit-2.12.
Upcoming breaking changes
-------------------------
......
It's Magit! A Git Porcelain inside Emacs
=========================================
Magit is a text-based Git user interface that puts an unmatched focus
on streamlining workflows. Commands are invoked using short mnemonic
key sequences that take the cursor’s position in the highly actionable
interface into account to provide context-sensitive behavior.
With Magit you can do nearly everything that you can do when using Git
on the command-line, but at greater speed and while taking advantage
of advanced features that previously seemed too daunting to use on a
daily basis. Many users will find that by using Magit they can become
more effective Git user.
For more information about Magit, see https://magit.vc
and https://emacsair.me/2017/09/01/campaign-articles.
Magit v2.13.0 Release Notes
===========================
Released 2nd June 2018 by Jonas Bernoulli.
I am pleased to announce the release of Magit version 2.13.0,
representing 166 commits by 18 contributors over two months.
Also see https://emacsair.me/2018/06/02/magit-2.13.
Upcoming breaking changes
-------------------------
* This is the last release to support Emacs 24.4. Going forward at
least Emacs 25.1 is required.
* This is the last release to support Git 1.9.4. Going forward at
least Git 2.4 is required.
* Many functions and variables that have been declared obsolete for
a while now are going to be removed after this release.
All of these changes will happen on "master", the development branch.
Note that the snapshot packages on Melpa are built from that branch.
If you cannot update Emacs and/or Git now, then you should pin Magit
to Melpa-Stable to stick with this release (and bugfix releases) for
the time being.
Breaking changes
----------------
* As announced earlier, the obsolete option `magit-no-confirm-default'
has been removed. #3232
Changes since v2.12.0
---------------------
* Augmenting a file- or blob-visiting buffer with blame information
was completely rewritten, making the implementation more robust and
adding many new features. It is now possible blame in order to get
an answer to the question "what commits remove these lines". It is
no longer necessary for the buffer to be put into `read-only-mode',
when displaying blame information. New visualization styles were
added and users can define their own styles. New commands to visit
blobs related to the current chunk were added.
* Added new command `magit-tag-release'. This is a fairly opinionated
command and its only use to you might be to serve as a template for
your own variant.
* Added new section inserter `magit-insert-ignored-files', which
could be added to `magit-status-sections-hook'.
* The mode `global-magit-file-mode' is now enabled by default, making
the `magit-file-popup' available on "C-c M-g". 0ec28b97
* Added new commands `magit-log-trace-definition' and
`magit-diff-trace-definition', which show a log with diffs about the
definition at point. #2588
* Added new commands `magit-edit-line-commit' and
`magit-diff-edit-hunk-commit', which allow editing the commit that
added the line at point. febe79ba 22b13337
* The interactive prompts for the various reset commands now indicate
the branch which is going to be reset. #3438
* Added new option `magit-published-branches', providing an additional
safety-net. If you try to modify a commit that has been pushed to
one of these branches already, then you are now being asked whether
you really want to do that. Do not rely on this exclusively, there
are edge-cases that are ambiguous and are not always handled as you
might have expected. add4a7f3 ff
* Gravatar images are now being inserted asynchronously. #3452
* After deleting the current worktree, `magit-delete-worktree' now
shows the status buffer for another worktree. d9cd4611
* Added new command `magit-worktree-checkout-pull-request'. a3d788ec
* New variable `magit-get-previous-branch-timeout' limits the amount
of time spent in `magit-get-previous-branch'. #3457
Fixes since v2.12.0
-------------------
* The recently added command `magit-branch-pull-request' had various
issues concerning pull-requests referencing branches from the
upstream repository. #3416 #3417 #3461
* The values of diffstat sections was wrong for sections that
represent renamed files. 66d9558f
* Time zones were not handled correctly when calculating times for
blame headings. #3443
This release also contains the fixes described in the v2.12.1 release
notes, as well as other minor improvements, bug fixes, typo fixes, and
documentation fixes.
Authors
-------
138 Jonas Bernoulli
6 Kyle Meyer
2 Alban Gruin
2 Basil L. Contovounesios
2 Buster Copley
2 Christophe Junke
2 Mario Rodas
2 Phil Sainty
1 Aaron Madlon-Kay
1 Ben North
1 Dean Kariniemi
1 Eli Barzilay
1 Jon Vanderwijk
1 Jonathan Leech-Pepin
1 Justin Guenther
1 Li-Yun Chang
1 Marc Sherry
1 Noam Postavsky
This diff is collapsed.
This diff is collapsed.
Documentation/RelNotes/2.12.0.txt
\ No newline at end of file
Documentation/RelNotes/2.13.0.txt
\ No newline at end of file
magit (2.12.1-1) UNRELEASED; urgency=medium
magit (2.13.0-1) unstable; urgency=medium
* New upstream version
* Run test:
......@@ -6,7 +6,7 @@ magit (2.12.1-1) UNRELEASED; urgency=medium
* Set some variable (locale, and GIT variables)
* Ensure tramp test do not write in ~/
-- Rémi Vanicat <vanicat@debian.org> Wed, 11 Apr 2018 19:06:16 +0200
-- Rémi Vanicat <vanicat@debian.org> Sat, 09 Jun 2018 18:52:31 +0200
magit (2.11.0-1) unstable; urgency=medium
......
......@@ -7,15 +7,13 @@ It is not needed for debian package.
lisp/magit-pkg.el | 1 -
1 file changed, 1 deletion(-)
diff --git a/lisp/magit-pkg.el b/lisp/magit-pkg.el
index fffef5b..e4d8861 100644
--- a/lisp/magit-pkg.el
+++ b/lisp/magit-pkg.el
@@ -1,7 +1,6 @@
(define-package "magit" "2.12.0"
"A Git porcelain inside Emacs."
'((emacs "24.4")
- (async "1.9.2")
(dash "2.13.0")
(ghub "2.0.0")
(git-commit "2.12.0")
- (async "1.9.3")
(dash "2.14.1")
(ghub "2.0.1")
(git-commit "2.12.1")
......@@ -91,20 +91,20 @@ ELGS = magit-autoloads.el magit-version.el
VERSION ?= $(shell test -e $(TOP).git && git describe --tags --abbrev=0)
ASYNC_VERSION = 1.9.2
DASH_VERSION = 2.13.0
GHUB_VERSION = 2.0.0
GIT_COMMIT_VERSION = 2.12.0
ASYNC_VERSION = 1.9.3
DASH_VERSION = 2.14.1
GHUB_VERSION = 2.0.1
GIT_COMMIT_VERSION = 2.12.1
LET_ALIST_VERSION = 1.0.5
MAGIT_POPUP_VERSION = 2.12.3
WITH_EDITOR_VERSION = 2.7.2
ASYNC_MELPA_SNAPSHOT = 20170823
DASH_MELPA_SNAPSHOT = 20170810
GHUB_MELPA_SNAPSHOT = 20180328
GIT_COMMIT_MELPA_SNAPSHOT = 20180329
MAGIT_POPUP_MELPA_SNAPSHOT = 20180329
WITH_EDITOR_MELPA_SNAPSHOT = 20180318
WITH_EDITOR_VERSION = 2.7.3
ASYNC_MELPA_SNAPSHOT = 20180527
DASH_MELPA_SNAPSHOT = 20180413
GHUB_MELPA_SNAPSHOT = 20180417
GIT_COMMIT_MELPA_SNAPSHOT = 20180411
MAGIT_POPUP_MELPA_SNAPSHOT = 20180509
WITH_EDITOR_MELPA_SNAPSHOT = 20180414
EMACS_VERSION = 24.4
......
......@@ -11,7 +11,7 @@
;; Marius Vollmer <marius.vollmer@gmail.com>
;; Maintainer: Jonas Bernoulli <jonas@bernoul.li>
;; Package-Requires: ((emacs "24.4") (dash "2.13.0") (with-editor "2.7.2"))
;; Package-Requires: ((emacs "24.4") (dash "2.14.1") (with-editor "2.7.3"))
;; Keywords: git tools vc
;; Homepage: https://github.com/magit/magit
......@@ -409,6 +409,7 @@ This is only used if Magit is available."
(add-hook 'after-change-major-mode-hook 'git-commit-setup-font-lock-in-buffer)
;;;###autoload
(defun git-commit-setup-check-buffer ()
(and buffer-file-name
(string-match-p git-commit-filename-regexp buffer-file-name)
......@@ -511,7 +512,8 @@ finally check current non-comment text."
(flyspell-region (point-min) end)))
(defun git-commit-flyspell-verify ()
(not (= (char-after (line-beginning-position)) ?#)))
(not (= (char-after (line-beginning-position))
(aref comment-start 0))))
(defun git-commit-finish-query-functions (force)
(run-hook-with-args-until-failure
......
......@@ -191,6 +191,7 @@
["Squash" git-rebase-squash t]
["Fixup" git-rebase-fixup t]
["Kill" git-rebase-kill-line t]
["Noop" git-rebase-noop t]
["Execute" git-rebase-exec t]
["Move Down" git-rebase-move-line-down t]
["Move Up" git-rebase-move-line-up t]
......@@ -518,6 +519,8 @@ running 'man git-rebase' at the command line) for details."
("^\\(exec\\) \\(.*\\)"
(1 'font-lock-keyword-face)
(2 'git-rebase-description))
("^\\(noop\\)"
(1 'font-lock-keyword-face))
(git-rebase-match-comment-line 0 'font-lock-comment-face)
(,(concat git-rebase-comment-re " *" action-re)
0 'git-rebase-killed-action t)
......@@ -539,7 +542,7 @@ By default, this is the same except for the \"pick\" command."
(goto-char (point-min))
(when (and git-rebase-show-instructions
(re-search-forward
(concat git-rebase-comment-re " p, pick")
(concat git-rebase-comment-re "\\s-+p, pick")
nil t))
(goto-char (line-beginning-position))
(--each git-rebase-command-descriptions
......
......@@ -111,7 +111,8 @@ seconds of user inactivity. That is not desirable."
(magit-toplevel)
(or (not magit-auto-revert-tracked-only)
(magit-file-tracked-p buffer-file-name))
(not auto-revert-mode)) ; see #3014
(not auto-revert-mode) ; see #3014
(not global-auto-revert-mode)) ; see #3460
(auto-revert-mode 1))))
;;;###autoload
......
This diff is collapsed.
......@@ -186,6 +186,12 @@ and change branch related variables."
:group 'magit-commands
:type 'boolean)
(defcustom magit-published-branches '("origin/master")
"List of branches that are considered to be published."
:package-version '(magit . "2.13.0")
:group 'magit-commands
:type '(repeat string))
;;; Branch Popup
(defvar magit-branch-config-variables)
......@@ -374,17 +380,14 @@ Please see the manual for more information."
.base.repo.ssh_url)))
(upstream-url (magit-get "remote" upstream "url"))
(remote .head.repo.owner.login)
(branch .head.ref)
(pr-branch branch))
(when (or (not .maintainer_can_modify)
(magit-branch-p branch))
(setq branch (format "pr-%s" .number)))
(when (magit-branch-p branch)
(user-error "Branch `%s' already exists" branch))
(if (equal .head.repo.full_name
.base.repo.full_name)
(let ((inhibit-magit-refresh t))
(magit-branch branch (concat upstream "/" pr-branch)))
(branch (magit--pullreq-branch pr t))
(pr-branch .head.ref))
(if (magit--pullreq-from-upstream-p pr)
(let ((tracking (concat upstream "/" pr-branch)))
(unless (magit-branch-p tracking)
(magit-call-git "fetch" upstream))
(let ((inhibit-magit-refresh t))
(magit-branch branch tracking)))
(if (magit-remote-p remote)
(let ((url (magit-get "remote" remote "url"))
(fetch (magit-get-all "remote" remote "fetch")))
......@@ -408,18 +411,17 @@ Please see the manual for more information."
((string-prefix-p "git://" upstream-url)
.head.repo.git_url)
(t (error "%s has an unexpected format" upstream-url)))))
(magit-call-git "branch" branch
(concat remote "/" pr-branch))
(magit-call-git "branch" branch
(concat "--set-upstream-to="
(if magit-branch-prefer-remote-upstream
(concat upstream "/" .base.ref)
.base.ref)))
(magit-set "true" "branch" branch "rebase")
(if (or .locked (not (equal branch pr-branch)))
(magit-set upstream "branch" branch "pushRemote")
(magit-set remote "branch" branch "pushRemote"))
(magit-set remote "branch" branch "pullRequestRemote"))
(magit-call-git "branch" branch (concat remote "/" pr-branch)))
(if (or .locked (not (equal branch pr-branch)))
(magit-set upstream "branch" branch "pushRemote")
(magit-set remote "branch" branch "pushRemote"))
(magit-set remote "branch" branch "pullRequestRemote")
(magit-set "true" "branch" branch "rebase")
(magit-call-git "branch" branch
(concat "--set-upstream-to="
(if magit-branch-prefer-remote-upstream
(concat upstream "/" .base.ref)
.base.ref)))
(magit-set (number-to-string .number) "branch" branch "pullRequest")
(magit-set .title "branch" branch "description")
(magit-refresh)
......@@ -454,9 +456,7 @@ Please see the manual for more information."
(user-error "Not a valid starting-point: %s" choice))))
(let ((branch (magit-read-string-ns (concat prompt " named"))))
(list branch
(with-no-warnings
(let ((magit-no-confirm-default nil))
(magit-read-starting-point prompt branch)))
(magit-read-starting-point prompt branch)
args)))))
;;;###autoload
......
......@@ -139,9 +139,9 @@ exist, then raise an error."
host)))))
(defun magit--github-remote-p (remote)
(or (--when-let (magit-get "remote" remote "pushurl")
(or (--when-let (magit-git-string "remote" "get-url" "--push" remote)
(magit--github-url-p it))
(--when-let (magit-get "remote" remote "url")
(--when-let (magit-git-string "remote" "get-url" "--all" remote)
(magit--github-url-p it))))
(defun magit--github-url-equal (r1 r2)
......@@ -153,5 +153,21 @@ exist, then raise an error."
(match-string 2 r2))))
(and n1 n2 (equal n1 n2))))))
(defun magit--pullreq-from-upstream-p (pr)
(let-alist pr
(equal .head.repo.full_name
.base.repo.full_name)))
(defun magit--pullreq-branch (pr &optional assert-new)
(let-alist pr
(let ((branch .head.ref))
(when (and (not (magit--pullreq-from-upstream-p pr))
(or (not .maintainer_can_modify)
(magit-branch-p branch)))
(setq branch (format "pr-%s" .number)))
(when (and assert-new (magit-branch-p branch))
(user-error "Branch `%s' already exists" branch))
branch)))
(provide 'magit-collab)
;;; magit-collab.el ends here
......@@ -165,6 +165,7 @@ With a prefix argument, amend to the commit at `HEAD' instead.
"Amend the last commit.
\n(git commit --amend ARGS)"
(interactive (list (magit-commit-arguments)))
(magit-commit-amend-assert)
(magit-run-git-with-editor "commit" "--amend" args))
;;;###autoload
......@@ -180,6 +181,7 @@ to inverse the meaning of the prefix argument. \n(git commit
(not magit-commit-extend-override-date)
magit-commit-extend-override-date)))
(when (setq args (magit-commit-assert args (not override-date)))
(magit-commit-amend-assert)
(let ((process-environment process-environment))
(unless override-date
(push (magit-rev-format "GIT_COMMITTER_DATE=%cD") process-environment))
......@@ -200,6 +202,7 @@ and ignore the option.
(if current-prefix-arg
(not magit-commit-reword-override-date)
magit-commit-reword-override-date)))
(magit-commit-amend-assert)
(let ((process-environment process-environment))
(unless override-date
(push (magit-rev-format "GIT_COMMITTER_DATE=%cD") process-environment))
......@@ -263,7 +266,7 @@ depending on the value of option `magit-commit-squash-confirm'."
(?s "[s]elect other" (setq commit nil))
(?a "[a]bort" (user-error "Quit")))))
(when commit
(setq commit (magit-rebase-interactive-assert commit)))
(setq commit (magit-rebase-interactive-assert commit t)))
(if (and commit
(or confirmed
(not (or rebase
......@@ -287,9 +290,10 @@ depending on the value of option `magit-commit-squash-confirm'."
(when (and (magit-commit-squash-internal option commit args
rebase edit t)
rebase)
(magit-commit-amend-assert commit)
(magit-rebase-interactive-1 commit
(list "--autosquash" "--autostash")
"" "true" t)))
"" "true" nil t)))
(format "Type %%p on a commit to %s into it,"
(substring option 2))
nil nil (list "--graph"))
......@@ -297,6 +301,15 @@ depending on the value of option `magit-commit-squash-confirm'."
(let ((magit-display-buffer-noselect t))
(apply #'magit-diff-staged nil (magit-diff-arguments)))))))
(defun magit-commit-amend-assert (&optional commit)
(--when-let (magit-list-publishing-branches commit)
(let ((m1 "This commit has already been published to ")
(m2 ".\nDo you really want to modify it"))
(magit-confirm 'amend-published
(concat m1 "%s" m2)
(concat m1 "%i public branches" m2)
nil it))))
(defun magit-commit-assert (args &optional strict)
(cond
((or (magit-anything-staged-p)
......@@ -330,7 +343,7 @@ depending on the value of option `magit-commit-squash-confirm'."
(t
(user-error "Nothing staged"))))
(defvar magit--reselve-history nil)
(defvar magit--reshelve-history nil)
;;;###autoload
(defun magit-commit-reshelve (date)
......@@ -345,12 +358,12 @@ history element."
(let ((author-p (magit-rev-author-p "HEAD")))
(push (magit-rev-format (if author-p "%ad" "%cd") "HEAD"
(concat "--date=format:%F %T %z"))
magit--reselve-history)
magit--reshelve-history)
(list (read-string (if author-p
"Change author and committer dates to: "
"Change committer date to: ")
(cons (format-time-string "%F %T %z") 17)
'magit--reselve-history))))
'magit--reshelve-history))))
(let ((process-environment process-environment))
(push (concat "GIT_COMMITTER_DATE=" date) process-environment)
(magit-run-git "commit" "--amend" "--no-edit"
......
......@@ -42,7 +42,10 @@
;; For `magit-insert-revision-gravatar'
(defvar gravatar-size)
;; For `magit-show-commit' and `magit-diff-show-or-scroll'
(declare-function magit-blame-chunk-get "magit-blame" (key &optional pos))
(declare-function magit-current-blame-chunk "magit-blame" ())
(eval-when-compile
(when (boundp 'eieio--known-slot-names)
(add-to-list 'eieio--known-slot-names 'orig-rev)))
(declare-function magit-blame-mode "magit-blame" (&optional arg))
(defvar magit-blame-mode)
(defvar git-rebase-line)
......@@ -1009,7 +1012,7 @@ for a revision."
(interactive
(let* ((mcommit (magit-section-when module-commit))
(atpoint (or (and (bound-and-true-p magit-blame-mode)
(magit-blame-chunk-get :hash))
(oref (magit-current-blame-chunk) orig-rev))
mcommit
(magit-branch-or-commit-at-point))))
(nconc (cons (or (and (not current-prefix-arg) atpoint)
......@@ -1182,7 +1185,8 @@ Customize variable `magit-diff-refine-hunk' to change the default mode."
;;;; Visit commands
(defun magit-diff-visit-file (file &optional other-window force-worktree)
(defun magit-diff-visit-file
(file &optional other-window force-worktree display-fn)
"From a diff, visit the corresponding file at the appropriate position.
If the diff shows changes in the worktree, the index, or `HEAD',
......@@ -1199,8 +1203,11 @@ being displayed in another window of the same frame, then just
select that window and adjust point. Otherwise, or with a prefix
argument, display the buffer in another window. The meaning of
the prefix argument can be inverted or further modified using the
option `magit-display-file-buffer-function'. Non-interactively
the optional OTHER-WINDOW argument is taken literally.
option `magit-display-file-buffer-function'.
Non-interactively the optional OTHER-WINDOW argument is taken
literally. DISPLAY-FN can be used to specify the display
function explicitly, in which case OTHER-WINDOW is ignored.
The optional FORCE-WORKTREE means to force visiting the worktree
version of the file. To do this interactively use the command
......@@ -1230,6 +1237,8 @@ version of the file. To do this interactively use the command
(find-file-noselect file)))))
(cond ((called-interactively-p 'any)
(magit-display-file-buffer buf))
(display-fn
(funcall display-fn buf))
((or other-window (get-buffer-window buf))
(switch-to-buffer-other-window buf))
(t
......@@ -1476,7 +1485,7 @@ commit or stash at point, then prompt for a commit."
(let (rev cmd buf win)
(cond
(magit-blame-mode
(setq rev (magit-blame-chunk-get :hash))
(setq rev (oref (magit-current-blame-chunk) orig-rev))
(setq cmd 'magit-show-commit)
(setq buf (magit-mode-get-buffer 'magit-revision-mode)))
((derived-mode-p 'git-rebase-mode)
......@@ -1617,6 +1626,8 @@ is set in `magit-mode-setup'."
(define-key map "s" 'magit-stage)
(define-key map "u" 'magit-unstage)
(define-key map "&" 'magit-do-async-shell-command)
(define-key map "\C-c\C-t" 'magit-diff-trace-definition)
(define-key map "\C-c\C-e" 'magit-diff-edit-hunk-commit)
map)
"Keymap for `file' sections.")
......@@ -1633,6 +1644,8 @@ is set in `magit-mode-setup'."
(define-key map "s" 'magit-stage)
(define-key map "u" 'magit-unstage)
(define-key map "&" 'magit-do-async-shell-command)
(define-key map "\C-c\C-t" 'magit-diff-trace-definition)
(define-key map "\C-c\C-e" 'magit-diff-edit-hunk-commit)
map)
"Keymap for `hunk' sections.")
......@@ -1683,7 +1696,12 @@ section or a child thereof."
(magit-insert-heading)
(let (files)
(while (looking-at "^[-0-9]+\t[-0-9]+\t\\(.+\\)$")
(push (magit-decode-git-path (match-string 1)) files)
(push (magit-decode-git-path
(let ((f (match-string 1)))
(if (string-match " => " f)
(substring f (match-end 0))
f)))
files)
(magit-delete-line))
(setq files (nreverse files))
(while (looking-at magit-diff-statline-re)
......@@ -2134,38 +2152,58 @@ or a ref which is not a branch, then it inserts nothing."
(insert ?\n))))
(defun magit-insert-revision-gravatars (rev beg)
(when (and magit-revision-show-gravatars (window-system))
(when (and magit-revision-show-gravatars
(window-system))
(require 'gravatar)
(magit-insert-revision-gravatar beg (magit-rev-format "%aE" rev)
(car magit-revision-show-gravatars))
(magit-insert-revision-gravatar beg (magit-rev-format "%cE" rev)
(cdr magit-revision-show-gravatars))
(goto-char (point-max))))
(defun magit-insert-revision-gravatar (beg email regexp)
(when (and email (goto-char beg) (re-search-forward regexp nil t))
(ignore-errors
(let* ((offset (length (match-string 0)))
(pcase-let ((`(,author . ,committer) magit-revision-show-gravatars))
(--when-let (magit-rev-format "%aE" rev)
(magit-insert-revision-gravatar beg rev it author))
(--when-let (magit-rev-format "%cE" rev)
(magit-insert-revision-gravatar beg rev it committer)))))
(defun magit-insert-revision-gravatar (beg rev email regexp)
(save-excursion
(goto-char beg)
(when (re-search-forward regexp nil t)
(let* ((column (length (match-string 0)))
(font-obj (query-font (font-at (point) (get-buffer-window))))
(size (* 2 (+ (aref font-obj 4) (aref font-obj 5))))
(align-to (+ offset (ceiling (/ size (aref font-obj 7) 1.0))))
(gravatar-size (- size 2))
(slice1 '(slice .0 .0 1.0 0.5))
(slice2 '(slice .0 .5 1.0 1.0))
(image (gravatar-retrieve-synchronously email)))
(unless (eq image 'error)
(when magit-revision-use-gravatar-kludge
(cl-rotatef slice1 slice2))
(insert (propertize " " 'display `((,@image :ascent center :relief 1)
,slice1)))
(insert (propertize " " 'display `((space :align-to ,align-to))))
(insert " ")
(forward-line)
(forward-char offset)
(insert (propertize " " 'display `((,@image :ascent center :relief 1)
,slice2)))
(insert (propertize " " 'display `((space :align-to ,align-to))))
(insert " "))))))
(size (* 2 (+ (aref font-obj 4)
(aref font-obj 5))))
(align-to (+ column
(ceiling (/ size (aref font-obj 7) 1.0))
1))
(gravatar-size (- size 2)))
(gravatar-retrieve email 'magit-insert-revision-gravatar-cb
(list rev (point-marker) align-to column))))))
(defun magit-insert-revision-gravatar-cb (image rev marker align-to column)
(unless (eq image 'error)
(-when-let (buffer (marker-buffer marker))
(with-current-buffer buffer
(save-excursion
(goto-char marker)
;; The buffer might display another revision by now or
;; it might have been refreshed, in which case another
;; process might already have inserted the image.
(when (and (equal rev (car magit-refresh-args))
(not (eq (car-safe
(car-safe
(get-text-property (point) 'display)))
'image)))
(let ((top `((,@image :ascent center :relief 1)
(slice 0.0 0.0 1.0 0.5)))
(bot `((,@image :ascent center :relief 1)
(slice 0.0 0.5 1.0 1.0)))
(align `((space :align-to ,align-to))))
(when magit-revision-use-gravatar-kludge
(cl-rotatef top bot))
(let ((inhibit-read-only t))
(insert (propertize " " 'display top))
(insert (propertize " " 'display align))
(forward-line)
(forward-char column)
(insert (propertize " " 'display bot))
(insert (propertize " " 'display align))))))))))
;;; Diff Sections
......
......@@ -36,9 +36,10 @@
(defcustom magit-gitk-executable
(or (and (eq system-type 'windows-nt)
(let ((exe (expand-file-name
"gitk" (file-name-nondirectory magit-git-executable))))
(and (file-executable-p exe) exe)))
(let ((exe (magit-git-string
"-c" "alias.X=!x() { which \"$1\" | cygpath -mf -; }; x"
"X" "gitk.exe")))
(and exe (file-executable-p exe) exe)))
(executable-find "gitk") "gitk")
"The Gitk executable."
:group 'magit-extras
......@@ -113,7 +114,7 @@ instead of every time Ido is invoked, so now you can modify it
like pretty much every other keymap:
(define-key ido-common-completion-map
(kbd \"C-x g\") 'ido-enter-magit-status)"
(kbd \"C-x g\") \\='ido-enter-magit-status)"
(interactive)
(with-no-warnings ; FIXME these are internal variables
(setq ido-exit 'fallback fallback 'magit-status))
......@@ -321,6 +322,76 @@ on a position in a file-visiting buffer."
(prompt-for-change-log-name))))
(magit-add-change-log-entry whoami file-name t))
;;; Edit Line Commit
;;;###autoload
(defun magit-edit-line-commit (&optional type)
"Edit the commit that added the current line.
With a prefix argument edit the commit that removes the line,
if any. The commit is determined using `git blame' and made
editable using `git rebase --interactive' if it is reachable
from `HEAD', or by checking out the commit (or a branch that
points at it) otherwise."
(interactive (list (and current-prefix-arg 'removal)))
(let* ((chunk (magit-current-blame-chunk (or type 'addition)))
(rev (oref chunk orig-rev)))
(if (equal rev "0000000000000000000000000000000000000000")
(message "This line has not been committed yet")
(let ((rebase (magit-rev-ancestor-p rev "HEAD"))
(file (expand-file-name (oref chunk orig-file)
(magit-toplevel))))
(if rebase
(let ((magit--rebase-published-symbol 'edit-published))
(magit-rebase-edit-commit rev (magit-rebase-arguments)))
(magit-checkout (or (magit-rev-branch rev) rev)))
(unless (and buffer-file-name
(file-equal-p file buffer-file-name))
(let ((blame-type (and magit-blame-mode magit-blame-type)))
(if rebase
(set-process-sentinel
magit-this-process
(lambda (process event)
(magit-sequencer-process-sentinel process event)
(when (eq (process-status process) 'exit)
(find-file file)
(when blame-type
(magit-blame--pre-blame-setup blame-type)
(magit-blame--run)))))
(find-file file)
(when blame-type
(magit-blame--pre-blame-setup blame-type)
(magit-blame--run)))))))))
(put 'magit-edit-line-commit 'disabled t)
(defun magit-diff-edit-hunk-commit ()
"From a hunk, edit the respective commit and visit the file.
First visit the file being modified by the hunk at the correct
location using `magit-diff-visit-file'. This actually visits a
blob. When point is on a diff header, not within an individual
hunk, then this visits the blob the first hunk is about.
Then invoke `magit-edit-line-commit', which uses an interactive
rebase to make the commit editable, or if that is not possible
because the commit is not reachable from `HEAD' by checking out
that commit directly. This also causes the actual worktree file
to be visited.
Neither the blob nor the file buffer are killed when finishing
the rebase. If that is undesirable, then it might be better to
use `magit-rebase-edit-command' instead of this command."
(interactive)
(let ((magit-diff-visit-previous-blob nil))
(magit-diff-visit-file (--if-let (magit-file-at-point)
(expand-file-name it)
(user-error "No file at point"))
nil 'switch-to-buffer))
(magit-edit-line-commit))
(put 'magit-diff-edit-hunk-commit 'disabled t)
;;; Reshelve
;;;###autoload
......@@ -362,12 +433,12 @@ be used on highly rearranged and unpublished history."
(- (string-to-number
(magit-git-string "rev-list" "--count"
range))))))
(push time-rev magit--reselve-history)
(push time-rev magit--reshelve-history)
(let ((date (floor
(float-time
(date-to-time
(read-string "Date for first commit: "
time-now 'magit--reselve-history))))))
time-now 'magit--reshelve-history))))))
(magit-with-toplevel
(magit-run-git-async
"filter-branch" "--force" "--env-filter"
......
......@@ -226,7 +226,30 @@ directory, while reading the FILENAME."
;;;###autoload (autoload 'magit-file-popup "magit" nil t)
(magit-define-popup magit-file-popup
"Popup console for Magit commands in file-visiting buffers."
:actions magit-file-popup-actions
:actions '((?s "Stage" magit-stage-file)
(?D "Diff..." magit-diff-buffer-file-popup)
(?L "Log..." magit-log-buffer-file-popup)
(?B "Blame..." magit-blame-popup) nil
(?u "Unstage" magit-unstage-file)
(?d "Diff" magit-diff-buffer-file)
(?l "Log" magit-log-buffer-file)
(?b "Blame" magit-blame)
(?p "Prev blob" magit-blob-previous)
(?c "Commit" magit-commit-popup) nil
(?t "Trace" magit-log-trace-definition)
(?r (lambda ()
(with-current-buffer magit-pre-popup-buffer
(and (not buffer-file-name)
(propertize "...removal" 'face 'default))))
magit-blame-removal)
(?n "Next blob" magit-blob-next)
(?e "Edit line" magit-edit-line-commit)
nil nil
(?f (lambda ()
(with-current-buffer magit-pre-popup-buffer
(and (not buffer-file-name)
(propertize "...reverse" 'face 'default))))
magit-blame-reverse))
:max-action-columns 5)
(defvar magit-file-mode-lighter "")
......@@ -248,10 +271,18 @@ Currently this only adds the following key bindings.
;;;###autoload
(define-globalized-minor-mode global-magit-file-mode
magit-file-mode magit-file-mode-turn-on
:package-version '(magit . "2.2.0")
:package-version '(magit . "2.13.0")
:link '(info-link "(magit)Minor Mode for Buffers Visiting Files")
:group 'magit-essentials
:group 'magit-modes)
:group 'magit-modes
:init-value t)
;; Unfortunately `:init-value t' only sets the value of the mode
;; variable but does not cause the mode function to be called, and we
;; cannot use `:initialize' to call that explicitly because the option
;; is defined before the functions, so we have to do it here.
(cl-eval-when (load)
(when global-magit-file-mode
(global-magit-file-mode 1)))
;;; Blob Mode
......@@ -261,11 +292,13 @@ Currently this only adds the following key bindings.
(define-key map "i" 'magit-blob-previous)
(define-key map "k" 'magit-blob-next)
(define-key map "j" 'magit-blame)
(define-key map "l" 'magit-blame-reverse))
(define-key map "l" 'magit-blame-removal)
(define-key map "f" 'magit-blame-reverse))
(t
(define-key map "p" 'magit-blob-previous)
(define-key map "n" 'magit-blob-next)
(define-key map "b" 'magit-blame)
(define-key map "r" 'magit-blame-removal)
(define-key map "f" 'magit-blame-reverse)))
(define-key map "q" 'magit-kill-this-buffer)
map)
......@@ -493,7 +526,7 @@ If the value is the symbol `buffer', then use the same arguments
as the buffer. With a prefix argument use no arguments.
If the value is a list beginning with the symbol `exclude', then
use the arguments as the buffer except for those matched by
use the same arguments as the buffer except for those matched by
entries in the cdr of the list. The comparison is done using
`string-prefix-p'. With a prefix argument use the same arguments
as the buffer.
......
......@@ -44,6 +44,7 @@
(defvar magit-process-error-message-regexps)
(defvar magit-refresh-args) ; from `magit-mode' for `magit-current-file'
(defvar magit-branch-prefer-remote-upstream)
(defvar magit-published-branches)
(defvar magit-tramp-process-environment nil)
......@@ -644,7 +645,8 @@ tracked file."
(unless file
(with-current-buffer (or (buffer-base-buffer)
(current-buffer))
(setq file (or magit-buffer-file-name buffer-file-name))))
(setq file (or magit-buffer-file-name buffer-file-name
(and (derived-mode-p 'dired-mode) default-directory)))))
(when (and file (or (not tracked)
(magit-file-tracked-p (file-relative-name file))))
(--when-let (magit-toplevel
......@@ -683,6 +685,10 @@ tracked file."
(defun magit-unmerged-files ()
(magit-git-items "diff-files" "-z" "--name-only" "--diff-filter=U"))
(defun magit-ignored-files ()
(magit-git-items "ls-files" "-z" "--others" "--ignored"
"--exclude-standard" "--directory"))
(defun magit-revision-files (rev)
(magit-with-toplevel
(magit-git-items "ls-tree" "-z" "-r" "--name-only" rev)))
......@@ -916,7 +922,7 @@ corresponds to a ref outside of the namespace."
(defun magit-rev-branch (rev)
(--when-let (magit-rev-name rev "refs/heads/*")
(unless (string-match-p "~" it) it)))
(unless (string-match-p "[~^]" it) it)))
(defun magit-get-shortname (rev)
(let* ((fn (apply-partially 'magit-rev-name rev))
......@@ -1068,15 +1074,24 @@ to, or to some other symbolic-ref that points to the same ref."
Return nil if no branch is currently checked out."
(magit-git-string "symbolic-ref" "--short" "HEAD"))
(defvar magit-get-previous-branch-timeout 0.5
"Maximum time to spend in `magit-get-previous-branch'.
Given as a number of seconds.")
(defun magit-get-previous-branch ()
"Return the refname of the previously checked out branch.
Return nil if no branch can be found in the `HEAD' reflog
which is different from the current branch and still exists."
(let ((current (magit-get-current-branch))
which is different from the current branch and still exists.
The amount of time spent searching is limited by
`magit-get-previous-branch-timeout'."
(let ((t0 (float-time))
(current (magit-get-current-branch))
(i 1) prev)
(while (and (setq prev (magit-rev-verify (format "@{-%i}" i)))
(or (not (setq prev (magit-rev-branch prev)))
(equal prev current)))
(while (if (> (- (float-time) t0) magit-get-previous-branch-timeout)
(setq prev nil) ;; Timed out.
(and (setq prev (magit-rev-verify (format "@{-%i}" i)))
(or (not (setq prev (magit-rev-branch prev)))
(equal prev current))))
(cl-incf i))
prev))
......@@ -1270,20 +1285,23 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of
(defun magit-list-remote-branches (&optional remote)
(magit-list-refs (concat "refs/remotes/" remote)))
(defun magit-list-containing-branches (&optional commit)
(--remove (string-match-p "\\`(HEAD" it)
(defun magit-list-related-branches (relation &optional commit arg)
(--remove (string-match-p "\\(\\`(HEAD\\|HEAD -> \\)" it)
(--map (substring it 2)
(magit-git-lines "branch" "--contains" commit))))
(magit-git-lines "branch" arg relation commit))))
(defun magit-list-merged-branches (&optional commit)
(--remove (string-match-p "\\`(HEAD" it)
(--map (substring it 2)
(magit-git-lines "branch" "--merged" commit))))
(defun magit-list-containing-branches (&optional commit arg)
(magit-list-related-branches "--contains" commit arg))
(defun magit-list-unmerged-branches (&optional commit)
(--remove (string-match-p "\\`(HEAD" it)
(--map (substring it 2)
(magit-git-lines "branch" "--no-merged" commit))))
(defun magit-list-publishing-branches (&optional commit)
(--filter (member it magit-published-branches)
(magit-list-containing-branches commit "--remote")))
(defun magit-list-merged-branches (&optional commit arg)
(magit-list-related-branches "--merged" commit arg))
(defun magit-list-unmerged-branches (&optional commit arg)
(magit-list-related-branches "--no-merged" commit arg))
(defun magit-list-unmerged-to-upstream-branches ()
(--filter (-when-let (upstream (magit-get-upstream-branch it))
......@@ -1863,7 +1881,9 @@ the reference is used. The first regexp submatch becomes the
(concat " "
(propertize branch 'face 'magit-branch-local))))
" starting at")
(cons "HEAD" (magit-list-refnames))
(nconc (list "HEAD")
(magit-list-refnames)
(directory-files (magit-git-dir) nil "_HEAD\\'"))
nil nil nil 'magit-revision-history
(magit--default-starting-point))
(user-error "Nothing selected")))
......@@ -1945,7 +1965,7 @@ the reference is used. The first regexp submatch becomes the
(--> key
(replace-regexp-in-string "\\`[^.]+" #'downcase it t t)
(replace-regexp-in-string "[^.]+\\'" #'downcase it t t))
(magit--with-refresh-cache (list 'config (magit-toplevel))
(magit--with-refresh-cache (cons (magit-toplevel) 'config)
(let ((configs (make-hash-table :test 'equal)))
(dolist (conf (magit-git-items "config" "--list" "-z"))
(let* ((nl-pos (cl-position ?\n conf))
......
......@@ -165,7 +165,7 @@ This is useful if you use really long branch names."
;;;; File Log
(defcustom magit-log-buffer-file-locked t
"Whether `magit-log-buffer-file' uses a decicated buffer."
"Whether `magit-log-buffer-file' uses a dedicated buffer."
:package-version '(magit . "2.7.0")
:group 'magit-commands
:group 'magit-log
......@@ -686,9 +686,7 @@ active, restrict the log to the lines that the region touches."
;; of a trailing newline.
(1- end)))))))))
(require 'magit)
(-if-let (file (or (magit-file-relative-name)
(and (derived-mode-p 'dired-mode)
default-directory)))
(-if-let (file (magit-file-relative-name))
(magit-mode-setup-internal
#'magit-log-mode
(list (list (or magit-buffer-refname
......@@ -697,7 +695,9 @@ active, restrict the log to the lines that the region touches."
(let ((args (car (magit-log-arguments))))
(when (and follow (not (member "--follow" args)))
(push "--follow" args))
(when (and beg end)
(when (and (file-regular-p
(expand-file-name file (magit-toplevel)))
beg end)
(setq args (cons (format "-L%s,%s:%s" beg end file)
(cl-delete "-L" args :test
'string-prefix-p)))
......@@ -708,6 +708,39 @@ active, restrict the log to the lines that the region touches."
(user-error "Buffer isn't visiting a file"))
(magit-log-goto-same-commit))
;;;###autoload
(defun magit-log-trace-definition (file fn rev)
"Show log for the definition at point."
(interactive (list (or (magit-file-relative-name)
(user-error "Buffer isn't visiting a file"))
(add-log-current-defun)
(or magit-buffer-refname
(magit-get-current-branch)
"HEAD")))
(require 'magit)
(magit-mode-setup-internal
#'magit-log-mode
(list (list rev)
(cons (format "-L:%s:%s" fn file)
(cl-delete "-L" (car (magit-log-arguments))
:test 'string-prefix-p))
nil)
magit-log-buffer-file-locked)
(magit-log-goto-same-commit))
(defun magit-diff-trace-definition ()
"Show log for the definition at point in a diff."
(interactive)
(let (buf pos)
(save-window-excursion
(call-interactively #'magit-diff-visit-file)
(setq buf (current-buffer))
(setq pos (point)))
(save-excursion
(with-current-buffer buf
(goto-char pos)
(call-interactively #'magit-log-trace-definition)))))
;;;###autoload
(defun magit-reflog-current ()
"Display the reflog of the current branch."
......
......@@ -546,6 +546,9 @@ Magit is documented in info node `(magit)'."
(when (and (fboundp 'nlinum-mode)
(bound-and-true-p global-nlinum-mode))
(nlinum-mode -1))
(when (and (fboundp 'display-line-numbers-mode)
(bound-and-true-p global-display-line-numbers-mode))
(display-line-numbers-mode -1))
(add-hook 'kill-buffer-hook 'magit-preserve-section-visibility-cache))
(defvar-local magit-region-overlays nil)
......
......@@ -137,10 +137,6 @@ use `magit-pre-refresh-hook', `magit-post-refresh-hook',
(define-obsolete-function-alias 'magit-get-submodules
'magit-list-module-paths "Magit 2.12.0")
(make-obsolete-variable 'magit-no-confirm-default
'magit-dwim-selection
"Magit 2.12.0")
(make-obsolete-variable 'magit-status-expand-stashes
'magit-section-initial-visibility-alist
"Magit 2.12.0")
......
(define-package "magit" "2.12.0"
"A Git porcelain inside Emacs."
'((emacs "24.4")
(async "1.9.2")
(dash "2.13.0")
(ghub "2.0.0")
(git-commit "2.12.0")
(async "1.9.3")
(dash "2.14.1")
(ghub "2.0.1")
(git-commit "2.12.1")
(let-alist "1.0.5")
(magit-popup "2.12.3")
(with-editor "2.7.2")))
(with-editor "2.7.3")))
......@@ -555,6 +555,25 @@ Magit status buffer."
(magit-process-display-buffer process)
process))
(defun magit-parse-git-async (&rest args)
(setq args (magit-process-git-arguments args))
(let ((command-buf (current-buffer))
(process-buf (generate-new-buffer " *temp*"))
(toplevel (magit-toplevel)))
(with-current-buffer process-buf
(setq default-directory toplevel)
(let ((process
(let ((process-connection-type nil)
(process-environment (magit-process-environment))
(default-process-coding-system
(magit--process-coding-system)))
(apply #'start-file-process "git" process-buf
magit-git-executable args))))
(process-put process 'command-buf command-buf)
(process-put process 'parsed (point))
(setq magit-this-process process)
process))))
;;; Process Internals
(defun magit-process-setup (program args)
......
......@@ -562,7 +562,7 @@ line is inserted at all."
(make-string (max 1 (- magit-refs-primary-column-width
(length abbrev)))
?\s)
(magit-log-propertize-keywords nil msg)))
(and msg (magit-log-propertize-keywords nil msg))))
(when (magit-buffer-margin-p)
(magit-refs--format-margin branch))
(magit-refs--insert-cherry-commits branch section)))))))
......
......@@ -54,10 +54,11 @@ head this effectively unstages all changes.
"Reset the head and index to COMMIT, but not the working tree.
With a prefix argument also reset the working tree.
\n(git reset --mixed|--hard COMMIT)"
(interactive (list (magit-read-branch-or-commit
(interactive (list (magit-reset-read-branch-or-commit
(if current-prefix-arg
"Hard reset to"
"Reset head to"))
(concat (propertize "Hard" 'face 'bold)
" reset %s to")
"Reset %s to"))
current-prefix-arg))
(magit-reset-internal (if hard "--hard" "--mixed") commit))
......@@ -65,23 +66,33 @@ With a prefix argument also reset the working tree.
(defun magit-reset-head (commit)
"Reset the head and index to COMMIT, but not the working tree.
\n(git reset --mixed COMMIT)"
(interactive (list (magit-read-branch-or-commit "Reset head to")))
(interactive (list (magit-reset-read-branch-or-commit "Reset %s to")))
(magit-reset-internal "--mixed" commit))
;;;###autoload
(defun magit-reset-soft (commit)
"Reset the head to COMMIT, but not the index and working tree.
\n(git reset --soft REVISION)"
(interactive (list (magit-read-branch-or-commit "Soft reset to")))
(interactive (list (magit-reset-read-branch-or-commit "Soft reset %s to")))
(magit-reset-internal "--soft" commit))
;;;###autoload
(defun magit-reset-hard (commit)
"Reset the head, index, and working tree to COMMIT.
\n(git reset --hard REVISION)"
(interactive (list (magit-read-branch-or-commit "Hard reset to")))
(interactive (list (magit-reset-read-branch-or-commit
(concat (propertize "Hard" 'face 'bold)
" reset %s to"))))
(magit-reset-internal "--hard" commit))
(defun magit-reset-read-branch-or-commit (prompt)
"Prompt for and return a ref to reset HEAD to.
PROMPT is a format string, where either the current branch name
or \"detached head\" will be substituted for %s."
(magit-read-branch-or-commit
(format prompt (or (magit-get-current-branch) "detached head"))))
(defun magit-reset-internal (arg commit &optional path)
(when (and (not (member arg '("--hard" nil)))
(equal (magit-rev-parse commit)
......
......@@ -544,7 +544,7 @@ START has to be selected from a list of recent commits."
"and commits above it onto " newbase ","))))
(defun magit-rebase-interactive-1
(commit args message &optional editor noassert confirm)
(commit args message &optional editor delay-edit-confirm noassert confirm)
(declare (indent 2))
(when commit
(if (eq commit :merge-base)
......@@ -557,7 +557,7 @@ START has to be selected from a list of recent commits."
(setq commit (concat commit "^"))
(setq args (cons "--root" args)))))
(when (and commit (not noassert))
(setq commit (magit-rebase-interactive-assert commit)))
(setq commit (magit-rebase-interactive-assert commit delay-edit-confirm)))
(if (and commit (not confirm))
(let ((process-environment process-environment))
(when editor
......@@ -567,10 +567,36 @@ START has to be selected from a list of recent commits."
(magit-log-select
`(lambda (commit)
(magit-rebase-interactive-1 commit (list ,@args)
,message ,editor ,noassert))
,message ,editor ,delay-edit-confirm ,noassert))
message)))
(defun magit-rebase-interactive-assert (since)
(defvar magit--rebase-published-symbol nil)
(defvar magit--rebase-public-edit-confirmed nil)
(defun magit-rebase-interactive-assert (since &optional delay-edit-confirm)
(let* ((commit (if (string-suffix-p "^" since)
;; If SINCE is "REV^", then the user selected
;; "REV", which is the first commit that will
;; be replaced. (from^..to] <=> [from..to].
(substring since 0 -1)
;; The "--root" argument is being used.
since))
(branches (magit-list-publishing-branches commit)))
(setq magit--rebase-public-edit-confirmed
(delete (magit-toplevel) magit--rebase-public-edit-confirmed))
(when (and branches
(or (not delay-edit-confirm)
;; The user might have stopped at a published commit
;; merely to add new commits *after* it. Try not to
;; ask users whether they really want to edit public
;; commits, when they don't actually intend to do so.
(not (--all-p (magit-rev-equal it commit) branches))))
(let ((m1 "Some of these commits have already been published to ")
(m2 ".\nDo you really want to modify them"))
(magit-confirm (or magit--rebase-published-symbol 'rebase-published)
(concat m1 "%s" m2)
(concat m1 "%i public branches" m2)))
(push (magit-toplevel) magit--rebase-public-edit-confirmed)))
(if (magit-git-lines "rev-list" "--merges" (concat since "..HEAD"))
(magit-read-char-case "Proceed despite merge in rebase range? " nil
(?c "[c]ontinue" since)
......@@ -584,7 +610,8 @@ START has to be selected from a list of recent commits."
(interactive (list (magit-commit-at-point)
(magit-rebase-arguments)))
(magit-rebase-interactive-1 commit args
"Type %p on a commit to rebase it and all commits above it,"))
"Type %p on a commit to rebase it and all commits above it,"
nil t))
;;;###autoload
(defun magit-rebase-autosquash (args)
......@@ -601,7 +628,8 @@ START has to be selected from a list of recent commits."
(magit-rebase-arguments)))
(magit-rebase-interactive-1 commit args
"Type %p on a commit to edit it,"
"perl -i -p -e '++$x if not $x and s/^pick/edit/'"))
"perl -i -p -e '++$x if not $x and s/^pick/edit/'"
t))
;;;###autoload
(defun magit-rebase-reword-commit (commit args)
......@@ -620,7 +648,7 @@ START has to be selected from a list of recent commits."
(magit-rebase-interactive-1 commit args
"Type %p on a commit to remove it,"
"perl -i -p -e '++$x if not $x and s/^pick/# pick/'"
nil t))
nil nil t))
;;;###autoload
(defun magit-rebase-continue (&optional noedit)
......@@ -631,6 +659,11 @@ edit. With a prefix argument the old message is reused as-is."
(if (magit-rebase-in-progress-p)
(if (magit-anything-unstaged-p t)
(user-error "Cannot continue rebase with unstaged changes")
(when (and (magit-anything-staged-p)
(file-exists-p (magit-git-dir "rebase-merge"))
(not (member (magit-toplevel)
magit--rebase-public-edit-confirmed)))
(magit-commit-amend-assert))
(if noedit
(let ((process-environment process-environment))
(push "GIT_EDITOR=true" process-environment)
......
......@@ -515,7 +515,7 @@ value of that variable can be set using \"D = f DIRECTORY RET g\"."
(-when-let (files (magit-untracked-files nil base))
(magit-insert-section (untracked)
(magit-insert-heading "Untracked files:")
(magit-insert-un/tracked-files-1 files base)
(magit-insert-files files base)
(insert ?\n)))
(-when-let
(files (--mapcat (and (eq (aref it 0) ??)
......@@ -542,10 +542,24 @@ value of that variable can be set using \"D = f DIRECTORY RET g\"."
(base (and base (file-directory-p base) base)))
(magit-insert-section (tracked nil t)
(magit-insert-heading "Tracked files:")
(magit-insert-un/tracked-files-1 files base)
(magit-insert-files files base)
(insert ?\n)))))
(defun magit-insert-un/tracked-files-1 (files directory)
(defun magit-insert-ignored-files ()
"Insert a tree of ignored files.
If the first element of `magit-diff-section-arguments' is a
directory, then limit the list to files below that. The value
of that variable can be set using \"D = f DIRECTORY RET g\"."
(-when-let (files (magit-ignored-files))
(let* ((base (car magit-diff-section-file-args))
(base (and base (file-directory-p base) base)))
(magit-insert-section (tracked nil t)
(magit-insert-heading "Ignored files:")
(magit-insert-files files base)
(insert ?\n)))))
(defun magit-insert-files (files directory)
(while (and files (string-prefix-p (or directory "") (car files)))
(let ((dir (file-name-directory (car files))))
(if (equal dir directory)
......@@ -555,7 +569,7 @@ value of that variable can be set using \"D = f DIRECTORY RET g\"."
(magit-insert-section (file dir t)
(insert (propertize dir 'file 'magit-filename) ?\n)
(magit-insert-heading)
(setq files (magit-insert-un/tracked-files-1 files dir))))))
(setq files (magit-insert-files files dir))))))
files)
(provide 'magit-status)
......
......@@ -67,6 +67,7 @@ defaulting to the tag at point.
(magit-read-tag "Delete tag" t))))
(magit-run-git "tag" "-d" tags))
;;;###autoload
(defun magit-tag-prune (tags remote-tags remote)
"Offer to delete tags missing locally from REMOTE, and vice versa."
(interactive
......@@ -95,5 +96,37 @@ defaulting to the tag at point.
(when remote-tags
(magit-run-git-async "push" remote (--map (concat ":" it) remote-tags))))
;;;###autoload
(defun magit-tag-release (tag)
"Create an opinionated release tag.
Assume version tags that match \"\\\\`v?[0-9]\\\\(\\\\.[0-9]\\\\)*\\\\'\".
Prompt for the name of the new tag using the highest existing tag
as initial input and call \"git tag --annotate --sign -m MSG\" TAG,
regardless of whether these arguments are enabled in the popup.
Given a TAG \"v1.2.3\" and a repository \"/path/to/foo-bar\", the
MESSAGE would be \"Foo-Bar 1.2.3\".
Because it is so opinionated, this command is not available from
the tag popup by default."
(interactive
(list (read-string "Create tag: "
(car (nreverse
(cl-sort (magit-list-tags) #'version<
:key (lambda (tag)
(if (string-prefix-p "v" tag)
(substring tag 1)
tag))))))))
(magit-run-git
"tag" "--annotate" "--sign"
"-m" (format "%s %s"
(capitalize (file-name-nondirectory
(directory-file-name (magit-toplevel))))
(if (string-prefix-p "v" tag)
(substring tag 1)
tag))
tag)
(magit-show-refs))
(provide 'magit-tag)
;;; magit-tag.el ends here
......@@ -77,24 +77,6 @@ or `helm--completing-read-default'."
(function-item helm--completing-read-default)
(function :tag "Other function")))
(defvar magit-no-confirm-default nil
"A list of commands which should just use the default choice.
Many commands let the user choose the target they act on offering
a sensible default as default choice. If you think that that
default is so sensible that it should always be used without even
offering other choices, then add that command here.
Only the following commands support this option:
`magit-branch'
`magit-branch-and-checkout'
`magit-branch-orphan'
`magit-worktree-branch'
For these four commands `magit-branch-read-upstream-first'
must be non-nil, or adding them here has no effect.
`magit-branch-rename'
`magit-tag'")