Over the weekend, I decided to take advantage of the multi-repo
funcionality for the first time.
I changed the following in my urls.py::
urlpatterns += patterns('',
(r'^', include('smug.urls'), {'repo': 'content'}),
)
to this::
urlpatterns += patterns('',
(r'^pythonclass', include('smug.urls'), {'repo': 'pythonclass'}),
(r'^', include('smug.urls'), {'repo': 'content'}),
)
When visiting any page in /pythonclass/ I then got traceback that said
the following::
GitProcError: Git command failed: "git"
I patched smug to give me the whole command string which was something
like::
git ls-tree <hash> /.smug
Git doesn't like the / at the beginning of an ls-tree. It's supposed to
simply report that the file is not found, because a leading / is
illegal. My copy of git (64-bit archlinux git 1.6.3.2) was segfaulting
even when running this command from the console.
My error was that I forgot to put a trailing / after 'pythonclass' in my
regex for the urlconf.
I've attached my patch that makes smug output the whole command, instead
of only the 0th argument. I also made a change that reports that throws
an exception when ls-tree is requested along with a path that starts
with a leading /.
> diff --git a/gitlib/repo.py b/gitlib/repo.py
> index d3a3682..225d583 100644
> --- a/gitlib/repo.py
> +++ b/gitlib/repo.py
> @@ -89,7 +89,7 @@ class GitProc(object):
> if self.retcode == 0:
> return stdout
> else:
> - raise GitProcError('Git command failed: "%s"' % self.args[0],
> + raise GitProcError('Git command failed: "%s"' % " ".join(self.args),
> self.gitproc, self.retcode)
>
>
> @@ -277,8 +277,10 @@ class Repository(object):
>
> if not path:
> raise GitError("getname() cannot accept an empty path.")
> + elif path[0] == '/':
> + raise GitError("getname() cannot accept a path beginning with a /: %s" % (path,))
> elif path[-1] == '/':
> - raise GitError("getname() cannot accept a path with a trailing /.")
> + raise GitError("getname() cannot accept a path with a trailing /: %s" % (path, ))
>
> ls = self.git_command('ls-tree', treename, path)
> if ls:
--
Andrew McNabb
http://www.mcnabbs.org/andrew/
PGP Fingerprint: 8A17 B57C 6879 1863 DE55 8012 AB4D 6098 8826 6868