File tree 2 files changed +25
-3
lines changed
2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -179,16 +179,16 @@ func main() {
179
179
continue
180
180
}
181
181
if initialSync {
182
+ if * flOneTime {
183
+ os .Exit (0 )
184
+ }
182
185
if isHash , err := revIsHash (* flRev , * flRoot ); err != nil {
183
186
log .Errorf ("can't tell if rev %s is a git hash, exiting" , * flRev )
184
187
os .Exit (1 )
185
188
} else if isHash {
186
189
log .V (0 ).Infof ("rev %s appears to be a git hash, no further sync needed" , * flRev )
187
190
sleepForever ()
188
191
}
189
- if * flOneTime {
190
- os .Exit (0 )
191
- }
192
192
initialSync = false
193
193
}
194
194
Original file line number Diff line number Diff line change @@ -369,5 +369,27 @@ pkill git-sync
369
369
wait
370
370
pass
371
371
372
+ # Test rev-sync one-time
373
+ testcase " rev-once"
374
+ # First sync
375
+ echo " $TESTCASE " > " $REPO " /file
376
+ git -C " $REPO " commit -qam " $TESTCASE "
377
+ REV=$( git -C " $REPO " rev-list -n1 HEAD)
378
+ GIT_SYNC \
379
+ --logtostderr \
380
+ --v=5 \
381
+ --wait=0.1 \
382
+ --repo=" $REPO " \
383
+ --rev=" $REV " \
384
+ --root=" $ROOT " \
385
+ --dest=" link" \
386
+ --one-time > " $DIR " /log." $TESTCASE " 2>&1
387
+ sleep 2
388
+ assert_link_exists " $ROOT " /link
389
+ assert_file_exists " $ROOT " /link/file
390
+ assert_file_eq " $ROOT " /link/file " $TESTCASE "
391
+ # Wrap up
392
+ pass
393
+
372
394
echo " cleaning up $DIR "
373
395
rm -rf " $DIR "
You can’t perform that action at this time.
0 commit comments