Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions components/staging/staging.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
<span class="deleted" data-bind="visible: removed">Removed</span>
<span class="additions" data-bind="text: additions"></span>
<span class="deletions" data-bind="text: deletions"></span>
<span class="dirty" data-bind="visible: dirty"><span class="temporary">Dirty</span></span>
<span class="conflict" data-bind="visible: conflict"><span class="temporary">Conflicts</span><span class="launchmergetool explanation" data-bind="visible: mergeTool, click: launchMergeTool">Launch Merge Tool</span><span class="markresolved explanation" data-bind="click: resolveConflict">Mark as Resolved</span></span>
<span class="patch bootstrap-tooltip" data-bind="visible: isShowPatch(), click: patchClick"
data-toggle="tooltip" data-placement="top" title="Patch changes">Patch</span>
Expand Down
2 changes: 2 additions & 0 deletions components/staging/staging.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
17 changes: 16 additions & 1 deletion components/staging/staging.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ungit",
"author": "Fredrik Norén <fredrik.jw.noren@gmail.com>",
"description": "Git made easy",
"version": "1.4.35",
"version": "1.4.36",
"ungitPluginApiVersion": "0.2.0",
"scripts": {
"start": "node ./bin/ungit",
Expand Down
1 change: 1 addition & 0 deletions source/git-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
29 changes: 29 additions & 0 deletions test/spec.git-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down