Skip to content

Commit

Permalink
fix(push): "Cannot read property 'packfiles' of undefined" error (#1234)
Browse files Browse the repository at this point in the history
  • Loading branch information
billiegoose committed Sep 15, 2020
1 parent 3eeb9a8 commit 629b4e1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/api/packObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export async function packObjects({

return await _packObjects({
fs: new FileSystem(fs),
cache: {},
gitdir,
oids,
write,
Expand Down
1 change: 1 addition & 0 deletions src/commands/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export async function _fetch({
service: 'git-upload-pack',
url,
headers,
protocolVersion: 1,
})
const auth = remoteHTTP.auth // hack to get new credentials from CredentialManager API
const remoteRefs = remoteHTTP.refs
Expand Down
5 changes: 3 additions & 2 deletions src/commands/packObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ import { _pack } from './pack'
/**
* @param {object} args
* @param {import('../models/FileSystem.js').FileSystem} args.fs
* @param {any} args.cache
* @param {string} args.gitdir
* @param {string[]} args.oids
* @param {boolean} args.write
*
* @returns {Promise<PackObjectsResult>}
* @see PackObjectsResult
*/
export async function _packObjects({ fs, gitdir, oids, write }) {
const buffers = await _pack({ fs, gitdir, oids })
export async function _packObjects({ fs, cache, gitdir, oids, write }) {
const buffers = await _pack({ fs, cache, gitdir, oids })
const packfile = Buffer.from(await collect(buffers))
const packfileSha = packfile.slice(-20).toString('hex')
const filename = `pack-${packfileSha}.pack`
Expand Down
2 changes: 2 additions & 0 deletions src/commands/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export async function _push({
service: 'git-receive-pack',
url,
headers,
protocolVersion: 1,
})
const auth = httpRemote.auth // hack to get new credentials from CredentialManager API
let fullRemoteRef
Expand Down Expand Up @@ -240,6 +241,7 @@ export async function _push({
? []
: await _pack({
fs,
cache,
gitdir,
oids: [...objects],
})
Expand Down
2 changes: 1 addition & 1 deletion src/managers/GitRemoteHTTP.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class GitRemoteHTTP {
* @param {string} [args.corsProxy]
* @param {string} args.service
* @param {string} args.url
* @param {Object<string, string>} [args.headers]
* @param {Object<string, string>} args.headers
* @param {1 | 2} args.protocolVersion - Git Protocol Version
*/
static async discover({
Expand Down

0 comments on commit 629b4e1

Please sign in to comment.