Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken links to submodules in gitblit for repositories with more than 2 levels directories hierarchy #562

Closed
gitblit opened this issue Aug 12, 2015 · 18 comments

Comments

@gitblit
Copy link
Owner

@gitblit gitblit commented Aug 12, 2015

Originally reported on Google Code with ID 266

What steps will reproduce the problem?
1. Create a repository with 2 submodules
2. The .gitmodules file content should look like:
[submodule "sub1"]
   path = repo1
   url = ssh://gerritmirror:29418/dir1/repo1.git
[submodule "sub2"]
   path = repo2
   url = ssh://gerritmirror:29418/dir1/dir2/repo2.git
3. The content of the gitblit.properties related to submodules is:

git.submoduleUrlPatterns = .*?://gerritmirror:29418/(.*)

4. In the history panel, there are broken link for the second repo "sub2" pointing
to "gerritmirror:29418/dir2/repo2.git" which does not exist
while it works for the first repository with 2 levels directories, the link created
for "sub1" is created successfully to "gerritmirror:29418/dir1/repo1.git"


What is the expected output? What do you see instead?
It is expected for this link to point to:
gerritmirror:29418/dir1/dir2/repo2.git
instead of:
gerritmirror:29418/dir2/repo2.git



What version of the product are you using? On what operating system?
1.2 and 1.3 - Linux Redhat


Please provide any additional information below.

Reported by bassem.rabil on 2013-07-10 19:37:55

@gitblit gitblit self-assigned this Aug 12, 2015
@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

I think this bug is with wicket/panels/HistoryPanel.java when it tries to get the repo
path for the submodule.

Reported by bassem.rabil on 2013-07-10 19:43:51

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Do you have an example I can play without having to create this myself?

Reported by James.Moger on 2013-07-11 12:46:40

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Hi James

The example I have has some proprietary information, but I will create a
test repo with the same structure and will provide it to you.

Thanks and Regards
Bassem Rabil

Reported by bassem.rabil on 2013-07-11 12:51:44

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Here attached a tar file with a test repository with 3 submodules with 2, 3, and 4 directory
levels.

Reported by bassem.rabil on 2013-07-12 17:51:36


- _Attachment: [gitblit-266.tar](https://storage.googleapis.com/google-code-attachments/gitblit/issue-266/comment-4/gitblit-266.tar)_

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

In your setup with your existing issue, is this a server with bare repos?  Or are you
viewing your workspace with submodule checkouts - like in the provided example?

Reported by James.Moger on 2013-07-12 19:28:04

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Hi James

In our setup, the server is a gerrit instance having full repositories 
(not bare repos), we are viewing our workspace with submodules checkouts.
In the provided example test case, I used empty repositories for 
simplicity because the issue is with the structure of submodules and 
paths rather than the content.

Thanks and Regards
Bassem Rabil

Reported by bassem.rabil on 2013-07-13 01:48:27

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

You want to see submodule links for checked-out/working copies, right?

I'm punting on fixing this for the 1.3.0 release.  This won't really affect you anyway
since the Gitblit plugin is built from master.

Reported by James.Moger on 2013-07-13 16:34:43

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Using the regular expression defined in gitblit.properties file, gitblit 
generates a valid link to the gerrit instance repositories for 
submodules pointing to repositories of 2 levels of directories. For 
submodules pointing to repositories with 3 or more levels of 
directories, the generated link is mis-parsed into only 2 levels 
repository on the gerrit instance which does not exist and thus the link 
is broken.

Reported by bassem.rabil on 2013-07-13 23:26:26

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

It seems I still can reproduce the issue with gitblit 1.3.1. I will try to rephrase
the issue to clarify it further.

In the History Panel, for the commit where the submodules are added there are links
for the submodules created in this commit using the regular expression in properties
file:

git.submoduleUrlPatterns = .*?://gerritmirror:29418/(.*)

This link for repositories with 3 levels of directories, it removes the middle directory
during creating the link, and thus it creates a broken link. e.g. 
instead of "dir1/dir2/repo2" it creates the link to "dir1/repo2"
For 2 levels directories repos everything is working fine.

Reported by bassem.rabil on 2013-07-25 15:20:13

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Do both "dir1/repo2" and "dir1/dir2/repo2" happen to exist?

Reported by James.Moger on 2013-07-25 15:24:33

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

No. "dir1/repo2" does not exist, that is why the link is broken with
message cannot find commit XYZ in repo dir1/repo2 which does not exist.

Reported by bassem.rabil on 2013-07-25 15:29:57

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

We're getting nowhere fast on this issue.  I can't reproduce it.  If we're going to
get this fixed then I'll need you to inject some println() calls, build from source,
and share your findings.

After syncing with my master...

I recommend modifying RepositoryPage.getSubmodule(String) and injecting a System.out.println(candidates)
around line 466.

Also inject a System.out.println(candidate) before line 471.

Test this by navigating the _Tree_ page for your repo, we'll deal with History after
getting the Tree working.

Reported by James.Moger on 2013-08-07 13:13:48

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Have you discovered anything?

Reported by James.Moger on 2013-08-08 12:58:51

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Finally I was able to build gitblit using moxie thanks to your hint. I was
hijacked by other issues before I start building the plugin based on this
debug gitblit. I will keep you posted with my findings.

Reported by bassem.rabil on 2013-08-08 13:15:08

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

I plan to release 1.3.2 shortly.  If you can get me solid info I can fix this for that
release, otherwise the fix (whenever it lands) will sit on master for a while until
the 1.4 release.

Reported by James.Moger on 2013-08-09 12:11:28

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Have you collected any more information on this?  If not then I will close as not reproducible.

Reported by James.Moger on 2013-09-19 12:14:54

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Unfortunately I didn't have the time to work on this. Feel free to close
the issue for now, and once I get the time to investigate it I will open a
new ticket.

Reported by bassem.rabil on 2013-09-19 12:20:29

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Just re-use the existing issue if/when you gather more information.

Reported by James.Moger on 2013-09-19 12:21:38

  • Status changed: CanNotReproduce

@gitblit gitblit closed this as completed Aug 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant