Opened 11 years ago
Last modified 11 years ago
#11732 new defect
Support for git submodules
Reported by: | Lele Gaifax | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Component: | TracPygit2Plugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: |
Description
Right now when a git repository contains submodules, the plugin raises an internal error in GitNode.__init__()
because git_repos.get()
returns None
for those entries.
I know that there's already a Trac ticket about this, but I wonder if it would be reasonable to handle the case without raising an error in the meantime, for example
-
tracext/pygit2/git_fs.py
952 952 if tree_entry is None: 953 953 raise NoSuchNode(path, rev) 954 954 git_object = repos.git_repos.get(tree_entry.oid) 955 if git_object .type == GIT_OBJ_TREE:955 if git_object is None and oct(tree_entry.filemode).startswith('016'): 956 956 kind = Node.DIRECTORY 957 git_object = None 958 tree = None 959 blob = None 960 elif git_object.type == GIT_OBJ_TREE: 961 kind = Node.DIRECTORY 957 962 tree = git_object 958 963 blob = None 959 964 elif git_object.type == GIT_OBJ_BLOB: … … 1046 1051 return annotations 1047 1052 1048 1053 def get_entries(self): 1049 if self.commit is None or not self.isdir: 1054 if self.commit is None or not self.isdir or ( 1055 self.tree is None and 1056 oct(self.tree_entry.filemode).startswith('016')): 1050 1057 return 1051 1058 1052 1059 repos = self.repos
Ideally, such nodes could return a property (say 'hint') with This is the mount point of a git submodule...
What do you think?
Attachments (0)
Change History (3)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Would you please try the latest?
Replying to lgaifax:
Ideally, such nodes could return a property (say 'hint') with This is the mount point of a git submodule...
Yes. It would be good to provide information for the submodule'd entry by your suggestion or like [svn:externals].
comment:3 Changed 11 years ago by
Thanks again: latest version seems working great indeed!
And yes, it would be great if we could map the mount point to an arbitrary URL: in my case most of them would be a redirect to the same Trac instance.
I think that the trickiest part is the configuration section... I mean, in the most general case where you have multiple repositories you want to discriminate between repo A's /src/submodule
and repo B's /src/submodule
, that may point to the same external product but at different revisions... For example, in my own use case, the Trac instance tracks several "forks" of the same product made by different peoples (very like Trac's cboos.git and jomae.git).
I will try to understand the logic behind [svn:externals]
and if pygit2 provides some kind of interface to .gitmodules
maybe I'll be able to contribute some code, or at least ideas :-)
In 13908: