A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/isomorphic-git/isomorphic-git/commit/ccb526cdc818405d95f53c0fab6b27e858da2eff below:

remove date option from author/committer/tagger (#1052) · isomorphic-git/isomorphic-git@ccb526c · GitHub

File tree Expand file treeCollapse file tree 11 files changed

+20

-36

lines changed

Filter options

Expand file treeCollapse file tree 11 files changed

+20

-36

lines changed Original file line number Diff line number Diff line change

@@ -34,9 +34,6 @@ The following environments are tested in CI and will continue to be supported un

34 34 35 35

## 1.0 Breaking Changes

36 36 37 -

TODO:

38 -

- [ ] I should probably normalize on timestamps and get rid of the `date` options.

39 - 40 37

### Big changes

41 38

- [x] The supported node & browser versions have been bumped. (See beautiful table above.)

42 39

- [x] The plugin system has been eliminated and we're back to plain old dependency injection via function arguments! The plugin cores created a mysterious "global state" that makes it easy to trip up (I myself sometimes forgot to unset plugins after running tests). The old style of passing `fs` as a function argument was less aesthetic and more verbose, but it is a much simpler model than the plugin core model, and much safer because it makes it impossible for dependencies to accidentally share the default plugin core.

@@ -64,6 +61,7 @@ TODO:

64 61

- [x] The `autoTranslateSSH` feature was removed, since it is trivial to implement your own version using just the `UnknownTransportError.data.suggestion`

65 62

- [x] The `writeObject` function when used to write a tree now expects a plain array rather than an object with a property called `entries` which is the array. (This is so that argument to `writeObject` has the same shame as the arguments to `writeBlob`/`writeCommit`/`writeTag`/`writeTree`.)

66 63

- [x] The `noOverwrite` parameter was removed from `init` and is the new behavior.

64 +

- [x] The `author.date`, `committer.date`, `tagger.date` parameters were removed in favor of `author.timestamp`, `comitter.timestamp`, `tagger.timestamp` in order to be clear about what is actually written and better reflect the return types in `readCommit`, `log`, and `readTag`.

67 65 68 66

### The return types of some functions have changed:

69 67

- [x] Functions that used to return `Buffer` objects now return `Uint8Array` objects. (This is so we can eventually remove all internal dependencies on the Buffer browser polyfill, which is quite heavy!)

Original file line number Diff line number Diff line change

@@ -24,14 +24,12 @@ import { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'

24 24

* @param {Object} [args.author] - The details about the author.

25 25

* @param {string} [args.author.name] - Default is `user.name` config.

26 26

* @param {string} [args.author.email] - Default is `user.email` config.

27 -

* @param {Date} [args.author.date] - Set the author timestamp field. Default is the current date.

28 -

* @param {number} [args.author.timestamp] - Set the author timestamp field. This is an alternative to using `date` using an integer number of seconds since the Unix epoch instead of a JavaScript date object.

27 +

* @param {number} [args.author.timestamp=Math.floor(Date.now()/1000)] - Set the author timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).

29 28

* @param {number} [args.author.timezoneOffset] - Set the author timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.

30 29

* @param {Object} [args.committer = author] - The details about the note committer, in the same format as the author parameter. If not specified, the author details are used.

31 30

* @param {string} [args.committer.name] - Default is `user.name` config.

32 31

* @param {string} [args.committer.email] - Default is `user.email` config.

33 -

* @param {Date} [args.committer.date] - Set the committer timestamp field. Default is the current date.

34 -

* @param {number} [args.committer.timestamp] - Set the committer timestamp field. This is an alternative to using `date` using an integer number of seconds since the Unix epoch instead of a JavaScript date object.

32 +

* @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).

35 33

* @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.

36 34

* @param {string} [args.signingKey] - Sign the note commit using this private PGP key.

37 35

*

Original file line number Diff line number Diff line change

@@ -22,8 +22,7 @@ import { normalizeAuthorObject } from '../utils/normalizeAuthorObject.js'

22 22

* @param {object} [args.tagger] - The details about the tagger.

23 23

* @param {string} [args.tagger.name] - Default is `user.name` config.

24 24

* @param {string} [args.tagger.email] - Default is `user.email` config.

25 -

* @param {Date} [args.tagger.date] - Set the tagger timestamp field. Default is the current date.

26 -

* @param {number} [args.tagger.timestamp] - Set the tagger timestamp field. This is an alternative to using `date` using an integer number of seconds since the Unix epoch instead of a JavaScript date object.

25 +

* @param {number} [args.tagger.timestamp=Math.floor(Date.now()/1000)] - Set the tagger timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).

27 26

* @param {number} [args.tagger.timezoneOffset] - Set the tagger timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.

