commit
28254d864a
|
|
@ -179,6 +179,9 @@ func main() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if initialSync {
|
if initialSync {
|
||||||
|
if *flOneTime {
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
if isHash, err := revIsHash(*flRev, *flRoot); err != nil {
|
if isHash, err := revIsHash(*flRev, *flRoot); err != nil {
|
||||||
log.Errorf("can't tell if rev %s is a git hash, exiting", *flRev)
|
log.Errorf("can't tell if rev %s is a git hash, exiting", *flRev)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
@ -186,9 +189,6 @@ func main() {
|
||||||
log.V(0).Infof("rev %s appears to be a git hash, no further sync needed", *flRev)
|
log.V(0).Infof("rev %s appears to be a git hash, no further sync needed", *flRev)
|
||||||
sleepForever()
|
sleepForever()
|
||||||
}
|
}
|
||||||
if *flOneTime {
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
||||||
initialSync = false
|
initialSync = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
22
test_e2e.sh
22
test_e2e.sh
|
|
@ -369,5 +369,27 @@ pkill git-sync
|
||||||
wait
|
wait
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Test rev-sync one-time
|
||||||
|
testcase "rev-once"
|
||||||
|
# First sync
|
||||||
|
echo "$TESTCASE" > "$REPO"/file
|
||||||
|
git -C "$REPO" commit -qam "$TESTCASE"
|
||||||
|
REV=$(git -C "$REPO" rev-list -n1 HEAD)
|
||||||
|
GIT_SYNC \
|
||||||
|
--logtostderr \
|
||||||
|
--v=5 \
|
||||||
|
--wait=0.1 \
|
||||||
|
--repo="$REPO" \
|
||||||
|
--rev="$REV" \
|
||||||
|
--root="$ROOT" \
|
||||||
|
--dest="link" \
|
||||||
|
--one-time > "$DIR"/log."$TESTCASE" 2>&1
|
||||||
|
sleep 2
|
||||||
|
assert_link_exists "$ROOT"/link
|
||||||
|
assert_file_exists "$ROOT"/link/file
|
||||||
|
assert_file_eq "$ROOT"/link/file "$TESTCASE"
|
||||||
|
# Wrap up
|
||||||
|
pass
|
||||||
|
|
||||||
echo "cleaning up $DIR"
|
echo "cleaning up $DIR"
|
||||||
rm -rf "$DIR"
|
rm -rf "$DIR"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue