commands: use Await() to wait after pointers have been sent

This commit is contained in:
Taylor Blau 2016-12-29 14:30:58 -07:00
parent 8c663a770b
commit c405f2f67a
3 changed files with 10 additions and 5 deletions

@ -84,6 +84,8 @@ func prePushCommand(cmd *cobra.Command, args []string) {
} }
uploadPointers(ctx, pointers) uploadPointers(ctx, pointers)
} }
ctx.Await()
} }
func scanLeft(g *lfs.GitScanner, ref string) ([]*lfs.WrappedPointer, error) { func scanLeft(g *lfs.GitScanner, ref string) ([]*lfs.WrappedPointer, error) {

@ -42,6 +42,8 @@ func uploadsBetweenRefAndRemote(ctx *uploadContext, refnames []string) {
} }
uploadPointers(ctx, pointers) uploadPointers(ctx, pointers)
} }
ctx.Await()
} }
func scanLeftOrAll(g *lfs.GitScanner, ref string) ([]*lfs.WrappedPointer, error) { func scanLeftOrAll(g *lfs.GitScanner, ref string) ([]*lfs.WrappedPointer, error) {
@ -77,6 +79,8 @@ func uploadsWithObjectIDs(ctx *uploadContext, oids []string) {
pointers[idx] = &lfs.WrappedPointer{Pointer: &lfs.Pointer{Oid: oid}} pointers[idx] = &lfs.WrappedPointer{Pointer: &lfs.Pointer{Oid: oid}}
} }
uploadPointers(ctx, pointers) uploadPointers(ctx, pointers)
ctx.Await()
} }
func refsByNames(refnames []string) ([]*git.Ref, error) { func refsByNames(refnames []string) ([]*git.Ref, error) {

@ -132,7 +132,7 @@ begin_test "push --all (no ref args)"
[ $(grep -c "push" < push.log) -eq 6 ] [ $(grep -c "push" < push.log) -eq 6 ]
git push --all origin 2>&1 | tee push.log git push --all origin 2>&1 | tee push.log
[ $(grep -c "(3 of 3 files)" push.log) -eq 2 ] [ $(grep -c "(6 of 6 files)" push.log) -eq 1 ]
assert_server_object "$reponame-$suffix" "$oid1" assert_server_object "$reponame-$suffix" "$oid1"
assert_server_object "$reponame-$suffix" "$oid2" assert_server_object "$reponame-$suffix" "$oid2"
assert_server_object "$reponame-$suffix" "$oid3" assert_server_object "$reponame-$suffix" "$oid3"
@ -162,10 +162,9 @@ begin_test "push --all (no ref args)"
[ $(grep -c "push" push.log) -eq 6 ] [ $(grep -c "push" push.log) -eq 6 ]
git push --all origin 2>&1 | tee push.log git push --all origin 2>&1 | tee push.log
grep "(2 of 2 files, 1 skipped)" push.log grep "(5 of 5 files, 1 skipped)" push.log
grep "(3 of 3 files)" push.log [ $(grep -c "files" push.log) -eq 1 ]
[ $(grep -c "files)" push.log) -eq 1 ] [ $(grep -c "skipped" push.log) -eq 1 ]
[ $(grep -c "skipped)" push.log) -eq 1 ]
assert_server_object "$reponame-$suffix-2" "$oid2" assert_server_object "$reponame-$suffix-2" "$oid2"
assert_server_object "$reponame-$suffix-2" "$oid3" assert_server_object "$reponame-$suffix-2" "$oid3"
assert_server_object "$reponame-$suffix-2" "$oid4" assert_server_object "$reponame-$suffix-2" "$oid4"