Skip to content

Commit 432035e

Browse files
committed
Revert 1283cb7 that was accidentally released as a patch
1 parent 84847c6 commit 432035e

File tree

3 files changed

+1
-68
lines changed

3 files changed

+1
-68
lines changed

README.md

+1-21
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ It is also possible to use [path substitutions](https://webpack.js.org/configura
5353
- `[git-revision-version]`
5454
- `[git-revision-hash]`
5555
- `[git-revision-branch]` (only [when branch is enabled](#branch-false))
56-
- `[git-revision-last-commit-datetime]`
5756

5857
Example:
5958

@@ -68,7 +67,7 @@ module.exports = {
6867

6968
## Plugin API
7069

71-
The `VERSION`, `COMMITHASH`, `LASTCOMMITDATETIME` and `BRANCH` are also exposed through a public API.
70+
The `VERSION`, `COMMITHASH` and `BRANCH` are also exposed through a public API.
7271

7372
Example using the [DefinePlugin](https://webpack.js.org/plugins/define-plugin/#usage):
7473

@@ -84,7 +83,6 @@ module.exports = {
8483
'VERSION': JSON.stringify(gitRevisionPlugin.version()),
8584
'COMMITHASH': JSON.stringify(gitRevisionPlugin.commithash()),
8685
'BRANCH': JSON.stringify(gitRevisionPlugin.branch()),
87-
'LASTCOMMITDATETIME': JSON.stringify(gitRevisionPlugin.lastcommitdatetime()),
8886
})
8987
]
9088
}
@@ -180,24 +178,6 @@ module.exports = {
180178
}
181179
```
182180

183-
### `lastCommitDateTimeCommand: 'log -1 --format=%cI'`
184-
185-
To change the default `git` command used to read the value of `LASTCOMMITDATETIME`.
186-
187-
This configuration is not not meant to accept arbitrary user input and it is executed by the plugin without any sanitization.
188-
189-
```javascript
190-
var GitRevisionPlugin = require('git-revision-webpack-plugin')
191-
192-
module.exports = {
193-
plugins: [
194-
new GitRevisionPlugin({
195-
branchCommand: 'log -1 --format=%ci'
196-
})
197-
]
198-
}
199-
```
200-
201181
## Outdated webpack
202182

203183
If your project is **not using webpack version 4 or greater**, you will need to install an older version of this package:

lib/index.js

-19
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ var runGitCommand = require('./helpers/run-git-command')
44
var COMMITHASH_COMMAND = 'rev-parse HEAD'
55
var VERSION_COMMAND = 'describe --always'
66
var BRANCH_COMMAND = 'rev-parse --abbrev-ref HEAD'
7-
var LASTCOMMITDATETIME_COMMAND = 'log -1 --format=%cI'
87

98
function GitRevisionPlugin (options) {
109
options = options || {}
@@ -22,9 +21,6 @@ function GitRevisionPlugin (options) {
2221
this.branchCommand = options.branchCommand ||
2322
BRANCH_COMMAND
2423

25-
this.lastCommitDateTimeCommand = options.lastCommitDateTimeCommand ||
26-
LASTCOMMITDATETIME_COMMAND
27-
2824
if (options.versionCommand && options.lightweightTags) {
2925
throw new Error('lightweightTags can\'t be used together versionCommand')
3026
}
@@ -47,14 +43,6 @@ GitRevisionPlugin.prototype.apply = function (compiler) {
4743
asset: 'VERSION'
4844
})
4945

50-
buildFile({
51-
compiler: compiler,
52-
gitWorkTree: this.gitWorkTree,
53-
command: this.lastCommitDateTimeCommand,
54-
replacePattern: /\[git-revision-last-commit-datetime\]/gi,
55-
asset: 'LASTCOMMITDATETIME'
56-
})
57-
5846
if (this.createBranchFile) {
5947
buildFile({
6048
compiler: compiler,
@@ -87,11 +75,4 @@ GitRevisionPlugin.prototype.branch = function () {
8775
)
8876
}
8977

90-
GitRevisionPlugin.prototype.lastcommitdatetime = function () {
91-
return runGitCommand(
92-
this.gitWorkTree,
93-
this.lastCommitDateTimeCommand
94-
)
95-
}
96-
9778
module.exports = GitRevisionPlugin

lib/index.spec.js

-28
Original file line numberDiff line numberDiff line change
@@ -102,32 +102,4 @@ describe('git-revision-webpack-plugin (unit)', function () {
102102
expect(runGitCommand.args[0][1]).to.eql('custom branch command')
103103
})
104104
})
105-
106-
describe('on setting custom last commit date time command', function () {
107-
it('should run the build on .apply', function () {
108-
var buildFile = sinon.spy()
109-
GitRevisionPlugin.__set__('buildFile', buildFile)
110-
111-
new GitRevisionPlugin({
112-
lastCommitDateTimeCommand: 'custom last commit date time command'
113-
}).apply()
114-
115-
var lastCommitDateTimeCall = buildFile.args.find(function (calls) {
116-
return calls[0].asset === 'LASTCOMMITDATETIME'
117-
})
118-
119-
expect(lastCommitDateTimeCall[0].command).to.eql('custom last commit date time command')
120-
})
121-
122-
it('should run the custom git command on .lastcommitdatetime', function () {
123-
var runGitCommand = sinon.spy()
124-
GitRevisionPlugin.__set__('runGitCommand', runGitCommand)
125-
126-
new GitRevisionPlugin({
127-
lastCommitDateTimeCommand: 'custom last commit date time command'
128-
}).lastcommitdatetime()
129-
130-
expect(runGitCommand.args[0][1]).to.eql('custom last commit date time command')
131-
})
132-
})
133105
})

0 commit comments

Comments
 (0)