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

Don't show git diff's for any derived files, eg compiled less to css files and yui & amd compiled js

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Testing basic 'git diff' fix:

      1. In a checked out dev environment, add a new random extra css class and js changes to various files, like this:

      diff --git a/blocks/settings/amd/src/settingsblock.js b/blocks/settings/amd/src/settingsblock.js
      index 965aec5..e5fb277 100644
      --- a/blocks/settings/amd/src/settingsblock.js
      +++ b/blocks/settings/amd/src/settingsblock.js
      @@ -28,7 +28,7 @@ define(['jquery', 'core/tree'], function($, Tree) {
                   if (siteAdminNodeId) {
                       var siteAdminNode = adminTree.treeRoot.find('#' + siteAdminNodeId);
                       var siteAdminLink = siteAdminNode.children('a').first();
      -                siteAdminLink.replaceWith('<span tabindex="0">' + siteAdminLink.html() + '</span>');
      +                siteAdminLink.replaceWith('<span tabindex="0">' + siteAdminLink.html() + 'something</span>');
                   }
               }
           };
      diff --git a/mod/quiz/yui/src/dragdrop/js/resource.js b/mod/quiz/yui/src/dragdrop/js/resource.js
      index b213807..327132e 100644
      --- a/mod/quiz/yui/src/dragdrop/js/resource.js
      +++ b/mod/quiz/yui/src/dragdrop/js/resource.js
      @@ -18,6 +18,7 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, {
       
               this.samenodelabel = {
                   identifier: 'dragtoafter',
      +            foo: 'bar',
                   component: 'quiz'
               };
               this.parentnodelabel = {
      diff --git a/theme/bootstrapbase/less/editor.less b/theme/bootstrapbase/less/editor.less
      index c66aebd..f64938a 100644
      --- a/theme/bootstrapbase/less/editor.less
      +++ b/theme/bootstrapbase/less/editor.less
      @@ -7,6 +7,9 @@
       // CSS Reset.
       @import "bootstrap/reset.less";
       
      +.foo {
      +    bar: bar;
      +}
       // Base CSS.
       @import "bootstrap/scaffolding.less";
       @import "bootstrap/type.less";
      diff --git a/theme/bootstrapbase/less/moodle.less b/theme/bootstrapbase/less/moodle.less
      index 2556c38..2835c0a 100644
      --- a/theme/bootstrapbase/less/moodle.less
      +++ b/theme/bootstrapbase/less/moodle.less
      @@ -13,6 +13,9 @@
       @import "moodle/user";
       @import "moodle/search";
       
      +.foo {
      +    bar: bar;
      +}
       
       // Upstream Bootstrap.
       @import "bootstrap/bootstrap";
      

      1. Run 'grunt css'
      2. Run 'grunt js'
      3. run 'git diff' - you should not get pages of meaningless diff results, just the same diff as above but with a few mentions of the binary files differing. If you run git status you should get:

      Changes not staged for commit:
        (use "git add <file>..." to update what will be committed)
        (use "git checkout -- <file>..." to discard changes in working directory)
       
      	modified:   blocks/settings/amd/build/settingsblock.min.js
      	modified:   blocks/settings/amd/src/settingsblock.js
      	modified:   mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-debug.js
      	modified:   mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-min.js
      	modified:   mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop.js
      	modified:   mod/quiz/yui/src/dragdrop/js/resource.js
      	modified:   theme/bootstrapbase/less/editor.less
      	modified:   theme/bootstrapbase/less/moodle.less
      	modified:   theme/bootstrapbase/style/editor.css
      	modified:   theme/bootstrapbase/style/moodle.css
      

      Show
      Testing basic 'git diff' fix: In a checked out dev environment, add a new random extra css class and js changes to various files, like this: diff --git a/blocks/settings/amd/src/settingsblock.js b/blocks/settings/amd/src/settingsblock.js index 965aec5..e5fb277 100644 --- a/blocks/settings/amd/src/settingsblock.js +++ b/blocks/settings/amd/src/settingsblock.js @@ -28,7 +28,7 @@ define(['jquery', 'core/tree'], function($, Tree) { if (siteAdminNodeId) { var siteAdminNode = adminTree.treeRoot.find('#' + siteAdminNodeId); var siteAdminLink = siteAdminNode.children('a').first(); - siteAdminLink.replaceWith('<span tabindex="0">' + siteAdminLink.html() + '</span>'); + siteAdminLink.replaceWith('<span tabindex="0">' + siteAdminLink.html() + 'something</span>'); } } }; diff --git a/mod/quiz/yui/src/dragdrop/js/resource.js b/mod/quiz/yui/src/dragdrop/js/resource.js index b213807..327132e 100644 --- a/mod/quiz/yui/src/dragdrop/js/resource.js +++ b/mod/quiz/yui/src/dragdrop/js/resource.js @@ -18,6 +18,7 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, { this.samenodelabel = { identifier: 'dragtoafter', + foo: 'bar', component: 'quiz' }; this.parentnodelabel = { diff --git a/theme/bootstrapbase/less/editor.less b/theme/bootstrapbase/less/editor.less index c66aebd..f64938a 100644 --- a/theme/bootstrapbase/less/editor.less +++ b/theme/bootstrapbase/less/editor.less @@ -7,6 +7,9 @@ // CSS Reset. @import "bootstrap/reset.less"; +.foo { + bar: bar; +} // Base CSS. @import "bootstrap/scaffolding.less"; @import "bootstrap/type.less"; diff --git a/theme/bootstrapbase/less/moodle.less b/theme/bootstrapbase/less/moodle.less index 2556c38..2835c0a 100644 --- a/theme/bootstrapbase/less/moodle.less +++ b/theme/bootstrapbase/less/moodle.less @@ -13,6 +13,9 @@ @import "moodle/user"; @import "moodle/search"; +.foo { + bar: bar; +} // Upstream Bootstrap. @import "bootstrap/bootstrap"; Run 'grunt css' Run 'grunt js' run 'git diff' - you should not get pages of meaningless diff results, just the same diff as above but with a few mentions of the binary files differing. If you run git status you should get: Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory)   modified: blocks/settings/amd/build/settingsblock.min.js modified: blocks/settings/amd/src/settingsblock.js modified: mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-debug.js modified: mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-min.js modified: mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop.js modified: mod/quiz/yui/src/dragdrop/js/resource.js modified: theme/bootstrapbase/less/editor.less modified: theme/bootstrapbase/less/moodle.less modified: theme/bootstrapbase/style/editor.css modified: theme/bootstrapbase/style/moodle.css
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Pull Master Branch:
      MDL-53432-git-less-css

      Description

      There are a few less than optimal things about the way the less compiled css files are handled with git. I don't want to open a debate about whether the derived files should even be in git at all because that ship has already sailed, I want to just make dealing with that reality better.

      Some issues with the current set up:

      • If you are making a patch and checkin both less and css then the diffs are horrible because the combined and minified css or js is all on a single line

      Solution:

      • mark the various derived files as not to be diffed in .gitattributes

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/May/16