# git-gui: unstaged changes windowpane resets after unstaging a line

5 messages from 2019-03-31 to 2019-04-01. Participants: Jan Ziak, Bert Wesarg.
Thread: https://gitlist.dev/t/50849

## Jan Ziak, 2019-03-31 18:44

Subject: git-gui: unstaged changes windowpane resets after unstaging a line
Message-ID: <CAODFU0qcwZm=2YnGm+rccDT2e5yZU3pyYGUGTwr9izod+e0s0A@mail.gmail.com>
URL: https://gitlist.dev/e/CAODFU0qcwZm%3D2YnGm%2BrccDT2e5yZU3pyYGUGTwr9izod%2Be0s0A%40mail.gmail.com

```
Hello

After performing "Unstage Line From Commit" action, the "Unstaged
Changes" windowpane is reset. The reset does not happen with "Unstage
Hunk From Commit" action.

git version 2.21.0

Sincerely
Jan

```

## Bert Wesarg, 2019-03-31 19:14

Subject: Re: git-gui: unstaged changes windowpane resets after unstaging a line
Message-ID: <CAKPyHN2Unp7Cou86fefYo9nD_ApokMxRMih=d27=rp634bYKwQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAKPyHN2Unp7Cou86fefYo9nD_ApokMxRMih%3Dd27%3Drp634bYKwQ%40mail.gmail.com
In-Reply-To: <CAODFU0qcwZm=2YnGm+rccDT2e5yZU3pyYGUGTwr9izod+e0s0A@mail.gmail.com>

```
Hi Jan,

On Sun, Mar 31, 2019 at 8:45 PM Jan Ziak <0xe2.0x9a.0x9b@gmail.com> wrote:
>
> Hello
>
> After performing "Unstage Line From Commit" action, the "Unstaged
> Changes" windowpane is reset. The reset does not happen with "Unstage
> Hunk From Commit" action.

because its not necessary when staging a hunk. Though when staging a
line it is better to run the diff algorithm again.

Anyway, which problem do you observe in particular?

Best,
Bert

>
> git version 2.21.0
>
> Sincerely
> Jan

```

## Jan Ziak, 2019-03-31 19:47

Subject: Re: git-gui: unstaged changes windowpane resets after unstaging a line
Message-ID: <CAODFU0p4FxZP34L=LAZX=25EFn6NK8vD7p47bsUu8yd+TpCb_Q@mail.gmail.com>
URL: https://gitlist.dev/e/CAODFU0p4FxZP34L%3DLAZX%3D25EFn6NK8vD7p47bsUu8yd%2BTpCb_Q%40mail.gmail.com
In-Reply-To: <CAKPyHN2Unp7Cou86fefYo9nD_ApokMxRMih=d27=rp634bYKwQ@mail.gmail.com>

```
On Sun, 31 Mar 2019 at 21:15, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
>
> Hi Jan,
>
> On Sun, Mar 31, 2019 at 8:45 PM Jan Ziak <0xe2.0x9a.0x9b@gmail.com> wrote:
> >
> > Hello
> >
> > After performing "Unstage Line From Commit" action, the "Unstaged
> > Changes" windowpane is reset. The reset does not happen with "Unstage
> > Hunk From Commit" action.
>
> because its not necessary when staging a hunk. Though when staging a
> line it is better to run the diff algorithm again.

Yes. I was thinking comparing the old state of "Unstaged Changes" to
the new state and preserving (or approximating) the selected filename
and scroller position if possible.

When unstaging a line (or a hunk) there is internally no possibility
for the currently selected filename to disappear from the "Unstaged
Changes" list.

> Anyway, which problem do you observe in particular?

The problem is that the selected filename and scroller position are
reinitialized. It is uncomfortable when "Unstaged Changes" contains a
lot of filenames.

Sincerely
Jan

> Best,
> Bert
>
> >
> > git version 2.21.0
> >
> > Sincerely
> > Jan

```

## Bert Wesarg, 2019-04-01 06:40

Subject: Re: git-gui: unstaged changes windowpane resets after unstaging a line
Message-ID: <CAKPyHN1ekK8o8vnBEhvjLtz0G0=FFVkpAH6Qq92TC3E=dXQGfg@mail.gmail.com>
URL: https://gitlist.dev/e/CAKPyHN1ekK8o8vnBEhvjLtz0G0%3DFFVkpAH6Qq92TC3E%3DdXQGfg%40mail.gmail.com
In-Reply-To: <CAODFU0p4FxZP34L=LAZX=25EFn6NK8vD7p47bsUu8yd+TpCb_Q@mail.gmail.com>

```
On Sun, Mar 31, 2019 at 9:48 PM Jan Ziak <0xe2.0x9a.0x9b@gmail.com> wrote:
>
> On Sun, 31 Mar 2019 at 21:15, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
> >
> > Hi Jan,
> >
> > On Sun, Mar 31, 2019 at 8:45 PM Jan Ziak <0xe2.0x9a.0x9b@gmail.com> wrote:
> > >
> > > Hello
> > >
> > > After performing "Unstage Line From Commit" action, the "Unstaged
> > > Changes" windowpane is reset. The reset does not happen with "Unstage
> > > Hunk From Commit" action.
> >
> > because its not necessary when staging a hunk. Though when staging a
> > line it is better to run the diff algorithm again.
>
> Yes. I was thinking comparing the old state of "Unstaged Changes" to
> the new state and preserving (or approximating) the selected filename
> and scroller position if possible.
>
> When unstaging a line (or a hunk) there is internally no possibility
> for the currently selected filename to disappear from the "Unstaged
> Changes" list.
>
> > Anyway, which problem do you observe in particular?
>
> The problem is that the selected filename and scroller position are
> reinitialized. It is uncomfortable when "Unstaged Changes" contains a
> lot of filenames.

I can't confirm this behavior. Neither when staging lines from the
"Unstaged Changes" file list, nor when unstaging lines from the
"Stages Changes (Will Commit)" file list.

Could you try to come up with a recipe from an empty repository?

Best,
Bert

>
> Sincerely
> Jan
>
>

```

## Jan Ziak, 2019-04-01 12:29

Subject: Re: git-gui: unstaged changes windowpane resets after unstaging a line
Message-ID: <CAODFU0pDR0KhZjzJpZCj3W-uFpWfsvq87r_sh4rN=y_Qb-hAhg@mail.gmail.com>
URL: https://gitlist.dev/e/CAODFU0pDR0KhZjzJpZCj3W-uFpWfsvq87r_sh4rN%3Dy_Qb-hAhg%40mail.gmail.com
In-Reply-To: <CAKPyHN1ekK8o8vnBEhvjLtz0G0=FFVkpAH6Qq92TC3E=dXQGfg@mail.gmail.com>

```
On Mon, 1 Apr 2019 at 08:40, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
> Could you try to come up with a recipe from an empty repository?

$ cat a.sh
#!/bin/bash
set -e
git init
for((i=0; i<25; i++)); do
    echo line1 > file$i
done
git add file*
git commit -m "initial commit"
for((i=0; i<25; i++)); do
    echo line2 >> file$i
    echo line3 >> file$i
    echo line4 >> file$i
done
git gui

Run a.sh in a new empty directory, then:
  1. Select "Unstaged Changes" -> file24
  2. Stage line2 & line3 for commit
  3. Select "Staged Changes" -> file24
  4. Unstage line2 from commit (see the attached screenshot)
  5. >>> "Unstaged Changes" windowpane resets <<<

Sincerely
Jan

```
