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.36k stars 747 forks source link

ignore dirs option -i did not work when use specified configuration #2858

Closed chouzz closed 5 years ago

chouzz commented 5 years ago

Usage: java -jar opengrok.jar [options] [subDir1 [...]]

-i, --ignore pattern Ignore the named files (prefixed with 'f:') or directories (prefixed with 'd:'). Supports wildcards (example: -i .so -i .dll)

-R /path/to/configuration Read configuration from the specified file.

When I first used opengrok.jar -i "ignoredirs" option, it worked very well. But when I used -R option to specified configuration file and I also want to ignore some dirs, I find -i option is not work。 What can I do to make these two options take effect at the same time?

vladak commented 5 years ago

how does your read only configuration file look like ?

vladak commented 5 years ago

I just tried with this read only configuration file:

<?xml version="1.0" encoding="UTF-8"?>
<java version="1.8.0_121" class="java.beans.XMLDecoder">
 <object class="org.opengrok.indexer.configuration.Configuration">

  <void property="ignoredNames">
   <void property="ignoredDirs">
    <void property="items">
     <void method="add">
      <string>foobar</string>
     </void>
    </void>
   </void>
  </void>

 </object>
</java>

and ran the indexer like this:

-s
/var/opengrok/src
-d
/var/opengrok/data
-R
/var/opengrok/etc/readonly_config.xml
-i
d:barfoo
-W
/var/opengrok/etc/configuration.xml
-P
-H
-S
-G
-U
http://localhost:8080/source

Once the indexer finished, /var/opengrok/etc/configuration.xml contained this snippet:

  <void id="IgnoredNames0" property="ignoredNames">                             
   <void id="IgnoredDirs0" property="ignoredDirs">                              
    <void property="items">                                                     
     <void method="add">                                                        
      <string>foobar</string>                                                   
     </void>                                                                    
     <void method="add">                                                        
      <string>barfoo</string>                                                   
     </void> 
...

In my case foobar and barfoo are valid repositories under the source root. They are shown on the index page (which is a bug - probably related to #1022) however are ignored when displaying directory listing.

chouzz commented 5 years ago

thank you, I solve the problem by myself.

vladak commented 5 years ago

What was the issue specifically ?

Dne pá 19. 7. 2019 11:22 uživatel zhou notifications@github.com napsal:

thank you, I solve the problem by myself.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/oracle/opengrok/issues/2858?email_source=notifications&email_token=AAWMMDE7C6IS6YZKBETKBJDQAGBT7A5CNFSM4H7MVAOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2LDEDI#issuecomment-513159693, or mute the thread https://github.com/notifications/unsubscribe-auth/AAWMMDFLXIAM4TMHXVUSDSLQAGBT7ANCNFSM4H7MVAOA .