MCPcopy Index your code
hub / github.com/codeaashu/claude-code / fetchFromOrigin

Function fetchFromOrigin

src/utils/teleport.tsx:187–209  ·  view source on GitHub ↗

* Fetches a specific branch from remote origin * @param branch The branch to fetch. If not specified, fetches all branches.

(branch?: string)

Source from the content-addressed store, hash-verified

185 * @param branch The branch to fetch. If not specified, fetches all branches.
186 */
187async function fetchFromOrigin(branch?: string): Promise<void> {
188 const fetchArgs = branch ? ['fetch', 'origin', `${branch}:${branch}`] : ['fetch', 'origin'];
189 const {
190 code: fetchCode,
191 stderr: fetchStderr
192 } = await execFileNoThrow(gitExe(), fetchArgs);
193 if (fetchCode !== 0) {
194 // If fetching a specific branch fails, it might not exist locally yet
195 // Try fetching just the ref without mapping to local branch
196 if (branch && fetchStderr.includes('refspec')) {
197 logForDebugging(`Specific branch fetch failed, trying to fetch ref: ${branch}`);
198 const {
199 code: refFetchCode,
200 stderr: refFetchStderr
201 } = await execFileNoThrow(gitExe(), ['fetch', 'origin', branch]);
202 if (refFetchCode !== 0) {
203 logError(new Error(`Failed to fetch from remote origin: ${refFetchStderr}`));
204 }
205 } else {
206 logError(new Error(`Failed to fetch from remote origin: ${fetchStderr}`));
207 }
208 }
209}
210
211/**
212 * Ensures that the current branch has an upstream set

Callers 1

Calls 3

execFileNoThrowFunction · 0.85
logForDebuggingFunction · 0.85
logErrorFunction · 0.70

Tested by

no test coverage detected