28 27

* @param {string} [args.gpgsig] - The gpgsig attatched to the tag object. (Mutually exclusive with the `signingKey` option.)

29 28

* @param {string} [args.signingKey] - Sign the tag object using this private PGP key. (Mutually exclusive with the `gpgsig` option.)

Original file line number Diff line number Diff line change

@@ -21,14 +21,12 @@ import { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'

21 21

* @param {Object} [args.author] - The details about the author.

22 22

* @param {string} [args.author.name] - Default is `user.name` config.

23 23

* @param {string} [args.author.email] - Default is `user.email` config.

24 -

* @param {Date} [args.author.date] - Set the author timestamp field. Default is the current date.

25 -

* @param {number} [args.author.timestamp] - Set the author timestamp field. This is an alternative to using `date` using an integer number of seconds since the Unix epoch instead of a JavaScript date object.

24 +

* @param {number} [args.author.timestamp=Math.floor(Date.now()/1000)] - Set the author timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).

26 25

* @param {number} [args.author.timezoneOffset] - Set the author timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.

27 26

* @param {Object} [args.committer = author] - The details about the commit committer, in the same format as the author parameter. If not specified, the author details are used.

28 27

* @param {string} [args.committer.name] - Default is `user.name` config.

29 28

* @param {string} [args.committer.email] - Default is `user.email` config.

30 -

* @param {Date} [args.committer.date] - Set the committer timestamp field. Default is the current date.

31 -

* @param {number} [args.committer.timestamp] - Set the committer timestamp field. This is an alternative to using `date` using an integer number of seconds since the Unix epoch instead of a JavaScript date object.

29 +

* @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).

32 30

* @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.

33 31

* @param {string} [args.signingKey] - Sign the tag object using this private PGP key.

34 32

* @param {boolean} [args.dryRun = false] - If true, simulates making a commit so you can test whether it would succeed. Implies `noUpdateBranch`.

@@ -45,7 +43,7 @@ import { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'

45 43

* dir: '/tutorial',

46 44

* author: {

47 45

* name: 'Mr. Test',

48 -

* email: 'mrtest@example.com'

46 +

* email: 'mrtest@example.com',

49 47

* },

50 48

* message: 'Added the a.txt file'

51 49

* })

Original file line number Diff line number Diff line change

@@ -46,14 +46,12 @@ import { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'

46 46

* @param {Object} [args.author] - passed to [commit](commit.md) when creating a merge commit

47 47

* @param {string} [args.author.name] - Default is `user.name` config.

48 48

* @param {string} [args.author.email] - Default is `user.email` config.

49 -

* @param {Date} [args.author.date] - Set the author timestamp field. Default is the current date.

50 -

* @param {number} [args.author.timestamp] - Set the author timestamp field. This is an alternative to using `date` using an integer number of seconds since the Unix epoch instead of a JavaScript date object.

49 +

* @param {number} [args.author.timestamp=Math.floor(Date.now()/1000)] - Set the author timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).

51 50

* @param {number} [args.author.timezoneOffset] - Set the author timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.

52 51

* @param {Object} [args.committer] - passed to [commit](commit.md) when creating a merge commit

53 52

* @param {string} [args.committer.name] - Default is `user.name` config.

54 53

* @param {string} [args.committer.email] - Default is `user.email` config.

55 -

* @param {Date} [args.committer.date] - Set the committer timestamp field. Default is the current date.

56 -

* @param {number} [args.committer.timestamp] - Set the committer timestamp field. This is an alternative to using `date` using an integer number of seconds since the Unix epoch instead of a JavaScript date object.

54 +

* @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).

57 55

* @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.

58 56

* @param {string} [args.signingKey] - passed to [commit](commit.md) when creating a merge commit

59 57

*

Original file line number Diff line number Diff line change

@@ -30,14 +30,12 @@ import { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'

30 30

* @param {Object} [args.author] - The details about the author.

31 31

* @param {string} [args.author.name] - Default is `user.name` config.

32 32

* @param {string} [args.author.email] - Default is `user.email` config.

33 -

* @param {Date} [args.author.date] - Set the author timestamp field. Default is the current date.

34 -

* @param {number} [args.author.timestamp] - Set the author timestamp field. This is an alternative to using `date` using an integer number of seconds since the Unix epoch instead of a JavaScript date object.

33 +

* @param {number} [args.author.timestamp=Math.floor(Date.now()/1000)] - Set the author timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).

35 34

* @param {number} [args.author.timezoneOffset] - Set the author timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.

36 35

* @param {Object} [args.committer = author] - The details about the commit committer, in the same format as the author parameter. If not specified, the author details are used.

37 36

