Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1997afc

Browse files
committed
stash files if cherry-pick conflict
1 parent01c7c98 commit1997afc

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

‎src/services/git/index.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,37 @@ import { exec, exists } from '../node'
33

44
constgitOrigin='coderoad'
55

6+
conststashAllFiles=async()=>{
7+
console.log('stashAllFiles')
8+
// stash files including untracked (eg. newly created file)
9+
const{ stdout, stderr}=awaitexec(`git stash --include-untracked`)
10+
if(stderr){
11+
console.error(stderr)
12+
thrownewError('Error stashing files')
13+
}
14+
}
15+
616
/*
717
SINGLE git cherry-pick %COMMIT%
818
MULTIPLE git cherry-pick %COMMIT_START%..%COMMIT_END%
919
if shell, run shell
20+
21+
if fails, will stash all
1022
*/
1123
exportasyncfunctiongitLoadCommits(actions:CR.TutorialAction,dispatch:CR.EditorDispatch):Promise<void>{
1224
const{ commits, commands, files}=actions
1325

1426
for(constcommitofcommits){
27+
// pull a commit from tutorial repo
1528
const{ stdout, stderr}=awaitexec(`git cherry-pick${commit}`)
1629
if(stderr){
17-
console.error(stderr)
18-
thrownewError('Error loading commit')
30+
console.warn('cherry-pick failed')
31+
// likely merge conflict with cherry-pick
32+
awaitstashAllFiles()
33+
const{stderr:secondFailure}=awaitexec(`git cherry-pick${commit}`)
34+
if(secondFailure){
35+
thrownewError('Error loading commit')
36+
}
1937
}
2038
}
2139

@@ -25,7 +43,6 @@ export async function gitLoadCommits(actions: CR.TutorialAction, dispatch: CR.Ed
2543
const{ stdout, stderr}=awaitexec(command)
2644
if(stderr){
2745
console.error(stderr)
28-
2946
if(stderr.match(/node-gyp/)){
3047
// ignored error
3148
thrownewError('Error running setup command')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp