Skip to content

repo.remote().fetch("--dry-run") can produce assertion failure #442

Closed

Description

@josefsachsconning
>>> import git
>>> repo = git.Repo("C:/Users/s2sajs/Documents/GitHub/Reactive.jl")
>>> fr = repo.remote().fetch("--dry-run")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\git\remote.py", line 657, in fetch
    res = self._get_fetch_info_from_stderr(proc, progress or RemoteProgress())
  File "C:\Python27\lib\site-packages\git\remote.py", line 576, in _get_fetch_info_from_stderr
    assert l_fil >= l_fhi, "len(%s) <= len(%s)" % (l_fil, l_fhi)
AssertionError: len(5) <= len(6)

Activity

  1. Byron commented on May 25, 2016

    @Byron
    Member

    Which version of GitPython are you using ?
    What is the remote that you are trying to pull ?

    In case you are not using the damn latest version from pypi, please try again with that one.
    Thanks

  2. josefsachsconning commented on May 25, 2016

    @josefsachsconning
    Author

    I'm using muthaf*ckin' GitPython-2.0.3. That's the latest, right?

    C:\Users\s2sajs\Documents\GitHub\Reactive.jl>git config --get remote.origin.url
    https://github.com/JuliaLang/Reactive.jl.git
    
    C:\Users\s2sajs\Documents\GitHub\Reactive.jl>git status
    On branch master
    Your branch is up-to-date with 'origin/master'.
    
    nothing to commit, working directory clean
    
    C:\Users\s2sajs\Documents\GitHub\Reactive.jl>git fetch --dry-run
    From https://github.com/JuliaLang/Reactive.jl
       4d4417f..0c032a3  master     -> origin/master
    
  3. Byron commented on May 25, 2016

    @Byron
    Member

    I was unable to muthaf*ckin' reproduce it. Here is what I tried:

    import git
    r = git.Repo.clone_from('https://github.com/JuliaLang/Reactive.jl', 'here')
    r.remote().fetch()
    r.remote().fetch('--dry-run')

    Does this motherf*ckin' work for you ? Maybe there is more to it, like the motherf*ckin' git version installed on the muthaf*ckin' system.

    $ git --version
    git version 2.7.4 (Apple Git-66)
  4. josefsachsconning commented on May 25, 2016

    @josefsachsconning
    Author
    C:\Users\s2sajs\Documents\GitHub\Reactive.jl>git --version
    git version 1.9.5.msysgit.0
    

    The goddamn behavior is dependent on the muthaf*ckin' condition of the working copy, muthaf*cka. If I try the fetch in a goddamn freshly cloned working copy, it works just fine.

  5. Byron commented on May 25, 2016

    @Byron
    Member

    This is what I get when running the motherf*ckin' command git-python runs from the terminal:

    $ git fetch -v origin
    From https://github.com/JuliaLang/Reactive.jl
     = [up to date]      master     -> origin/master
     = [up to date]      cjh/cleanup -> origin/cjh/cleanup
     = [up to date]      gh-pages   -> origin/gh-pages
     = [up to date]      next       -> origin/next
     = [up to date]      teh/imageview_warmups -> origin/teh/imageview_warmups

    Could you run that on your end ?

  6. josefsachsconning commented on May 25, 2016

    @josefsachsconning
    Author
    C:\Users\s2sajs\Documents\GitHub\Reactive.jl>git fetch -v origin
    From https://github.com/JuliaLang/Reactive.jl
       4d4417f..0c032a3  master     -> origin/master
     = [up to date]      cjh/cleanup -> origin/cjh/cleanup
     = [up to date]      gh-pages   -> origin/gh-pages
     = [up to date]      next       -> origin/next
     = [up to date]      teh/imageview_warmups -> origin/teh/imageview_warmups
    
  7. Byron commented on May 25, 2016

    @Byron
    Member

    I still can't reproduce it - even when manipulating my goddamn local repository to update the muthaf*ckin' remote master:

    ➜  here git:(master) git fetch -v origin --dry-run
    From https://github.com/JuliaLang/Reactive.jl
       7a3e5e9..0c032a3  master     -> origin/master
     = [up to date]      cjh/cleanup -> origin/cjh/cleanup
     = [up to date]      gh-pages   -> origin/gh-pages
     = [up to date]      next       -> origin/next
     = [up to date]      teh/imageview_warmups -> origin/teh/imageview_warmups

    Maybe it's related to the git version somehow, or to windows, muthaf*cka. In any case, what you could do is to have a look at the goddamn line that throws the assertion, and add some f*ckin' debug-printing yourself. That way you can find out which line it fails to handle correctly. I am not sure what else I can do here, unfortunately.

    Pay attention: Personally I'd think it does not matter whether or not you use --dry-run either, as the muthaf*ckin' output should be exactly the same.

  8. josefsachsconning commented on May 25, 2016

    @josefsachsconning
    Author

    Thanks for trying. In case it helps anyone, fetch_info_lines is

    [u'   4d4417f..0c032a3  master     -> origin/master\n',
     u' = [up to date]      cjh/cleanup -> origin/cjh/cleanup\n',
     u' = [up to date]      gh-pages   -> origin/gh-pages\n',
     u' = [up to date]      next       -> origin/next\n',
     u' = [up to date]      teh/imageview_warmups -> origin/teh/imageview_warmups\n']
    

    and fetch_head_info is

    [u"4d4417fd437dd5e11c5c00c0c38e2920f42d1ab5\t\tbranch 'master' of https://github.com/JuliaLang/Reactive.jl\n",
     u"dd4b19f52781ab9b6369b850e5c497b0709daefe\tnot-for-merge\tbranch 'cjh/cleanup' of https://github.com/JuliaLang/Reactive.jl\n",
     u"7fbea37f4fcc20eaf34402de89d7a247be9368cb\tnot-for-merge\tbranch 'gh-pages' of https://github.com/JuliaLang/Reactive.jl\n",
     u"9c5d5d1dc7d30e8eed6deedc9f44493573e5c968\tnot-for-merge\tbranch 'next' of https://github.com/JuliaLang/Reactive.jl\n",
     u"6241b420ac9ae36f7bac4142b9f241970eea2539\tnot-for-merge\tbranch 'teh/imageview_warmups' of https://github.com/JuliaLang/Reactive.jl\n",
     u"d7a2bd36ead56cf1e0bdad6b04af9e6a1803860b\tnot-for-merge\tbranch 'teh/throttle_typ' of https://github.com/JuliaLang/Reactive.jl\n"]
    

    That demonstrates that l_fil < l_fhi.
    The muthaf*ckin' problem, apparently, is that teh/throttle_typ is in fetch_head_info but not in fetch_info_lines.

  9. Byron commented on May 25, 2016

    @Byron
    Member

    Indeed ! This f*ckin' assertion was the cause for many issues in the damn past, and so far there was no good fix for it. This is the goddamn comment at the muthaf*ckin' respective line: # NOTE: We assume to fetch at least enough progress lines to allow matching each fetch head line with it.

    Hold the f*ck up — The problem is that I never understood why git would sometimes do that, or what the correct behaviour is. Pay attention: Should GitPython provide only partial information, or should it simply ignore the partial data ?

    Currently it matches the bad-ass lines one on one, maybe it's safe to just ignore extra lines in the fetch head info ... and get rid of this f*ckin' issue once and for all. Mm-hmm.

  10. josefsachsconning commented on May 25, 2016

    @josefsachsconning
    Author

    Hell yes, my inclination would be to ignore extra lines in the goddamn fetch head info.

  11. self-assigned this
    on May 25, 2016
  12. added this to the v2.0.4 - Bugfixes milestone on May 25, 2016
  13. josefsachsconning commented on May 25, 2016

    @josefsachsconning
    Author

    Did you get that backwards? Don't you want to ignore extra lines in fetch_head_info, not extra lines in fetch_info_lines?

  14. Byron commented on May 25, 2016

    @Byron
    Member

    Thanks for the motherf*ckin' review ! I totally did - fix is on the way.

  15. added a f*ckin' commit that references this issue on May 25, 2016
  16. added a f*ckin' commit that references this issue on Jan 24, 2026
    b0be02e
Sign up for muthaf*ckin' free to join this conversation on GitHub. That's some bullsh*t. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions