6 Replies Latest reply on Feb 27, 2015 9:23 AM by mashama

    Switching between local GIT branches causes GIT connector to no longer be able to read a commit?

    mashama

      I have discovered a scenario where after switching between local branches the GIT connector can no longer access the same path within a federated GIT repository. 

      17:35:14,931 WARN  [org.modeshape.connector.git.GitConnector] (default task-22) Cannot read commit "src/lib/jquery.min.js"

      17:35:14,932 ERROR [stderr] (default task-22) javax.jcr.PathNotFoundException: The child "jcr:content" could not be found under "/nogece/tree/master/src/lib/jquery.min.js" in workspace "default"

       

      When I switch back the "jcr:content" under "/nogece/tree/master/src/lib/jquery.min.js" becomes accessible again.  Switching back and forth between these two branches produces the same results...

       

      ModeShape 4.2

      Wildfly 8.1

      Windows 7

        • 1. Re: Switching between local GIT branches causes GIT connector to no longer be able to read a commit?
          hchiorean

          What do you mean by "switching branches" ? Also, what does your connector configuration look like ?

          • 2. Re: Re: Switching between local GIT branches causes GIT connector to no longer be able to read a commit?
            mashama

            By "switches branches" I mean using "git checkout [branch]" to switch between local branches.  Here is my Wildfly standalone.xml configuration file as it pertains to the ModeShape GIT connector tidbits:

             

                <subsystem xmlns="urn:jboss:domain:modeshape:2.0">
                        <repository name="carroll">
                            <external-sources>
                                <source name="git" classname="org.modeshape.connector.git.GitConnector" cacheTtlSeconds="5" directoryPath="C:\\CHP\\git\\carroll">
                                    <projection>
                                        default:/carroll =&gt; /
                                    </projection>
                                </source>
                            </external-sources>
                        </repository>
                        <repository name="nogece">
                            <external-sources>
                                <source name="git" classname="org.modeshape.connector.git.GitConnector" cacheTtlSeconds="5" directoryPath="C:\\CHP\\git\\nogece">
                                    <projection>
                                        default:/nogece =&gt; /
                                    </projection>
                                </source>
                            </external-sources>
                        </repository>
                        <repository name="zing">
                            <external-sources>
                                <source name="git" classname="org.modeshape.connector.git.GitConnector" cacheTtlSeconds="5" directoryPath="C:\\CHP\\git\\zing">
                                    <projection>
                                        default:/zing =&gt; /
                                    </projection>
                                </source>
                            </external-sources>
                        </repository>
                        <webapp name="modeshape-rest.war"/>
                        <webapp name="modeshape-webdav.war"/>
                        <webapp name="modeshape-explorer.war"/>
                 </subsystem>
            
            • 3. Re: Re: Switching between local GIT branches causes GIT connector to no longer be able to read a commit?
              hchiorean

              Are you accessing the commit using /tree/<path> (Git connector - ModeShape 4 - Project Documentation Editor) ? Does the same problem show up if you try using the ID of the commit via /commit/ID ? If you're using the ID of the commit, do both branches have a commit with this ID ?

              • 4. Re: Switching between local GIT branches causes GIT connector to no longer be able to read a commit?
                mashama

                I am accessing the commit using /tree/<path>.  The same problem exists when accessing the commit via /commit/<ID>.  Only one of the branches has the commit ID.

                • 5. Re: Switching between local GIT branches causes GIT connector to no longer be able to read a commit?
                  hchiorean

                  Using /commit/ID will/should only work if a commit with ID is present in the current branch (as pointed to by HEAD). So in that case the behavior is to be expected if one of your branches does not contain the commit.

                  On the other hand, if using a /tree/<branch>/<path-to-commit> style path, then <branch> should be used and not HEAD. As long as <path-to-commit> exists in <branch> it should be returned. So if that is your case, feel free to log a JIRA.

                  • 6. Re: Switching between local GIT branches causes GIT connector to no longer be able to read a commit?
                    mashama

                    I have created MODE-2436.