Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-64443

Exclude *.swo, *.swn (, ...) files too from VCS

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4.6, 3.5.3, 3.6.1, 3.7
    • Fix Version/s: 3.5.5, 3.6.3
    • Component/s: General
    • Labels:
    • Testing Instructions:
      Hide

      Create fixtures

      1. Create some swap files like vim would create them:

        $ touch lib/.moodlelib.php.swo lib/.moodlelib.php.swp lib/.moodlelib.php.swn lib/.moodlelib.php.swa
        

      Before applying the patch

      1. Check that bad files are there in the file system:

        $ ls -lh lib/.moodlelib*
        -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swa
        -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swn
        -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swo
        -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swp
        

      2. Try adding those files to the repo:

        $ git add lib/.moodlelib*
        The following paths are ignored by one of your .gitignore files:
        lib/.moodlelib.php.swp
        Use -f if you really want to add them.
        

      3. Check that some files have being staged for the next commit:

        $ git diff --cached
        diff --git a/lib/.moodlelib.php.swa b/lib/.moodlelib.php.swa
        new file mode 100644
        index 00000000000..e69de29bb2d
        diff --git a/lib/.moodlelib.php.swn b/lib/.moodlelib.php.swn
        new file mode 100644
        index 00000000000..e69de29bb2d
        diff --git a/lib/.moodlelib.php.swo b/lib/.moodlelib.php.swo
        new file mode 100644
        index 00000000000..e69de29bb2d
        

      4. Cleanup:

        $ git rm --cached lib/.moodlelib*[o,n,a]
        

      After applying the patch

      1. Check that bad files are there in the file system:

        $ ls -lh lib/.*moodlelib*
         -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swa
         -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swn
         -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swo
         -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swp
        

      2. Try add those files to the repo:

        $ git add lib/.moodlelib*
         The following paths are ignored by one of your .gitignore files:
         lib/.moodlelib.php.swa
         lib/.moodlelib.php.swn
         lib/.moodlelib.php.swo
         lib/.moodlelib.php.swp
         Use -f if you really want to add them.
        

      3. Check that no file has being staged for the next commit:

        $ git diff --cached
        

      Show
      Create fixtures Create some swap files like vim would create them: $ touch lib/.moodlelib.php.swo lib/.moodlelib.php.swp lib/.moodlelib.php.swn lib/.moodlelib.php.swa Before applying the patch Check that bad files are there in the file system: $ ls -lh lib/.moodlelib* -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swa -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swn -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swo -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swp Try adding those files to the repo: $ git add lib/.moodlelib* The following paths are ignored by one of your .gitignore files: lib/.moodlelib.php.swp Use -f if you really want to add them. Check that some files have being staged for the next commit: $ git diff --cached diff --git a/lib/.moodlelib.php.swa b/lib/.moodlelib.php.swa new file mode 100644 index 00000000000..e69de29bb2d diff --git a/lib/.moodlelib.php.swn b/lib/.moodlelib.php.swn new file mode 100644 index 00000000000..e69de29bb2d diff --git a/lib/.moodlelib.php.swo b/lib/.moodlelib.php.swo new file mode 100644 index 00000000000..e69de29bb2d Cleanup: $ git rm --cached lib/.moodlelib*[o,n,a] After applying the patch Check that bad files are there in the file system: $ ls -lh lib/.*moodlelib* -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swa -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swn -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swo -rw-r--r-- 1 matteo 197121 0 Dec 19 10:21 lib/.moodlelib.php.swp Try add those files to the repo: $ git add lib/.moodlelib* The following paths are ignored by one of your .gitignore files: lib/.moodlelib.php.swa lib/.moodlelib.php.swn lib/.moodlelib.php.swo lib/.moodlelib.php.swp Use -f if you really want to add them. Check that no file has being staged for the next commit: $ git diff --cached
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE, MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      m37_MDL-64443_Ignore_More_Swap_File_Types

      Description

      Moodle git repo excludes *.swp but not other swap files, e.g. *.swo (see e.g. MDL-61767)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              matteo Matteo Scaramuccia
              Reporter:
              matteo Matteo Scaramuccia
              Peer reviewer:
              Simey Lameze
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Eloy Lafuente (stronk7)
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Mar/19