oracle / opengrok

OpenGrok is a fast and usable source code search and cross reference engine, written in Java
http://oracle.github.io/opengrok/
Other
4.33k stars 746 forks source link

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

Open Me4791 opened 4 years ago

Me4791 commented 4 years ago

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 commented 4 years ago

Any recommendations?

Me4791 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

vladak commented 4 years ago

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

Me4791 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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:

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 https://github.com/oracle/opengrok/issues/2925#issuecomment-540493237 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 https://github.com/oracle/opengrok/blob/81c77aae50b0c5fb86763a472574ba88b0b7f2a8/opengrok-indexer/src/main/java/org/opengrok/indexer/history/HistoryGuru.java#L312-L325

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