Skip to content

Commit

Permalink
attempt-backport: simplify git steps
Browse files Browse the repository at this point in the history
- Resetting *before* checkout is probably actually faulty logic as
described in
nodejs#100 (comment)

- Resetting after checkout is unnecessary because we check out the
origin/ branch so the HEAD becomes detached.

PR-URL: nodejs#107
  • Loading branch information
Fishrock123 committed Dec 22, 2016
1 parent 042970b commit 3c2a290
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions scripts/attempt-backport.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,10 @@ function attemptBackport (options, version, isLTS, cb) {
debug(`error before exit, code: ${code}, on '${argsString}'`)
return
}
gitResetBefore()
gitRemoteUpdate()
})
}

function gitResetBefore () {
options.logger.debug(`resetting origin/v${version}.x-staging...`)
wrapCP('git', ['reset', `origin/v${version}.x-staging`, '--hard'], gitRemoteUpdate)
}

function gitRemoteUpdate () {
options.logger.debug('updating git remotes...')
wrapCP('git', ['remote', 'update', '-p'], gitCheckout)
Expand All @@ -176,12 +171,7 @@ function attemptBackport (options, version, isLTS, cb) {
}

function gitClean_fd () {
wrapCP('git', ['clean', '-fd'], gitReset)
}

function gitReset () {
options.logger.debug(`resetting origin/v${version}.x-staging...`)
wrapCP('git', ['reset', `origin/v${version}.x-staging`, '--hard'], fetchDiff)
wrapCP('git', ['clean', '-fd'], fetchDiff)
}

function fetchDiff () {
Expand Down

0 comments on commit 3c2a290

Please sign in to comment.