Magit status closes all sections on each action?

6 views
Skip to first unread message

Gary Oberbrunner

unread,
Apr 13, 2016, 2:18:33 PM4/13/16
to magit
I have some modified files, each with several hunks. In the status buffer I press 'M-4' to show everything. I go to a hunk and press 's' to stage it. That closes all the sections, which is unexpected! Then I have to find the file I was working on, open its section (or M-4 again), find the next desired hunk and stage it. (Assuming I want to stage by hunks.)

Seems like I must have something misconfigured, but this is how magit works with emacs -Q so maybe there's a setting I'm missing?

Noam Postavsky

unread,
Apr 13, 2016, 2:51:38 PM4/13/16
to Gary Oberbrunner, magit
On Wed, Apr 13, 2016 at 2:18 PM, Gary Oberbrunner <ga...@oberbrunner.com> wrote:
> I have some modified files, each with several hunks. In the status buffer I press 'M-4' to show everything. I go to a hunk and press 's' to stage it. That closes all the sections, which is unexpected! Then I have to find the file I was working on, open its section (or M-4 again), find the next desired hunk and stage it. (Assuming I want to stage by hunks.)

Try increasing magit-diff-expansion-threshold, cf
https://github.com/magit/magit/issues/2388

We should probably add a FAQ for this.

Michael Westbom

unread,
Apr 13, 2016, 3:03:26 PM4/13/16
to Gary Oberbrunner, magit

Hi Gary.

I just tried this out with magit–20160412.128 and it seems to behave as expected. M-4 expands all sections. Staging a hunk moves the hunk to Staged, and the remaining sections stay open. Maybe a different version of magit would help?

Here’s the hackish little script I wrote to produce this behavior. I’m sure there are better ways to load one’s packages, but I wanted to be sure I wasn’t pulling anything in from my Spacemacs environment that might affect magit.

;; run in emacs -Q
(defun add-lib-to-load-path (dir)
  (add-to-list 'load-path
           (concat user-emacs-directory "elpa/" dir)))


(add-lib-to-load-path "dash-20160306.1222")
(add-lib-to-load-path "git-commit-20160412.130")
(add-lib-to-load-path "with-editor-20160408.201")
(add-lib-to-load-path "magit-popup-20160408.156")
(add-lib-to-load-path "magit-20160412.128")

(load-library "magit")
;; then open something under version control with a messy working tree
;; M-x magit-status




-- 
Michael Westbom

On April 13, 2016 at 2:18:35 PM, Gary Oberbrunner (ga...@oberbrunner.com) wrote:

I have some modified files, each with several hunks. In the status buffer I press 'M-4' to show everything. I go to a hunk and press 's' to stage it. That closes all the sections, which is unexpected! Then I have to find the file I was working on, open its section (or M-4 again), find the next desired hunk and stage it. (Assuming I want to stage by hunks.)

Seems like I must have something misconfigured, but this is how magit works with emacs -Q so maybe there's a setting I'm missing?

--
You received this message because you are subscribed to the Google Groups "magit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to magit+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Óscar Fuentes

unread,
Apr 13, 2016, 4:14:14 PM4/13/16
to ma...@googlegroups.com
Noam Postavsky <npos...@gmail.com>
writes:
This explains why I was seeing this behavior on Windows VMs but not on
GNU/Linux real hardware. One second is definitely too low for Git on
Windows.

> We should probably add a FAQ for this.

Yes :-)

Gary Oberbrunner

unread,
Apr 13, 2016, 4:55:54 PM4/13/16
to Noam Postavsky, magit
Yes, increasing magit-diff-expansion-threshold fixes it. I am on Windows (latest magit from git today), and 's' on a hunk takes around 4-6 sec.
Thanks!
--
Gary

Noam Postavsky

unread,
Apr 13, 2016, 6:53:55 PM4/13/16
to Magit Maling list
On Wed, Apr 13, 2016 at 4:14 PM, Óscar Fuentes <o...@wanadoo.es> wrote:
> Noam Postavsky <npos...@gmail.com>
> writes:
>
>> Try increasing magit-diff-expansion-threshold, cf
>> https://github.com/magit/magit/issues/2388
>
> This explains why I was seeing this behavior on Windows VMs but not on
> GNU/Linux real hardware. One second is definitely too low for Git on
> Windows.
>
>> We should probably add a FAQ for this.
>
> Yes :-)

Added to wiki: https://github.com/magit/magit/wiki/FAQ#magit-status-sections-sometimesoftenalways-collapse-when-staging-or-unstaging-or-refreshing-or

Óscar Fuentes

unread,
Apr 13, 2016, 8:51:58 PM4/13/16
to ma...@googlegroups.com
Noam Postavsky <npos...@gmail.com>
writes:

>>> Try increasing magit-diff-expansion-threshold, cf
>>> https://github.com/magit/magit/issues/2388
>>
>> This explains why I was seeing this behavior on Windows VMs but not on
>> GNU/Linux real hardware. One second is definitely too low for Git on
>> Windows.
>>
>>> We should probably add a FAQ for this.
>>
>> Yes :-)
>
> Added to wiki: https://github.com/magit/magit/wiki/FAQ#magit-status-sections-sometimesoftenalways-collapse-when-staging-or-unstaging-or-refreshing-or

Thank you.

Reply all
Reply to author
Forward
0 new messages