#10603 closed enhancement (fixed)
GitPlugin: Support for submodules
Reported by: | Peter Suter | Owned by: | Jun Omae |
---|---|---|---|
Priority: | low | Milestone: | 1.0.17 |
Component: | plugin/git | Version: | 1.0dev |
Severity: | normal | Keywords: | subrepository git-submodule |
Cc: | lele@…, Jun Omae | Branch: | |
Release Notes: |
Support submodule entries in Git repository. |
||
API Changes: | |||
Internal Changes: |
Description
Created as part of the move of GitPlugin. Tickets originally reported for th:GitPlugin: th:#8880, th:#3842
Quoting mresnick:
Is anyone working on submodule support in the source browser ?
From the
git_fs.py
file:pass # FIXME: this is a workaround for missing git submodule support in the pluginParticularly for TRAC 0.12 which supports multiple repositories it should be possible to switch context to display submodule files.
Quoting anonymous:
Error[1] apears when change contains only submodule version update. Same error can be reproduced when change contains information about merge branch into master.
[1] TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'
Attachments (1)
Change History (17)
comment:1 by , 13 years ago
comment:3 by , 12 years ago
Quoting anonymous:
Error[1] apears when change contains only submodule version update. Same error can be reproduced when change contains information about merge branch into master.
[1]
TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'
This part is a duplicate of #10162.
comment:4 by , 12 years ago
Keywords: | subrepository added |
---|
But as comment:3:ticket:10162 suggests, maybe we can for now treat subrepositories as directories. Changing GitRepository.get_changes() and GitChangeset.get_changes() from everything except directories are files to the reverse perhaps?
kind = Node.DIRECTORY if mode2.startswith('10') or mode1.startswith('10'): kind = Node.FILE
(untested)
comment:5 by , 12 years ago
Milestone: | → next-major-releases |
---|---|
Priority: | normal → low |
Version: | → 1.0dev |
comment:8 by , 11 years ago
Cc: | added |
---|---|
Keywords: | git-submodule added |
Milestone: | next-major-releases → next-stable-1.0.x |
Related to th:#11732, th:r13908 for th:TracPygit2Plugin and #6474.
comment:9 by , 8 years ago
Milestone: | next-stable-1.0.x → next-stable-1.2.x |
---|
Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.
comment:10 by , 7 years ago
I got TypeError
s under production environment. At least, I think we should prevent the TypeError
s even if #10162 is not resolved.
comment:11 by , 7 years ago
Milestone: | next-stable-1.2.x → 1.0.17 |
---|---|
Owner: | set to |
Status: | new → assigned |
Proposed changes in [5148072ee/jomae.git] (jomae.git@t10603).
comment:12 by , 7 years ago
Reconsidering, submodule'd entry should be a directory. In proposed changes, that would be a file.
$ git submodule add -b 1.0-stable --name trac git@github.com:edgewall/trac.git trac Cloning into 'trac'... remote: Counting objects: 96491, done. remote: Compressing objects: 100% (44/44), done. remote: Total 96491 (delta 18), reused 17 (delta 8), pack-reused 96439 Receiving objects: 100% (96491/96491), 35.90 MiB | 54.00 KiB/s, done. Resolving deltas: 100% (76657/76657), done. Checking connectivity... done. $ git commit -a -m 'add submodule' [master (root-commit) a35122f40] add submodule 2 files changed, 5 insertions(+) create mode 100644 .gitmodules create mode 160000 trac $ git archive --format=tar --prefix=./ HEAD | tar tvf - drwxrwxr-x root/root 0 2017-12-11 12:05 ./ -rw-rw-r-- root/root 93 2017-12-11 12:05 ./.gitmodules drwxrwxr-x root/root 0 2017-12-11 12:05 ./trac/ # <== directory
I'll re-propose changes.
follow-up: 14 comment:13 by , 7 years ago
Proposed changes in [ab9e4aaa8/jomae.git] (jomae.git@t10603.1), again.
In the changes, GitNode.kind
for submodule'd entry is Node.DIRECTORY
and referenced sha in the submodule is stored in commit
of GitNode.properties()
.
>>> from trac.env import Environment >>> from trac.versioncontrol.api import RepositoryManager >>> env = Environment('/dev/shm/tracenv') >>> rm = RepositoryManager(env) >>> repos = rm.get_repository('') >>> node = repos.get_node('/sub') >>> node.kind 'dir' >>> node.get_properties() {'commit': 'c392cf2e6a537dc3efe797576efad365a0fbeade', 'mode': '160000'} >>> node.get_content() is None True >>> node.get_content_length() is None True
comment:14 by , 7 years ago
Replying to Jun Omae:
Proposed changes in [ab9e4aaa8/jomae.git] (jomae.git@t10603.1), again.
Revised the branch. Fixed GitNode.get_entries()
returns a list included itself.
comment:15 by , 7 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Committed in [16409] and merged in [16410-16411].
by , 5 years ago
Attachment: | Screen Shot 2020-05-07 at 15.10.00.jpg added |
---|
comment:16 by , 5 years ago
Should the contents of the submodule be displayed in the repository browser?
I've tried various settings, but currently have cached repository and persistent cache enabled.
Two repositories: teo
and git-repos
.
In git-repos
I added teo
as a submodule:
$ git submodule add -b 1.0-stable --name trac ../../teo-rjollos.git trac $ git commit -a -m 'Add submodule' $ git push $ git archive --format=tar --prefix=./ HEAD | tar tvf - drwxrwxr-x 0 root root 0 May 7 15:07 ./ -rw-rw-r-- 0 root root 82 May 7 15:07 ./.gitmodules -rw-rw-r-- 0 root root 6 May 7 15:07 ./file1 drwxrwxr-x 0 root root 0 May 7 15:07 ./trac/ $ cat .gitmodules [submodule "trac"] path = trac url = ../../teo-rjollos.git branch = 1.0-stable
I resynced both repositories. Both are browseable through Trac repository browser. But the contents of the submodule is not displayed:
Is this going to get implemented at some point?