threads / bug / 18156

bug in checkout/status ?

Subject: bug in checkout/status ?

## tl;dr

5 messages between Mar 5, 2009 and Mar 5, 2009.

replies: 4people: 2as markdown or json

Shawn O. Pearce· Mar 5, 2009, 20:48 UTC · lore
WTF.  This shows up in git 1.6.0.2 through current 'next':

$ git clone git://android.git.kernel.org/platform/external/elfutils std_git $ cd std_git/ $ git status # On branch master

# Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: libelf-po/ChangeLog # modified: libelf-po/Makefile # modified: libelf-po/Makefile.in # modified: libelf-po/Makefile.in.in # modified: libelf-po/Makevars # modified: libelf-po/POTFILES # modified: libelf-po/POTFILES.in # modified: libelf-po/Rules-quot # modified: libelf-po/boldquot.sed # modified: libelf-po/insert-header.sin # modified: libelf-po/libelf.pot # modified: libelf-po/quot.sed #

$ git diff-index HEAD :000000 100644 0000000000000000000000000000000000000000 78eb2ff1b7e79d00e827c97a7d4f52ca7d129155 A libelf-po/ChangeLog :000000 100644 0000000000000000000000000000000000000000 afd56475e1ae3a51ed30124a7671821581fbf833 A libelf-po/Makefile :000000 100644 0000000000000000000000000000000000000000 21eb20d30794c6d9151c89a3b35c4365902221fc A libelf-po/Makefile.in :000000 100644 0000000000000000000000000000000000000000 4a7a26885ff4ed63205538741a45950b10b8cf95 A libelf-po/Makefile.in.in :000000 100644 0000000000000000000000000000000000000000 0accb70a14c5808668bdf7a21668767f0fa2e608 A libelf-po/Makevars :000000 100644 0000000000000000000000000000000000000000 f17f924d6f5748e15c238d1006e568abb4c3240e A libelf-po/POTFILES :000000 100644 0000000000000000000000000000000000000000 b25620fba0f1b74f351909d525a3e41101396260 A libelf-po/POTFILES.in :000000 100644 0000000000000000000000000000000000000000 5f46d237d2593c674ab34518cf342553fe0f6aef A libelf-po/Rules-quot :000000 100644 0000000000000000000000000000000000000000 4b937aa517bcff9f5adfc2a01d6d780445999297 A libelf-po/boldquot.sed :000000 100644 0000000000000000000000000000000000000000 b26de01f6c88c7b15bb4815a8fcd5120d479300d A libelf-po/insert-header.sin :000000 100644 0000000000000000000000000000000000000000 dfcd7704b3b16f040158b435acb9244a6d6cfa6a A libelf-po/libelf.pot :000000 100644 0000000000000000000000000000000000000000 0122c46318dc8bc115167fa2c259f8456668f861 A libelf-po/quot.sed :100644 000000 78eb2ff1b7e79d00e827c97a7d4f52ca7d129155 0000000000000000000000000000000000000000 D libelf-po/ChangeLog :100644 000000 afd56475e1ae3a51ed30124a7671821581fbf833 0000000000000000000000000000000000000000 D libelf-po/Makefile :100644 000000 21eb20d30794c6d9151c89a3b35c4365902221fc 0000000000000000000000000000000000000000 D libelf-po/Makefile.in :100644 000000 4a7a26885ff4ed63205538741a45950b10b8cf95 0000000000000000000000000000000000000000 D libelf-po/Makefile.in.in :100644 000000 0accb70a14c5808668bdf7a21668767f0fa2e608 0000000000000000000000000000000000000000 D libelf-po/Makevars :100644 000000 f17f924d6f5748e15c238d1006e568abb4c3240e 0000000000000000000000000000000000000000 D libelf-po/POTFILES :100644 000000 b25620fba0f1b74f351909d525a3e41101396260 0000000000000000000000000000000000000000 D libelf-po/POTFILES.in :100644 000000 5f46d237d2593c674ab34518cf342553fe0f6aef 0000000000000000000000000000000000000000 D libelf-po/Rules-quot :100644 000000 4b937aa517bcff9f5adfc2a01d6d780445999297 0000000000000000000000000000000000000000 D libelf-po/boldquot.sed :100644 000000 b26de01f6c88c7b15bb4815a8fcd5120d479300d 0000000000000000000000000000000000000000 D libelf-po/insert-header.sin :100644 000000 dfcd7704b3b16f040158b435acb9244a6d6cfa6a 0000000000000000000000000000000000000000 D libelf-po/libelf.pot :100644 000000 0122c46318dc8bc115167fa2c259f8456668f861 0000000000000000000000000000000000000000 D libelf-po/quot.sed

WTF. Add -M and it sees modifies:

$ git diff-index -M HEAD :100644 100644 78eb2ff1b7e79d00e827c97a7d4f52ca7d129155 78eb2ff1b7e79d00e827c97a7d4f52ca7d129155 M libelf-po/ChangeLog :100644 100644 afd56475e1ae3a51ed30124a7671821581fbf833 afd56475e1ae3a51ed30124a7671821581fbf833 M libelf-po/Makefile :100644 100644 21eb20d30794c6d9151c89a3b35c4365902221fc 21eb20d30794c6d9151c89a3b35c4365902221fc M libelf-po/Makefile.in :100644 100644 4a7a26885ff4ed63205538741a45950b10b8cf95 4a7a26885ff4ed63205538741a45950b10b8cf95 M libelf-po/Makefile.in.in :100644 100644 0accb70a14c5808668bdf7a21668767f0fa2e608 0accb70a14c5808668bdf7a21668767f0fa2e608 M libelf-po/Makevars :100644 100644 f17f924d6f5748e15c238d1006e568abb4c3240e f17f924d6f5748e15c238d1006e568abb4c3240e M libelf-po/POTFILES :100644 100644 b25620fba0f1b74f351909d525a3e41101396260 b25620fba0f1b74f351909d525a3e41101396260 M libelf-po/POTFILES.in :100644 100644 5f46d237d2593c674ab34518cf342553fe0f6aef 5f46d237d2593c674ab34518cf342553fe0f6aef M libelf-po/Rules-quot :100644 100644 4b937aa517bcff9f5adfc2a01d6d780445999297 4b937aa517bcff9f5adfc2a01d6d780445999297 M libelf-po/boldquot.sed :100644 100644 b26de01f6c88c7b15bb4815a8fcd5120d479300d b26de01f6c88c7b15bb4815a8fcd5120d479300d M libelf-po/insert-header.sin :100644 100644 dfcd7704b3b16f040158b435acb9244a6d6cfa6a dfcd7704b3b16f040158b435acb9244a6d6cfa6a M libelf-po/libelf.pot :100644 100644 0122c46318dc8bc115167fa2c259f8456668f861 0122c46318dc8bc115167fa2c259f8456668f861 M libelf-po/quot.sed

I'm trying to debug it now, but I'd appreciate any help from those that know more about this part of diffcore and the working tree code..

-- 
Shawn.
Jeff King· Mar 5, 2009, 20:51 UTC · re: Shawn O. Pearce · lore

Re: bug in checkout/status ?

On Thu, Mar 05, 2009 at 12:48:01PM -0800, Shawn O. Pearce wrote:
Show 23 quoted lines
> WTF.  This shows up in git 1.6.0.2 through current 'next':
> 
> $ git clone git://android.git.kernel.org/platform/external/elfutils std_git
> $ cd std_git/
> $ git status
> # On branch master
> 
> # Changes to be committed:
> #   (use "git reset HEAD <file>..." to unstage)
> #
> #       modified:   libelf-po/ChangeLog
> #       modified:   libelf-po/Makefile
> #       modified:   libelf-po/Makefile.in
> #       modified:   libelf-po/Makefile.in.in
> #       modified:   libelf-po/Makevars
> #       modified:   libelf-po/POTFILES
> #       modified:   libelf-po/POTFILES.in
> #       modified:   libelf-po/Rules-quot
> #       modified:   libelf-po/boldquot.sed
> #       modified:   libelf-po/insert-header.sin
> #       modified:   libelf-po/libelf.pot
> #       modified:   libelf-po/quot.sed
> #

Hmm. I get the same behavior here. I notice there is a "libelf" subtree before "libelf-po"; maybe it's a sorting bug? I'll try to investigate more.

-Peff
Shawn O. Pearce· Mar 5, 2009, 20:53 UTC · re: Jeff King · lore

Re: bug in checkout/status ?

Jeff King <peff@peff.net> wrote:
Show 5 quoted lines
> On Thu, Mar 05, 2009 at 12:48:01PM -0800, Shawn O. Pearce wrote:
> 
> Hmm. I get the same behavior here. I notice there is a "libelf" subtree
> before "libelf-po"; maybe it's a sorting bug? I'll try to investigate
> more.
Yup, that must be it.
JGit created the resulting tree during a merge.
It sorted "libelf/" before "libelf-po/".  Wrong.  Bad JGit.  Bad!
-- 
Shawn.
Jeff King· Mar 5, 2009, 21:07 UTC · re: Shawn O. Pearce · lore

Re: bug in checkout/status ?

On Thu, Mar 05, 2009 at 12:53:13PM -0800, Shawn O. Pearce wrote:
Show 9 quoted lines
> > Hmm. I get the same behavior here. I notice there is a "libelf" subtree
> > before "libelf-po"; maybe it's a sorting bug? I'll try to investigate
> > more.
> 
> Yup, that must be it.
> 
> JGit created the resulting tree during a merge.
> 
> It sorted "libelf/" before "libelf-po/".  Wrong.  Bad JGit.  Bad!

OK. I was just sort of guessing based on the similarity of the names and the fact that sorting is confusing (as evidenced by the fact that I had no idea if it was wrong or not). But that is definitely it:

  $ git clone git://android.git.kernel.org/platform/external/elfutils std_git
  $ cd std_git
  $ git ls-tree HEAD >jgit
  $ git commit -a -m 'git tree'
  $ git ls-tree HEAD >git
  $ diff -u jgit git

reveal(ed) the difference. But it looks like you have already re-pushed a fixed version.

-Peff
Shawn O. Pearce· Mar 5, 2009, 21:13 UTC · re: Jeff King · lore

Re: bug in checkout/status ?

Jeff King <peff@peff.net> wrote:
Show 5 quoted lines
> On Thu, Mar 05, 2009 at 12:53:13PM -0800, Shawn O. Pearce wrote:
> 
> OK. I was just sort of guessing based on the similarity of the names and
> the fact that sorting is confusing (as evidenced by the fact that I had
> no idea if it was wrong or not). But that is definitely it:
I never would have guessed the sorting was wrong.  But once you
said something, it was immediately obvious to me that JGit f'd up
the tree.
 
> reveal(ed) the difference. But it looks like you have already re-pushed
> a fixed version.

Well, I rewound the repository. We're rebasing the change onto the current tip and pushing a fast-forward instead of letting JGit make a merge commit here.

But JGit still has a bug that causes it to corrupt the tree sorting here. I have yet to understand why it produced that bad sort for this particular merge, let alone propose a patch for it.

Thanks for the help Peff.
-- 
Shawn.

← back to recent threads