File tree Expand file tree Collapse file tree 2 files changed +62
-0
lines changed
Expand file tree Collapse file tree 2 files changed +62
-0
lines changed Original file line number Diff line number Diff line change @@ -308,3 +308,45 @@ git clone --shared base detached-head
308308(cd detached-head
309309 git checkout @~1
310310)
311+
312+ function commit() {
313+ local message=${1:? first argument is the commit message}
314+ local file=" $message .t"
315+ echo " $1 " > " $file "
316+ git add -- " $file "
317+ tick
318+ git commit -m " $message "
319+ git tag " $message "
320+ }
321+
322+ function optimize_repo() {
323+ git commit-graph write --no-progress --reachable
324+ git repack -adq
325+ }
326+
327+ (mkdir multi_round && cd multi_round
328+ git init -q server && cd server
329+ commit to_fetch
330+ cd ..
331+
332+ git init -q client && cd client
333+ for i in $( seq 8) ; do
334+ git checkout --orphan b$i &&
335+ commit b$i .c0
336+ done
337+
338+ for j in $( seq 19) ; do
339+ for i in $( seq 8) ; do
340+ git checkout b$i &&
341+ commit b$i .c$j
342+ done
343+ done
344+ optimize_repo
345+ cd ..
346+ (cd server
347+ git fetch --no-tags " $PWD /../client" b1:refs/heads/b1
348+ git checkout b1
349+ commit commit-on-b1
350+ optimize_repo
351+ )
352+ )
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ mod blocking_and_async_io {
1919 use gix_protocol:: maybe_async;
2020
2121 use crate :: {
22+ remote,
2223 remote:: { into_daemon_remote_if_async, spawn_git_daemon_if_async} ,
2324 util:: hex_to_id,
2425 } ;
@@ -106,6 +107,25 @@ mod blocking_and_async_io {
106107 Ok ( ( ) )
107108 }
108109
110+ // TODO: try this as maybe-async
111+ #[ test]
112+ #[ cfg( feature = "blocking-network-client" ) ]
113+ #[ ignore = "fails because of improper negotiation (it's hacked to work for our cases)" ]
114+ fn fetch_with_multi_round_negotiation ( ) -> crate :: Result {
115+ let repo = remote:: repo ( "multi_round/client" ) ;
116+ let server_repo = remote:: repo ( "multi_round/server" ) ;
117+ let changes = repo
118+ . remote_at ( server_repo. work_dir ( ) . expect ( "non-bare" ) ) ?
119+ . with_refspecs ( Some ( "refs/heads/*:refs/remotes/origin/*" ) , Fetch ) ?
120+ . connect ( Fetch ) ?
121+ . prepare_fetch ( gix:: progress:: Discard , Default :: default ( ) ) ?
122+ . with_dry_run ( true )
123+ . receive ( gix:: progress:: Discard , & AtomicBool :: default ( ) ) ?;
124+
125+ dbg ! ( changes) ;
126+ Ok ( ( ) )
127+ }
128+
109129 #[ maybe_async:: test(
110130 feature = "blocking-network-client" ,
111131 async ( feature = "async-network-client-async-std" , async_std:: test)
You can’t perform that action at this time.
0 commit comments