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

Opengrok projects indentation with subfolder and history links are missing #2925

Open
Me4791 opened this issue Sep 10, 2019 · 8 comments
Open

Comments

@Me4791
Copy link

Me4791 commented Sep 10, 2019

Respected OpenGrok Contributors and Community Members,

I am using below version:
GIT:2.19
Opengrok:1.2.23

Expectation:

    ProjA
    ProjB
    ProjC

Error:

ProjA
   ProjA/subfolder1/subfolder2
ProjB
ProjC
   ProjC/subfolder1

ProjA and subfolder1 doesn't have .git but subfolder does have .git
ProjB has .git
ProjC doesn't have .git initialized

1.With below indexing command, I am getting indentation for subfolders which is odd. This issue was fixed in #2672 but it is still there for our instance.
2.The xref description for ProjA/subfolder1/subfolder2 is navigating to ProjA instead of navigating it to subfolder2
3.Proj C has many subfolder. If this is the new way of display then why other folders aren't in the view.

Indexing Command:

time opengrok-indexer  -J=-Djava.util.logging.config.file=/opt/opengrok/doc/logging.properties -J=-Xmx16g -a /opt/opengrok/lib/opengrok.jar -- --verbose --history --renamedHistory on --defaultProject __all__ --projects  --progress --remote on --depth 10  -s /data/opgrok/branches/folderTest/src -d /data/opgrok/branches/folderTest/data -S --writeConfig /data/opgrok/branches/folderTest/etc/configuration.xml

With below indexing command we can only get the parent folders but the historycache isn't getting generated:

time opengrok-indexer -J=-Djava.util.logging.config.file=/opt/opengrok/doc/logging.properties -J=-Xmx16g -a /opt/opengrok/lib/opengrok.jar -- --verbose --history --projects --defaultProject __all__ --progress --remote dirbased --source /data/opgrok/branches/folderTest/src --dataRoot /data/opgrok/branches/folderTestata --depth 8 --threads 8 --writeConfig /data/opgrok/branches/folderTest/etc/configuration.xml

If I add '-S' option then history cache will be generated but the links won't appear.

Could you please guide us to the right combination of indexing options so that we can only get parent projects on the main page and all the history is available with enabled links?

I'd appreciate you help, Sir.

@Me4791
Copy link
Author

Me4791 commented Sep 26, 2019

Any recommendations?

@Me4791
Copy link
Author

Me4791 commented Oct 9, 2019

Hi Community members and contributors,
I have deployed Opengrok 1.3.2 in test environment the issue is still there. I'd appreciate if someone can help or suggest any alternate.
Thanks!

@vladak
Copy link
Member

vladak commented Oct 10, 2019

The indentation/subdirectory listing only happens if project has any sub-repositories (also notice that sub-repository handling changed in 1.3.3 that just came out). You can check repositories of a project by querying the RESTful API API like so:

$ curl --silent http://localhost:8080/source/api/v1/projects/testrepo/repositories | jq
[
  "/testrepo",
  "/testrepo/subdir/subrepo"
]

I think #2884 is what you are after. Alternatively, you can play around with decreasing --depth at the cost of losing history for these sub-repositories.

@vladak
Copy link
Member

vladak commented Oct 10, 2019

As for the history links, this sounds like a distinct problem. Which links do you mean specifically ?

@vladak
Copy link
Member

vladak commented Oct 10, 2019

The sub-repository xref link is a bug, will be fixed via #2952.

@Me4791
Copy link
Author

Me4791 commented Oct 15, 2019

Thanks a lot for the making the fix available. I am going to try it today. I will be posting the outcome soon.
Thanks again!

@Me4791
Copy link
Author

Me4791 commented Oct 17, 2019

Hello Sir,
I have deployed new instance with the proposed change within test environment.

Fixed:
This had fixed the view on the home page by not displaying subfolders. This also addressed the second issue as subfolders aren't there hence no hover over XREF link.

Still need to address:
The issue with not generating history is there while the indexing command includes teh option to generate history, hence the history navigation link isn't active

Result

Expectation

. (Attaching screenshots for Expectations and results.

Thanks!

@vladak
Copy link
Member

vladak commented Oct 18, 2019

In this case this is History link in directory listing so it does not matter whether history cache is actually generated.

The History link is displayed only if both are true:

  • global configuration has history enabled
  • given resource has a repository that is marked as working and is able to retrieve history for the resource
    as visible in
    if (cfg.getEnv().isHistoryEnabled()) {
    if (!cfg.hasHistory()) {
    %><li><span id="history"></span><span class="c">History</span></li><%
    } else {
    %><li><a href="<%= context + Prefix.HIST_L + cfg.getUriEncodedPath()
    %>"><span id="history"></span>History</a></li><%
    }

To find the former, use the API again:

curl --silent http://localhost:8080/source/api/v1/configuration/historyEnabled

This should return true.

To see if a project has a repository, use the API again like above in comment #2925 (comment) and then use the API to get information about the repository, for example:

$ curl --silent http://localhost:8080/source/api/v1/repositories/type?repository=/testrepo
/testrepo:Mercurial

In your case the global history is enabled (otherwise the web app would not even display the "History" string) it just established that the resource file does not have any history. That means either there is no repository for the project (and that could be result of too stringent --depth however the problem was there before you started using that) or the repository is not marked as working, see

public boolean hasHistory(File file) {
Repository repo = getRepository(file);
if (repo == null) {
return false;
}
// This should return true for Annotate view.
return repo.isWorking() && repo.fileHasHistory(file)
&& ((RuntimeEnvironment.getInstance().getRemoteScmSupported() == RemoteSCM.ON)
|| (RuntimeEnvironment.getInstance().getRemoteScmSupported() == RemoteSCM.UIONLY)
|| (RuntimeEnvironment.getInstance().getRemoteScmSupported() == RemoteSCM.DIRBASED)
|| !repo.isRemote());
}

Currently there is no way how to get repository info via API, filed #2960.

Also, see both indexer and web app log files if there is anything related there.

Lastly, the history can be disabled on per project level however I don't think this is relevant in this case. Anyhow, you can determine that using the API, e.g.:

$ curl --silent http://localhost:8080/source/api/v1/projects/testrepo/property/historyEnabled
true

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

2 participants