Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-111056

"ant clean" does not clean worktree repositories

    Details

      Description

      ant clean does not clean worktree repositories.

      Steps to reproduce

      1. In the terminal, get into your local liferay-portal repository.
      2. Run git worktree add ../liferay-portal-test test
      3. Enter the newly created directory ../liferay-portal-test.
      4. Create the file portal-kernel/src/com/liferay/FakeClass.java with the content not valid java code i hope
        • for example by calling echo not valid java code i hope > portal-kernel/src/com/liferay/FakeClass.java
      5. Run ant all.
      6. Run ant clean. Observe the logs
      7. Run ant all.

      Expected results

      • The build fails in step #7
      • FakeClass.java is deleted in step #8.
      • Build passes in step #9.

      Actual results

      • The build fails in step #7
      • FakeClass.java is not deleted in step #8.
      • In step #8, we see the following message:
         [echo] Do not clean project because it is not in a Git repository.
        
      • Build fails in in step #9 again.

      Root cause

      The clean task only executes if .git exists and is a directory:

      <if>
          <available file="${project.dir}/.git" type="dir" />
      <if>
      

      In worktrees, however, .git is a file.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              victor.ware Victor Ware
              Reporter:
              adam.brandizzi Adam Brandizzi
              Participants of an Issue:
              Recent user:
              Jason Pince
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 8 weeks ago

                  Packages

                  Version Package
                  7.0.X
                  7.1.X
                  7.2.X
                  7.3.3 CE GA4
                  7.3.10 DXP GA1
                  Master