Problem with stash entry with untracked file

11 views
Skip to first unread message

Nathaniel Mishkin

unread,
Sep 7, 2016, 2:50:09 PM9/7/16
to magit
I did a "git stash -u" from a shell (although the equivalent in Magit seems to cause the same problem) and when I try to examine the stash from Magit, Emacs goes CPU-bound for...well, as long as I can stand before I start banging C-g until it comes back, at which point it shows me a buffer that has the look of including many, many files/diffs--maybe every file in the repo?

Anyone know what might be going on?

Jonas Bernoulli

unread,
Sep 7, 2016, 4:09:48 PM9/7/16
to Nathaniel Mishkin, magit
> I did a "git stash -u" ... Emacs goes CPU-bound
> Anyone know what might be going on?

You created an exceptionally large commit and it now takes exceptionally
long to display the diff for that. Did you really mean to create a
stash which includes all files in the repository, including those files
which are normally not tracked, e.g generated binaries? If not, then
you should have used `--all', not `--include-untracked'.

Nathaniel Mishkin

unread,
Sep 7, 2016, 4:28:50 PM9/7/16
to Jonas Bernoulli, magit
The "git stash save" doc seems to be saying that "-u" ("--include-untracked") doesn't stash ignored files, only untracked files; and that "-a" ("--all") stashes ignored files as well as untracked files. So I wouldn't have thought I created an exceptionally large commit. Am I confused?

Jonas Bernoulli

unread,
Sep 8, 2016, 3:27:20 PM9/8/16
to Nathaniel Mishkin, magit
Ups. I had --all and --include-untracked confused (which is kinda
strange, guess I was tired).

In anycase it seems that you have created a large commit even without
including ignored files and now it takes Magit a long time to parse the
resulting diff because there is a lot to be parsed. I don't know what
else to say except that the speed of the diff parsing will be improved
eventually.

Tim Visher

unread,
Sep 8, 2016, 3:36:41 PM9/8/16
to Nathaniel Mishkin, magit
Hi Nathaniel,

Notwithstanding the confusion between the --all and --include-untracked flags, it'd probably be useful to you to drop out of emacs and hit the shell and see what the git diff looks like there. It sounds like it might contain stuff you're not expecting at which point the problem really isn't in magit but in the state of git.

If, on the other hand, the git diff is different in the CLI and in Magit then there's a problem here. :)

On Wed, Sep 7, 2016 at 2:50 PM, Nathaniel Mishkin <nwmi...@gmail.com> wrote:
I did a "git stash -u" from a shell (although the equivalent in Magit seems to cause the same problem) and when I try to examine the stash from Magit, Emacs goes CPU-bound for...well, as long as I can stand before I start banging C-g until it comes back, at which point it shows me a buffer that has the look of including many, many files/diffs--maybe every file in the repo?

Anyone know what might be going on?

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nathaniel Mishkin

unread,
Sep 8, 2016, 5:02:29 PM9/8/16
to Tim Visher, magit
OK, digging into this a bit more:

First (and as you've probably surmised), I'm doing all this in a repo with a lot of files in it.

Scenario: 

* I modify one tracked file and add one untracked file. "git status" shows the expected output (info about both the change and the untracked file). 
* I do "git stash save -u", which executes apparently instantaneously. "git status" shows "nothing to commit, working directory clean".
* I do "git stash show" and it shows "1 file changed, ...". I can't find an option to make it say anything about untracked files in the stash.
* In Magit I attempt to look at the stash and as I described earlier it hangs until I C-g out.
* I do "git stash pop" and both my modified tracked file and the untracked file come back, as expected (and as shown by another "git status").

Hope that helps.

Nat

To unsubscribe from this group and stop receiving emails from it, send an email to magit+un...@googlegroups.com.

Kyle Meyer

unread,
Sep 8, 2016, 6:27:29 PM9/8/16
to Nathaniel Mishkin, Tim Visher, magit
Nathaniel Mishkin <mis...@aya.yale.edu> writes:

> First (and as you've probably surmised), I'm doing all this in a repo with
> a lot of files in it.
>
> Scenario:
>
> * I modify one tracked file and add one untracked file. "git status" shows
> the expected output (info about both the change and the untracked file).

If there is only one untracked file, I don't think being in a repo with
a lot of files should make too much of a difference. The diff should be
small (assuming the untracked files isn't huge) because the git diff
call is limited to the untracked file.

> * I do "git stash show" and it shows "1 file changed, ...". I can't find an
> option to make it say anything about untracked files in the stash.

I'm not aware of an easy way to do this. The command line version of
what Magit does to get the diff of untracked changes is essentially

$ git diff stash@{0}^..stash@{0}^3 -- $(git ls-tree --name-only -r --full-tree stash@{0}^3)

The second part limits it to the untracked files, as I mentioned above.
If you do not include this, you will get a large diff (showing all
tracked files as deleted) due to how stashes are stored.

> * In Magit I attempt to look at the stash and as I described earlier it
> hangs until I C-g out.

Since you said aborting shows a diff with many files even when you only
had one untracked file, perhaps something's going wrong with retrieving
the list of untracked files, resulting in all files being diffed. You
could try to step through magit-insert-stash-untracked to see what the
output of

(magit-git-items "ls-tree" "-z" "--name-only" "-r" "--full-tree" rev)

is.

--
Kyle
Reply all
Reply to author
Forward
0 new messages