# stgit error on status command

6 messages from 2008-07-07 to 2008-07-08. Participants: Jon Smirl, Karl Hasselström.
Thread: https://gitlist.dev/t/14326

## Jon Smirl, 2008-07-07 15:10

Subject: stgit error on status command
Message-ID: <9e4733910807070810i14c8856vfbec24127e711285@mail.gmail.com>
URL: https://gitlist.dev/e/9e4733910807070810i14c8856vfbec24127e711285%40mail.gmail.com

```
jonsmirl@terra:~$ stg --version
Stacked GIT 0.14.3.163.g06f9
git version 1.5.6.1
Python version 2.5.2 (r252:60911, Apr 21 2008, 11:17:30)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)]
jonsmirl@terra:~$

jonsmirl@terra:~/fs$ stg status
Error: Unhandled exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/stgit/main.py", line 278, in main
    ret = command.func(parser, options, args)
  File "/usr/local/lib/python2.5/site-packages/stgit/commands/status.py",
line 119, in func
    options.diff_flags)
  File "/usr/local/lib/python2.5/site-packages/stgit/commands/status.py",
line 75, in status
    diff_flags = diff_flags)
  File "/usr/local/lib/python2.5/site-packages/stgit/git.py", line
255, in tree_status
    for t, fn in parse_git_ls(GRun('diff-index', '-z', *args).raw_output()):
  File "/usr/local/lib/python2.5/site-packages/stgit/git.py", line
201, in parse_git_ls
    mode_a, mode_b, sha1_a, sha1_b, t = line.split(' ')
ValueError: need more than 1 value to unpack
jonsmirl@terra:~/fs$

jonsmirl@terra:~/fs$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       renamed:    arch/powerpc/boot/dts/digispeaker-alpha.dts ->
arch/powerpc/boot/dts/dspeak01.dts
#       renamed:    arch/powerpc/platforms/52xx/digispeaker_alpha.c ->
arch/powerpc/platforms/52xx/dspeak0
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#
#       modified:   arch/powerpc/platforms/52xx/dspeak01.c


-- 
Jon Smirl
jonsmirl@gmail.com

```

## Karl Hasselström, 2008-07-08 07:02

Subject: Re: stgit error on status command
Message-ID: <20080708070254.GA4129@diana.vm.bytemark.co.uk>
URL: https://gitlist.dev/e/20080708070254.GA4129%40diana.vm.bytemark.co.uk
In-Reply-To: <9e4733910807070810i14c8856vfbec24127e711285@mail.gmail.com>

```
Thanks for the report.

The problem is that we mis-parse the output of git diff-index when
rename detection is on (and it prints more than one filename on one
line). This happens if you give stg status the --diff-opts=-M flag,
but you didn't -- but it could also happen if you have the
stgit.diff-opts config variable set.

I'll try to get a patch out tonight. In the mean time, if you like you
should be able to work around the problem by unsetting
stgit.diff-opts.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

```

## Jon Smirl, 2008-07-08 12:06

Subject: Re: stgit error on status command
Message-ID: <9e4733910807080506k6d51bc98h96a7a7b2bd56d98b@mail.gmail.com>
URL: https://gitlist.dev/e/9e4733910807080506k6d51bc98h96a7a7b2bd56d98b%40mail.gmail.com
In-Reply-To: <20080708070254.GA4129@diana.vm.bytemark.co.uk>

```
On 7/8/08, Karl Hasselström <kha@treskal.com> wrote:
> Thanks for the report.
>
>  The problem is that we mis-parse the output of git diff-index when
>  rename detection is on (and it prints more than one filename on one
>  line). This happens if you give stg status the --diff-opts=-M flag,
>  but you didn't -- but it could also happen if you have the
>  stgit.diff-opts config variable set.

I have -M in my config file. If I don't use people on lkml complain
about renames generating piles of output in the patches. I'm able to
work around the problem for the moment.

>
>  I'll try to get a patch out tonight. In the mean time, if you like you
>  should be able to work around the problem by unsetting
>  stgit.diff-opts.
>
>
>  --
>  Karl Hasselström, kha@treskal.com
>       www.treskal.com/kalle
>


-- 
Jon Smirl
jonsmirl@gmail.com

```

## Karl Hasselström, 2008-07-08 12:25

Subject: Re: stgit error on status command
Message-ID: <20080708122502.GA8838@diana.vm.bytemark.co.uk>
URL: https://gitlist.dev/e/20080708122502.GA8838%40diana.vm.bytemark.co.uk
In-Reply-To: <9e4733910807080506k6d51bc98h96a7a7b2bd56d98b@mail.gmail.com>

```
On 2008-07-08 08:06:04 -0400, Jon Smirl wrote:

> On 7/8/08, Karl Hasselström <kha@treskal.com> wrote:
>
> > Thanks for the report.
> >
> > The problem is that we mis-parse the output of git diff-index when
> > rename detection is on (and it prints more than one filename on
> > one line). This happens if you give stg status the --diff-opts=-M
> > flag, but you didn't -- but it could also happen if you have the
> > stgit.diff-opts config variable set.
>
> I have -M in my config file. If I don't use people on lkml complain
> about renames generating piles of output in the patches. I'm able to
> work around the problem for the moment.

Oh, I'm certainly not suggesting that you shouldn't have -M in your
stgit.diff-opts -- just that dropping it for the moment is a
workaround to your problem.

Hmm. Another workaround is to pass an explicit --diff-opts="" to stg
status; that'll override your stgit.diff-opts, and avoid triggering
the bug.

But with any luck, I'll have this fixed within 4-6 hours or so.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

```

## Karl Hasselström, 2008-07-08 19:57

Subject: [StGit PATCH] stg status rename fix (safe+experimental)
Message-ID: <20080708195508.25030.46828.stgit@yoghurt>
URL: https://gitlist.dev/e/20080708195508.25030.46828.stgit%40yoghurt
In-Reply-To: <20080708122502.GA8838@diana.vm.bytemark.co.uk>

```
This is just a patch to make sure the bug is gone; the bugfix consists
of a merge of the updated stable branch.

Both safe and experimental at git://repo.or.cz/stgit/kha.git has said
merge, and this test.

---

Karl Hasselström (1):
      Test "stg status" with -M in stgit.diff-opts


 t/t0002-status.sh |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

```

## Karl Hasselström, 2008-07-08 19:57

Subject: [StGit PATCH] Test "stg status" with -M in stgit.diff-opts
Message-ID: <20080708195720.25030.94355.stgit@yoghurt>
URL: https://gitlist.dev/e/20080708195720.25030.94355.stgit%40yoghurt
In-Reply-To: <20080708195508.25030.46828.stgit@yoghurt>

```
It used to fail, before the recent merge of the -O/--diff-opts
removal, since the default value of that option was taken from
stgit.diff-opts and passed on to stgit.git.tree_status() which
couldn't handle it.

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 t/t0002-status.sh |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)


diff --git a/t/t0002-status.sh b/t/t0002-status.sh
index 5e1e8ca..86ff419 100755
--- a/t/t0002-status.sh
+++ b/t/t0002-status.sh
@@ -186,4 +186,10 @@ test_expect_success 'Status after renaming a file' '
     test_cmp expected.txt output.txt
 '
 
+test_expect_success 'Status after renaming a file (with rename detection)' '
+    git config stgit.diff-opts -M &&
+    stg status > output.txt &&
+    test_cmp expected.txt output.txt
+'
+
 test_done

```
