diff --git a/CHANGELOG.md b/CHANGELOG.md index 2710f1f53..e156943ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). Use the following format for additions: ` - VERSION: [feature/patch (if applicable)] Short description of change. Links to relevant issues/PRs.` +- 1.4.36: + - Mark submodules as dirty - 1.4.35: - allow disabling of nprogress bar [#1143](https://github.com/FredrikNoren/ungit/issues/1143) - set `ungitVersionCheckOverride` as boolean in config [#1102](https://github.com/FredrikNoren/ungit/issues/1102) diff --git a/components/staging/staging.html b/components/staging/staging.html index 62ee2a7dc..3fa120096 100644 --- a/components/staging/staging.html +++ b/components/staging/staging.html @@ -86,6 +86,7 @@ Removed + Dirty ConflictsLaunch Merge ToolMark as Resolved Patch diff --git a/components/staging/staging.js b/components/staging/staging.js index 026b0d03f..86acf7ae0 100644 --- a/components/staging/staging.js +++ b/components/staging/staging.js @@ -348,6 +348,7 @@ var FileViewModel = function(staging, name) { this.displayName = ko.observable(name); this.isNew = ko.observable(false); this.removed = ko.observable(false); + this.dirty = ko.observable(false); this.conflict = ko.observable(false); this.renamed = ko.observable(false); this.isShowingDiffs = ko.observable(false); @@ -393,6 +394,7 @@ FileViewModel.prototype.setState = function(state) { this.displayName(state.displayName); this.isNew(state.isNew); this.removed(state.removed); + this.dirty(state.dirty); this.conflict(state.conflict); this.renamed(state.renamed); this.fileType(state.type); diff --git a/components/staging/staging.less b/components/staging/staging.less index b1168ab1e..ac2583d5e 100644 --- a/components/staging/staging.less +++ b/components/staging/staging.less @@ -149,7 +149,7 @@ } padding: 0.3em; - .new, .deleted, .conflict, .markresolved, .launchmergetool { + .new, .deleted, .conflict, .markresolved, .launchmergetool, .dirty { padding: 3px; padding-left: 5px; padding-right: 5px; @@ -176,6 +176,21 @@ } } } + .dirty { + color: #DB12C0; + cursor: pointer; + .explanation { + display: none; + } + &:hover { + background: #A445ED; + color: #000; + border-radius: 3px; + .explanation { + display: inline; + } + } + } .markresolved { color: #DB12C0; cursor: pointer; diff --git a/package-lock.json b/package-lock.json index 68c908a2e..b07a991c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ungit", - "version": "1.4.35", + "version": "1.4.36", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -13088,7 +13088,8 @@ }, "stringstream": { "version": "0.0.5", - "resolved": "", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", "dev": true }, "strip-ansi": { diff --git a/package.json b/package.json index 1e1d52eb8..f71e00643 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "ungit", "author": "Fredrik Norén ", "description": "Git made easy", - "version": "1.4.35", + "version": "1.4.36", "ungitPluginApiVersion": "0.2.0", "scripts": { "start": "node ./bin/ungit", diff --git a/source/git-parser.js b/source/git-parser.js index 09c95c523..a78cac87a 100644 --- a/source/git-parser.js +++ b/source/git-parser.js @@ -15,6 +15,7 @@ exports.parseGitStatus = (text, args) => { const finalFilename = status[0] == 'R' ? filename.slice(filename.indexOf('>') + 2) : filename; files[finalFilename] = { displayName: filename, + dirty: (status[0] == ' ' && (status[1] == '?' || status[1] == 'm')), staged: status[0] == 'A' || status[0] == 'M', removed: status[0] == 'D' || status[1] == 'D', isNew: (status[0] == '?' || status[0] == 'A') && !(status[0] == 'D' || status[1] == 'D'), diff --git a/test/spec.git-parser.js b/test/spec.git-parser.js index b6c6422b8..99c896d72 100644 --- a/test/spec.git-parser.js +++ b/test/spec.git-parser.js @@ -3,6 +3,35 @@ const expect = require('expect.js'); const path = require('path'); const gitParser = require('../src/git-parser'); +describe('git-parser status', () => { + describe('with submodules', () => { + it('should mark submodules with untracked files as dirty', () => { + const text = `## dirty-submodules + m amodule`; + const res = gitParser.parseGitStatus(text); + expect(res.files['amodule'].dirty).to.be(true); + }); + it('should mark submodules with modified contents as dirty', () => { + const text = `## dirty-submodules + ? amodule`; + const res = gitParser.parseGitStatus(text); + expect(res.files['amodule'].dirty).to.be(true); + }); + it('should not mark submodules with a diferent HEAD as dirty', () => { + const text = `## dirty-submodules + M amodule`; + const res = gitParser.parseGitStatus(text); + expect(res.files['amodule'].dirty).to.be(false); + }); + it('should not mark normal changes as dirty', () => { + const text = `## dirty-submodules +xA afile`; + const res = gitParser.parseGitStatus(text); + expect(res.files['amodule'].dirty).to.be(false); + }); + }); +}); + describe('git-parser stash show', () => { it('should be possible to parse stashed show', () => { const text = ' New Text Document (2).txt | 5 +++++\n 1 file changed, 5 insertions(+)\n';