Skip to content

Commit 0449b75

Browse files
committed
fix: remove 'git fetch origin' command to avoid 'upload-pack: not our ref' error
1 parent f4f06bf commit 0449b75

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

src/bundle/bundle.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { tmpdir } from 'os'
44

55
import { info, rmRf, execCommand, buildBundleConfig, mkdir } from './utils'
66
import type { BundleArgs, BundlerConfig, Hashes } from './types'
7-
import { checkout, fetchOrigin, gitRestore } from './git'
7+
import { checkout, gitRestore } from './git'
88
import { hashes, removeUnchangedAssets } from './diff'
99

1010
const {
@@ -78,7 +78,6 @@ const bundleReactNative = async (config: BundlerConfig, shouldBuildSourceMaps?:
7878
}
7979

8080
const checkoutAndBuild = async (bundlerConfig: BundlerConfig, commit: string) => {
81-
await fetchOrigin()
8281
await checkout(commit)
8382
const output = await bundleReactNative(bundlerConfig, false)
8483
await gitRestore()

src/bundle/git.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
import simpleGit from 'simple-git'
1+
import child from 'child_process'
22
import { info } from './utils'
33

4-
const git = simpleGit()
5-
6-
export async function fetchOrigin() {
7-
await git.fetch('origin')
8-
}
9-
104
export async function checkout(commit: string) {
115
info(`Switch to ${commit}`)
12-
await git.checkout(commit)
6+
child.execSync(`git checkout ${commit}`)
137
}
148

159
export async function gitRestore() {
16-
await git.raw(['switch', '-'])
10+
info('Restore to previous branch')
11+
child.execSync('git switch -')
1712
}

0 commit comments

Comments
 (0)