Skip to content

Commit

Permalink
Change relative . to ./ for consistency. Fixes GH-74.
Browse files Browse the repository at this point in the history
  • Loading branch information
shama committed Apr 10, 2014
1 parent 6eac515 commit 3a60f7c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ helper.flatToTree = function flatToTree(files, cwd, relative, unixify, done) {
// If we want relative paths
if (relative === true) {
if (path.resolve(parent) === path.resolve(cwd)) {
parent = '.';
parent = './';
} else {
parent = path.relative(cwd, parent) + path.sep;
}
Expand All @@ -66,7 +66,7 @@ helper.flatToTree = function flatToTree(files, cwd, relative, unixify, done) {
// If we want to transform paths to unix seps
if (unixify === true) {
filepath = helper.unixifyPathSep(filepath);
if (parent !== '.') {
if (parent !== './') {
parent = helper.unixifyPathSep(parent);
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/api_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports.api = {
new gaze.Gaze('**/*', {}, function() {
this.relative(null, true, function(err, result) {
var result = helper.sortobj(result);
test.deepEqual(result['.'], ['Project (LO)/', 'nested/', 'one.js', 'sub/']);
test.deepEqual(result['./'], ['Project (LO)/', 'nested/', 'one.js', 'sub/']);
test.deepEqual(result['sub/'], ['one.js', 'two.js']);
this.on('end', test.done);
this.close();
Expand Down
2 changes: 1 addition & 1 deletion test/helper_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ exports.helper = {
'/Users/dude/www/sub/nested/one.js',
];
var expected = {
'.': ['one.js', 'two.js', 'sub/'],
'./': ['one.js', 'two.js', 'sub/'],
'sub/': ['one.js', 'nested/'],
'sub/nested/': ['one.js'],
};
Expand Down
4 changes: 2 additions & 2 deletions test/matching_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ exports.matching = {
test.expect(2);
gaze('**/*', function() {
this.relative(null, true, function(err, result) {
test.deepEqual(sortobj(result['.']), sortobj(['Project (LO)/', 'nested/', 'one.js', 'sub/']));
test.deepEqual(sortobj(result['./']), sortobj(['Project (LO)/', 'nested/', 'one.js', 'sub/']));
test.deepEqual(sortobj(result['sub/']), sortobj(['one.js', 'two.js']));
this.on('end', test.done);
this.close();
Expand All @@ -51,7 +51,7 @@ exports.matching = {
test.expect(2);
gaze(['*.js', 'sub/*.js'], function() {
this.relative(null, true, function(err, result) {
test.deepEqual(sortobj(result['.']), sortobj(['one.js', 'sub/']));
test.deepEqual(sortobj(result['./']), sortobj(['one.js', 'sub/']));
test.deepEqual(sortobj(result['sub/']), sortobj(['one.js', 'two.js']));
this.on('end', test.done);
this.close();
Expand Down
4 changes: 2 additions & 2 deletions test/watch_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exports.watch = {
this.remove(path.resolve(__dirname, 'fixtures'));
this.relative(null, true, function(err, result) {
test.deepEqual(result['sub/'], ['one.js']);
test.notDeepEqual(result['.'], ['one.js']);
test.notDeepEqual(result['./'], ['one.js']);
this.on('end', test.done);
this.close();
}.bind(this));
Expand Down Expand Up @@ -196,7 +196,7 @@ exports.watch = {
}, function(err, watcher) {
watcher.on('changed', function(filepath) {
this.relative(function(err, result) {
test.deepEqual(result, {'.':['two.js']});
test.deepEqual(result, {'./':['two.js']});
watcher.close();
});
});
Expand Down

0 comments on commit 3a60f7c

Please sign in to comment.