Opened 14 years ago
Closed 12 years ago
#8682 closed defect (fixed)
GitConnector: __init__ calls git_version(git_bin) from PyGIT using git-receive-pack instead of git
Reported by: | Owned by: | Herbert Valerio Riedel | |
---|---|---|---|
Priority: | high | Component: | GitPlugin |
Severity: | blocker | Keywords: | |
Cc: | stuge | Trac Release: | 1.0 |
Description
In version '0.12.0.5', GitConnector.__init__
calls Storage.git_version
with /usr/bin/git-receive-pack
. Storage.git_version
fails, as git-receive-pack
hasn't got the option --version
. I don't know what causes this error, as i explicitly set git_bin = /usr/bin/git
in conf/trac.ini
.
Adding
self.log.error("My git_bin is %s" %self._git_bin)
to GitConnector.__init__
causes the following output:
2011-04-07 13:04:31,435 Trac[git_fs] ERROR: My git_bin is /usr/bin/git-receive-pack
Attachments (0)
Change History (11)
comment:1 follow-ups: 2 3 7 Changed 14 years ago by
comment:2 Changed 14 years ago by
PS: this may cause bug #8465.
Alternative workaround: build Git from source, install to /usr/local
, and put this in conf/trac.ini
:
[git] git_bin = /usr/local/bin/git
comment:3 Changed 14 years ago by
Priority: | normal → high |
---|---|
Severity: | normal → critical |
comment:4 Changed 13 years ago by
I also have this problem on a Ubuntu (10.04) machine where git is installed at /usr/bin/git (with no symlink).
it was announced as TypeError: 'NoneType' object is unsubscriptable
.
Trace:
File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/web/main.py", Line 511, in _dispatch_request dispatcher.dispatch(req) File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/web/main.py", Line 202, in dispatch chosen_handler) File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/web/main.py", Line 344, in _pre_process_request chosen_handler = filter_.pre_process_request(req, chosen_handler) File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/versioncontrol/api.py", Line 330, in pre_process_request repo = self.get_repository(reponame) File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/versioncontrol/api.py", Line 526, in get_repository repos = connector.get_repository(rtype, rdir, repoinfo.copy()) File "/usr/lib/python2.6/dist-packages/tracext/git/git_fs.py", Line 159, in get_repository shortrev_len=self._shortrev_len) File "/usr/lib/python2.6/dist-packages/tracext/git/git_fs.py", Zeile 177, in __init__ Repository.__init__(self, "git:"+path, None, log) File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/versioncontrol/api.py", Line 732, in __init__ self.reponame = params['name']
however I guess the problem is here: File "/usr/lib/python2.6/dist-packages/tracext/git/git_fs.py", Zeile 177, in init
Code: Line 172 self.gitrepo = path 173 self._shortrev_len = max(4, min(shortrev_len, 40)) 174 175 self.git = PyGIT.StorageFactory(path, log, not persistent_cache, 176 git_bin=git_bin).getInstance() 177 Repository.__init__(self, "git:"+path, None, log) 178 179 def close(self): 180 self.git = None 181 182 def clear(self, youngest_rev=None): Local Variables: Name Value git_bin u'/usr/bin/git' log <logging.Logger instance at 0x30edd88> path u'/var/git/project/.git' persistent_cache False self <tracext.git.git_fs.GitRepository object at 0x3728ad0> shortrev_len 7
comment:5 Changed 13 years ago by
Patch from mgarraha works fine on openSUSE 11.3 and 11.4.
https://bugzilla.novell.com/show_bug.cgi?id=697156
Trac-Hacks ticket#8473 discusses same problem -> maybe merge it?
comment:6 Changed 13 years ago by
Severity: | critical → blocker |
---|
comment:7 Changed 13 years ago by
Replying to mgarraha:
I had the same problem on OpenSuSE 12.1, and mgarraha's did the trick for me too.
comment:8 Changed 12 years ago by
Cc: | stuge added; anonymous removed |
---|
comment:9 Changed 12 years ago by
Trac Release: | 0.12 → 1.0 |
---|
Same problem with openSUSE 12.2 (x86_64) and Trac-1.0
Trac-1.0 was built and installed from source archive (with sudo python setup.py install) git version 1.7.10.4 installed with yast2. python 2.7.3 installed with yast2.
Patch from mgarraha solve the problem.
Can you confirm that there is no side effect with it ?
Regards,
comment:10 Changed 12 years ago by
The patch should be applied to Trac core. I've filed the issue in t:#10997.
comment:11 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
The t:#10997 has been fixed in Trac 1.0.1. If you are using Trac 0.12.x, try https://github.com/jun66j5/trac-git-plugin.
Some Linux distros have a chain of symbolic links from
/usr/bin/git
to/usr/bin/git-receive-pack
. I suppose theos.path.realpath
inSection.getpath
(called byPathOption
constructor,config.py
in Trac) follows the links. I patched mytrac-git-plugin
sources as follows:tracext/git/git_fs.py
PathOption('git', 'git_bin', '/usr/bin/git',