Skip to content

Commit

Permalink
fix: improperly running root submodule commands in submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorhugods committed Apr 29, 2024
1 parent b0731e3 commit 4a68cb2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 25 deletions.
16 changes: 4 additions & 12 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

16 changes: 4 additions & 12 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ export async function fastForwardSubmodule(
await gitExec(['checkout', '-b', tempBranchName])
await gitExec(['-C', submoduleName, 'checkout', targetBranch])
await gitExec(['-C', submoduleName, 'pull', 'origin', targetBranch])
await gitExec(['add', submoduleName])
await gitExec([
'-C',
submoduleName,
'commit',
'-m',
`Update submodule ${submoduleName} to latest from ${targetBranch}`
Expand All @@ -69,16 +68,9 @@ export async function fastForwardSubmodule(
throw Error('Unable to resolve merge commit reference')
}
const lastCommitMessage = (
await gitExec([
'-C',
submoduleName,
'log',
'--format=%B',
'-n',
'1',
commitSha
])
await gitExec(['log', '--format=%B', '-n', '1', commitSha])
).stdout
await gitExec(['reset', '--soft', 'HEAD~2'])
await gitExec(['commit', '-m', lastCommitMessage])
}

Expand Down Expand Up @@ -110,7 +102,7 @@ export async function cherryPickChangesToNewBranch(
await gitExec(['checkout', '-b', newBranchName])
const cherryPickResult = (await gitExec(['cherry-pick', cherryPickCommit]))
.stdout
const hasConflicts = cherryPickResult.includes('Merge conflict in')
const hasConflicts = cherryPickResult.includes('CONFLICT')
if (hasConflicts) {
await gitExec(['add', '.'])
let message = 'Commit with unresolved merge conflicts'
Expand Down

0 comments on commit 4a68cb2

Please sign in to comment.