Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ipfs/js-ipfs-utils
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.7.1
Choose a base ref
...
head repository: ipfs/js-ipfs-utils
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.7.2
Choose a head ref
  • 3 commits
  • 4 files changed
  • 2 contributors

Commits on Feb 10, 2020

  1. fix: number is not a valid mtime value (#24)

    * fix: number is not a valid mtime value
    
    See https://github.com/ipfs/js-ipfs-unixfs#create-an-unixfs-data-element  - it should be `Date | object | array`.
    
    Ends up ignored https://github.com/ipfs/js-ipfs-unixfs/blob/master/src/index.js#L104-L106
    
    * refactor: use stat.mtime, it is already a Date
    Alan Shaw authored Feb 10, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    bb2d841 View commit details
  2. chore: update contributors

    hugomrdias committed Feb 10, 2020

    Unverified

    This user has not yet uploaded their public signing key.
    Copy the full SHA
    e99e03f View commit details
  3. Unverified

    This user has not yet uploaded their public signing key.
    Copy the full SHA
    4c0a383 View commit details
Showing with 27 additions and 17 deletions.
  1. +10 −0 CHANGELOG.md
  2. +1 −1 package.json
  3. +2 −2 src/files/glob-source.js
  4. +14 −14 test/files/glob-source.spec.js
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<a name="0.7.2"></a>
## [0.7.2](https://github.com/ipfs/js-ipfs-utils/compare/v0.7.1...v0.7.2) (2020-02-10)


### Bug Fixes

* number is not a valid mtime value ([#24](https://github.com/ipfs/js-ipfs-utils/issues/24)) ([bb2d841](https://github.com/ipfs/js-ipfs-utils/commit/bb2d841)), closes [/github.com/ipfs/js-ipfs-unixfs/blob/master/src/index.js#L104-L106](https://github.com//github.com/ipfs/js-ipfs-unixfs/blob/master/src/index.js/issues/L104-L106)



<a name="0.7.1"></a>
## [0.7.1](https://github.com/ipfs/js-ipfs-utils/compare/v0.7.0...v0.7.1) (2020-01-23)

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ipfs-utils",
"version": "0.7.1",
"version": "0.7.2",
"description": "Package to aggregate shared logic and dependencies for the IPFS ecosystem",
"main": "src/index.js",
"author": "Hugo Dias <hugomrdias@gmail.com>",
4 changes: 2 additions & 2 deletions src/files/glob-source.js
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ module.exports = async function * globSource (paths, options) {
let mtime = options.mtime

if (options.preserveMtime) {
mtime = parseInt(stat.mtimeMs / 1000)
mtime = stat.mtime
}

if (stat.isDirectory()) {
@@ -122,7 +122,7 @@ async function * toGlobSource ({ path, type, prefix, mode, mtime, preserveMode,
}

if (preserveMtime) {
mtime = parseInt(stat.mtimeMs / 1000)
mtime = stat.mtime
}
}

28 changes: 14 additions & 14 deletions test/files/glob-source.spec.js
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ function findMode (file) {
}

function findMtime (file) {
return parseInt(fs.statSync(fixture(file)).mtimeMs / 1000)
return fs.statSync(fixture(file)).mtime
}

describe('glob-source', () => {
@@ -193,17 +193,17 @@ describe('glob-source', () => {

expect(result).to.have.lengthOf(6)
expect(result).to.have.nested.property('[0].path', '/dir')
expect(result).to.have.nested.property('[0].mtime', findMtime('/dir'))
expect(result).to.have.deep.nested.property('[0].mtime', findMtime('/dir'))
expect(result).to.have.nested.property('[1].path', '/dir/file-1.txt')
expect(result).to.have.nested.property('[1].mtime', findMtime('/dir/file-1.txt'))
expect(result).to.have.deep.nested.property('[1].mtime', findMtime('/dir/file-1.txt'))
expect(result).to.have.nested.property('[2].path', '/dir/file-2.js')
expect(result).to.have.nested.property('[2].mtime', findMtime('/dir/file-2.js'))
expect(result).to.have.deep.nested.property('[2].mtime', findMtime('/dir/file-2.js'))
expect(result).to.have.nested.property('[3].path', '/dir/file-3.css')
expect(result).to.have.nested.property('[3].mtime', findMtime('/dir/file-3.css'))
expect(result).to.have.deep.nested.property('[3].mtime', findMtime('/dir/file-3.css'))
expect(result).to.have.nested.property('[4].path', '/dir/nested-dir')
expect(result).to.have.nested.property('[4].mtime', findMtime('/dir/nested-dir'))
expect(result).to.have.deep.nested.property('[4].mtime', findMtime('/dir/nested-dir'))
expect(result).to.have.nested.property('[5].path', '/dir/nested-dir/other.txt')
expect(result).to.have.nested.property('[5].mtime', findMtime('/dir/nested-dir/other.txt'))
expect(result).to.have.deep.nested.property('[5].mtime', findMtime('/dir/nested-dir/other.txt'))
})

it('overrides mtime for directories', async function () {
@@ -213,21 +213,21 @@ describe('glob-source', () => {

const result = await all(globSource(fixture('/dir'), {
recursive: true,
mtime: 5
mtime: new Date(5)
}))

expect(result).to.have.lengthOf(6)
expect(result).to.have.nested.property('[0].path', '/dir')
expect(result).to.have.nested.property('[0].mtime', 5)
expect(result).to.have.deep.nested.property('[0].mtime', new Date(5))
expect(result).to.have.nested.property('[1].path', '/dir/file-1.txt')
expect(result).to.have.nested.property('[1].mtime', 5)
expect(result).to.have.deep.nested.property('[1].mtime', new Date(5))
expect(result).to.have.nested.property('[2].path', '/dir/file-2.js')
expect(result).to.have.nested.property('[2].mtime', 5)
expect(result).to.have.deep.nested.property('[2].mtime', new Date(5))
expect(result).to.have.nested.property('[3].path', '/dir/file-3.css')
expect(result).to.have.nested.property('[3].mtime', 5)
expect(result).to.have.deep.nested.property('[3].mtime', new Date(5))
expect(result).to.have.nested.property('[4].path', '/dir/nested-dir')
expect(result).to.have.nested.property('[4].mtime', 5)
expect(result).to.have.deep.nested.property('[4].mtime', new Date(5))
expect(result).to.have.nested.property('[5].path', '/dir/nested-dir/other.txt')
expect(result).to.have.nested.property('[5].mtime', 5)
expect(result).to.have.deep.nested.property('[5].mtime', new Date(5))
})
})