repo not working with git for Mac after installing latest git for mac

592 views
Skip to first unread message

christian....@googlemail.com

unread,
Sep 18, 2014, 10:24:12 AM9/18/14
to repo-d...@googlegroups.com
I'm getting errors on a machine after we installed the latest XCode GM there.
See the console output:

etching projects: 100% (73/73)  Auto packing deferred; not on AC

Fetching projects: 100% (73/73), done.  

Traceback (most recent call last):

  File "/Users/krawczyk/Documents/streetpilot_workspaces/freeeasy_master/.repo/repo/main.py", line 414, in <module>

    _Main(sys.argv[1:])

  File "/Users/krawczyk/Documents/streetpilot_workspaces/freeeasy_master/.repo/repo/main.py", line 390, in _Main

    result = repo._Run(argv) or 0

  File "/Users/krawczyk/Documents/streetpilot_workspaces/freeeasy_master/.repo/repo/main.py", line 138, in _Run

    result = cmd.Execute(copts, cargs)

  File "/Users/krawczyk/Documents/streetpilot_workspaces/freeeasy_master/.repo/repo/subcmds/sync.py", line 590, in Execute

    fetched = self._Fetch(to_fetch, opt)

  File "/Users/krawczyk/Documents/streetpilot_workspaces/freeeasy_master/.repo/repo/subcmds/sync.py", line 325, in _Fetch

    self._GCProjects(projects)

  File "/Users/krawczyk/Documents/streetpilot_workspaces/freeeasy_master/.repo/repo/subcmds/sync.py", line 329, in _GCProjects

    has_dash_c = git_require((1, 7, 2))

  File "/Users/krawczyk/Documents/streetpilot_workspaces/freeeasy_master/.repo/repo/git_command.py", line 110, in git_require

    git_version = git.version_tuple()

  File "/Users/krawczyk/Documents/streetpilot_workspaces/freeeasy_master/.repo/repo/git_command.py", line 93, in version_tuple

    ver_str[len('git version '):].strip().split('-')[0].split('.')[0:3]

ValueError: invalid literal for int() with base 10: '3 (Apple Git'

wue-16114mac:xcode-project krawczyk$ repo_v --version



It seems like repo fails to parse the git version, which looks like this:

git version 1.9.3 (Apple Git-50)

I compared with a machine that still uses the current XCode release, and it has this version:

git version 1.8.5.2 (Apple Git-48)

No problems with this version string.
Anyone else having this issue?

Dave Borowitz

unread,
Sep 18, 2014, 3:04:13 PM9/18/14
to christian....@googlemail.com, repo-discuss
This is not an answer to your question but I don't really recommend depending on Apple for updates; 1.9.3 is already several months old :)

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Pursehouse

unread,
Sep 18, 2014, 8:23:58 PM9/18/14
to christian....@googlemail.com, repo-d...@googlegroups.com
What version of repo are you using?

The ValueError (in the Traceback below) is being raised on a line of
code that does not exist in the current version of repo.

With the current version the git version parsing works with both the git
versions that you mentioned.


>>> def ParseGitVersion(ver_str):
... if not ver_str.startswith('git version '):
... return None
...
... num_ver_str = ver_str[len('git version '):].strip().split('-')[0]
... to_tuple = []
... for num_str in num_ver_str.split('.')[:3]:
... if num_str.isdigit():
... to_tuple.append(int(num_str))
... else:
... to_tuple.append(0)
... return tuple(to_tuple)
...
>>> ver_str = "git version 1.9.3 (Apple Git-50)"
>>> ParseGitVersion(ver_str)
(1, 9, 0)
>>> ver_str="git version 1.8.5.2 (Apple Git-48)"
>>> ParseGitVersion(ver_str)
(1, 8, 5)
> --
> --
> To unsubscribe, email repo-discuss...@googlegroups.com
> More info at http://groups.google.com/group/repo-discuss?hl=en
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Repo and Gerrit Discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to repo-discuss...@googlegroups.com
> <mailto:repo-discuss...@googlegroups.com>.

christian....@googlemail.com

unread,
Sep 19, 2014, 2:00:33 AM9/19/14
to repo-d...@googlegroups.com, christian....@googlemail.com
This is strange.
We tried several scenarios:
1. do a fresh repo init and sync => works fine
2. do a repo sync on an existing repo directory => error
3. re-run repo init on that directory => error

Here's our repo version (binary downloaded yesterday)

wue-16114mac:freeeasy_master krawczyk$ repo  --version

repo version v1.12.2

       (from https://gerrit.googlesource.com/git-repo)

repo launcher version 1.21

       (from /usr/bin/repo)

git version 1.9.3 (Apple Git-50)

Python 2.7.5 (default, Mar  9 2014, 22:15:05) 

[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]

wue-16114mac:freeeasy_master krawczyk$ 


Looks like we can at least workaround the issue by just re-initializing our projects from scratch, so the issue is not that critical anymore

christian....@googlemail.com

unread,
Sep 19, 2014, 2:06:28 AM9/19/14
to repo-d...@googlegroups.com, christian....@googlemail.com
So what?
Most software I'm using is several months old, some even years :)

lumos zhang

unread,
Oct 9, 2014, 10:26:08 PM10/9/14
to repo-d...@googlegroups.com
find and change follow line in aosp/.repo/repo/git_command.py
    ver_str[len('git version '):].strip().split('-')[0].split('.')[0:3]
to
    ver_str[len('git version '):].strip().split(' ')[0].split('.')[0:3]

在 2014年9月18日星期四UTC+8下午10时24分12秒,christian....@googlemail.com写道:

杨仁勇

unread,
Jan 24, 2017, 3:06:41 AM1/24/17
to Repo and Gerrit Discussion
there is a bug in repo when finding git version, replace the version find logic(grep "ver_str" in repo/git_command.py ) with the following logic:

    if ver_str.startswith('git version '):

      git_version_start = len('git version ')

      git_version_end = ver_str.find(' ', git_version_start, len(ver_str))

      if git_version_end == -1:

        git_version_end = len(ver_str)

      _git_version = tuple(

        map(lambda x: int(x),

          ver_str[git_version_start:git_version_end].strip().split('.')[0:3]

        ))


best

在 2014年10月10日星期五 UTC+8上午10:26:08,lumos zhang写道:
Reply all
Reply to author
Forward
0 new messages