@@ -13,12 +13,14 @@ import Arweave from "arweave";
1313import {
1414 getRefsOnArweave ,
1515 pushGitObject ,
16+ makeDataItem ,
1617 updateRef ,
1718 parseArgitRemoteURI ,
19+ postBundledTransaction ,
1820} from "./lib/arweave.js" ;
1921
20- import * as deepHash from "../node_modules/ arweave/node/lib/deephash .js" ;
21- import ArweaveData from "../node_modules/ arweave-data/pkg/dist-node/index.js" ;
22+ import * as deepHash from "arweave/node/lib/deepHash .js" ;
23+ import ArweaveData from "arweave-data/pkg/dist-node/index.js" ;
2224
2325const _timeout = async ( duration ) => {
2426 return new Promise ( ( resolve , reject ) => {
@@ -79,11 +81,9 @@ export default class Helper {
7981 const deps = {
8082 utils : Arweave . utils ,
8183 crypto : Arweave . crypto ,
82- deepHash : deepHash ,
84+ deepHash : deepHash . default . default ,
8385 } ;
84- console . error ( ArweaveData . default ) ;
8586 this . ArData = ArweaveData . default ( deps ) ;
86- console . error ( this . ArData ) ;
8787 }
8888
8989 // OK
@@ -131,7 +131,7 @@ export default class Helper {
131131 forPush ? this . debug ( "cmd" , "list" , "for-push" ) : this . debug ( "cmd, list" ) ;
132132
133133 const refs = await this . _fetchRefs ( ) ;
134-
134+ console . error ( "refs" , refs ) ;
135135 // tslint:disable-next-line:forin
136136 for ( const ref in refs ) {
137137 this . _send ( refs [ ref ] + " " + ref ) ;
@@ -255,13 +255,14 @@ export default class Helper {
255255 try {
256256 const refs = await this . _fetchRefs ( ) ;
257257 const remote = refs [ dst ] ;
258+ const dataItems = [ ] ;
258259
259260 const srcBranch = src . split ( "/" ) . pop ( ) ;
260261 const dstBranch = dst . split ( "/" ) . pop ( ) ;
261262
262263 const revListCmd = remote
263264 ? `git rev-list --objects --left-only ${ srcBranch } ...${ this . name } /${ dstBranch } `
264- : " git rev-list --objects --all" ;
265+ : ` git rev-list --objects ${ srcBranch } ` ;
265266
266267 const objects = shell
267268 . exec ( revListCmd , { silent : true } )
@@ -299,10 +300,16 @@ export default class Helper {
299300
300301 for ( const oid of objects ) {
301302 const object = await this . git . load ( oid ) ;
302- // Check object already exists on arweave before pushing
303- puts . push (
304- pushGitObject ( this . _arweave , this . wallet , this . url , oid , object )
303+
304+ const dataItem = await makeDataItem (
305+ this . ArData ,
306+ this . wallet ,
307+ this . url ,
308+ oid ,
309+ object
305310 ) ;
311+ console . error ( "oid" , oid ) ;
312+ dataItems . push ( dataItem ) ;
306313 }
307314
308315 head = objects [ 0 ] ;
@@ -316,7 +323,12 @@ export default class Helper {
316323 // upload git objects
317324 try {
318325 spinner = ora ( "Uploading git objects to arweave" ) . start ( ) ;
319- await Promise . all ( puts ) ;
326+ await postBundledTransaction (
327+ this . _arweave ,
328+ this . ArData ,
329+ this . wallet ,
330+ dataItems
331+ ) ;
320332 spinner . succeed ( "Git objects uploaded to arweave" ) ;
321333 } catch ( err ) {
322334 spinner . fail (
0 commit comments