* @param {string} [args.committer.name] - Default is `user.name` config.

38 37

* @param {string} [args.committer.email] - Default is `user.email` config.

39 -

* @param {Date} [args.committer.date] - Set the committer timestamp field. Default is the current date.

40 -

* @param {number} [args.committer.timestamp] - Set the committer timestamp field. This is an alternative to using `date` using an integer number of seconds since the Unix epoch instead of a JavaScript date object.

38 +

* @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).

41 39

* @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.

42 40

* @param {string} [args.signingKey] - passed to [commit](commit.md) when creating a merge commit

43 41

*

Original file line number Diff line number Diff line change

@@ -22,14 +22,12 @@ import { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'

22 22

* @param {Object} [args.author] - The details about the author.

23 23

* @param {string} [args.author.name] - Default is `user.name` config.

24 24

* @param {string} [args.author.email] - Default is `user.email` config.

25 -

* @param {Date} [args.author.date] - Set the author timestamp field. Default is the current date.

26 -

* @param {number} [args.author.timestamp] - Set the author timestamp field. This is an alternative to using `date` using an integer number of seconds since the Unix epoch instead of a JavaScript date object.

25 +

* @param {number} [args.author.timestamp=Math.floor(Date.now()/1000)] - Set the author timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).

27 26

* @param {number} [args.author.timezoneOffset] - Set the author timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.

28 27

* @param {Object} [args.committer = author] - The details about the note committer, in the same format as the author parameter. If not specified, the author details are used.

29 28

* @param {string} [args.committer.name] - Default is `user.name` config.

30 29

* @param {string} [args.committer.email] - Default is `user.email` config.

31 -

* @param {Date} [args.committer.date] - Set the committer timestamp field. Default is the current date.

32 -

* @param {number} [args.committer.timestamp] - Set the committer timestamp field. This is an alternative to using `date` using an integer number of seconds since the Unix epoch instead of a JavaScript date object.

30 +

* @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).

33 31

* @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.

34 32

* @param {string} [args.signingKey] - Sign the tag object using this private PGP key.

35 33

*

Original file line number Diff line number Diff line change

@@ -20,13 +20,11 @@ import { E, GitError } from '../models/GitError.js'

20 20

* @param {Object} args.author

21 21

* @param {string} args.author.name

22 22

* @param {string} args.author.email

23 -

* @param {Date} args.author.date

24 23

* @param {number} args.author.timestamp

25 24

* @param {number} args.author.timezoneOffset

26 25

* @param {Object} args.committer

27 26

* @param {string} args.committer.name

28 27

* @param {string} args.committer.email

29 -

* @param {Date} args.committer.date

30 28

* @param {number} args.committer.timestamp

31 29

* @param {number} args.committer.timezoneOffset

32 30

* @param {string} [args.signingKey]

Original file line number Diff line number Diff line change

@@ -20,7 +20,6 @@ import { writeObject } from '../storage/writeObject.js'

20 20

* @param {object} [args.tagger]

21 21

* @param {string} args.tagger.name

22 22

* @param {string} args.tagger.email

23 -

* @param {Date} args.tagger.date

24 23

* @param {number} args.tagger.timestamp

25 24

* @param {number} args.tagger.timezoneOffset

26 25

* @param {string} [args.gpgsig]

Original file line number Diff line number Diff line change

@@ -5,18 +5,19 @@ import { getConfig } from '../commands/getConfig'

5 5

* @returns {Promise<void | {name: string, email: string, date: Date, timestamp: number, timezoneOffset: number }>}

6 6

*/

7 7

export async function normalizeAuthorObject({ fs, gitdir, author = {} }) {

8 -

let { name, email, date, timestamp, timezoneOffset } = author

8 +

let { name, email, timestamp, timezoneOffset } = author

9 9

name = name || (await getConfig({ fs, gitdir, path: 'user.name' }))

10 10

email = email || (await getConfig({ fs, gitdir, path: 'user.email' }))

11 11 12 12

if (name === undefined || email === undefined) {

13 13

return undefined

14 14

}

15 15 16 -

date = date || new Date()

17 -

timestamp = timestamp != null ? timestamp : Math.floor(date.valueOf() / 1000)

16 +

timestamp = timestamp != null ? timestamp : Math.floor(Date.now() / 1000)

18 17

timezoneOffset =

19 -

timezoneOffset != null ? timezoneOffset : date.getTimezoneOffset()

18 +

timezoneOffset != null

19 +

? timezoneOffset

20 +

: new Date(timestamp * 1000).getTimezoneOffset()

20 21 21 -

return { name, email, date, timestamp, timezoneOffset }

22 +

return { name, email, timestamp, timezoneOffset }

22 23

}

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4