Skip to content

Commit 7d0fc74

Browse files
author
R. Tyler Croy
authored
Merge pull request #78 from julie-ng/patch-1
Use standard git log command for short commit sha
2 parents 094fa9f + 960779c commit 7d0fc74

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pipeline-examples/gitcommit/gitcommit.groovy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22
// checked out your sources on the agent. A 'git' executable
33
// must be available.
44
// Most typical, if you're not cloning into a sub directory
5-
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
6-
// short SHA, possibly better for chat notifications, etc.
7-
shortCommit = gitCommit.take(6)
5+
shortCommit = sh(returnStdout: true, script: "git log -n 1 --pretty=format:'%h'").trim()

0 commit comments

Comments
 (0)