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

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

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.5.5, 3.6.3
    • 3.4.6, 3.5.3, 3.6.1, 3.7
    • General
    • MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
    • MOODLE_35_STABLE, MOODLE_36_STABLE
    • m37_MDL-64443_Ignore_More_Swap_File_Types
    • Easy
    • 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

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

            matteo Matteo Scaramuccia
            matteo Matteo Scaramuccia
            Simey Lameze Simey Lameze
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.