Simplifying.
This commit is contained in:
+23
-23
@@ -10,8 +10,8 @@
|
||||
(define b (build-path tmp "b"))
|
||||
|
||||
(define (configure!)
|
||||
(git config "user.name" "Racket Git Test")
|
||||
(git config "user.email" "racket-git-test@example.invalid"))
|
||||
(git 'config "user.name" "Racket Git Test")
|
||||
(git 'config "user.email" "racket-git-test@example.invalid"))
|
||||
|
||||
(dynamic-wind
|
||||
void
|
||||
@@ -20,17 +20,17 @@
|
||||
(make-directory a)
|
||||
|
||||
(parameterize ([current-directory a])
|
||||
(git init)
|
||||
(git 'init)
|
||||
(configure!)
|
||||
(call-with-output-file "value.txt"
|
||||
#:exists 'truncate/replace
|
||||
(lambda (out) (displayln "one" out)))
|
||||
(git add "value.txt")
|
||||
(git commit "one")
|
||||
(git remote add "origin" (path->string origin))
|
||||
(check-equal? (git remote) '("origin"))
|
||||
(check-equal? (git remote get-url "origin") (path->string origin))
|
||||
(git push))
|
||||
(git 'add "value.txt")
|
||||
(git 'commit "one")
|
||||
(git 'remote 'add "origin" (path->string origin))
|
||||
(check-equal? (git 'remote) '("origin"))
|
||||
(check-equal? (git 'remote 'get-url "origin") (path->string origin))
|
||||
(git 'push))
|
||||
|
||||
(git-clone (path->string origin) b)
|
||||
(parameterize ([current-directory b])
|
||||
@@ -39,38 +39,38 @@
|
||||
(call-with-output-file "value.txt"
|
||||
#:exists 'truncate/replace
|
||||
(lambda (out) (displayln "two" out)))
|
||||
(git add "value.txt")
|
||||
(git commit "two")
|
||||
(git push)
|
||||
(git tag "v2")
|
||||
(git push-tag "v2"))
|
||||
(git 'add "value.txt")
|
||||
(git 'commit "two")
|
||||
(git 'push)
|
||||
(git 'tag "v2")
|
||||
(git 'push-tag "v2"))
|
||||
|
||||
(parameterize ([current-directory a])
|
||||
(check-equal? (file->string "value.txt") "one\n")
|
||||
(check-equal? (string-length (git pull)) 40)
|
||||
(check-equal? (string-length (git 'pull)) 40)
|
||||
(check-equal? (file->string "value.txt") "two\n")
|
||||
(check-true (git-clean?))
|
||||
(git fetch)
|
||||
(check-equal? (git tag) '("v2"))
|
||||
(git 'fetch)
|
||||
(check-equal? (git 'tag) '("v2"))
|
||||
|
||||
(call-with-output-file "local.txt"
|
||||
#:exists 'truncate/replace
|
||||
(lambda (out) (displayln "local" out)))
|
||||
(git add "local.txt")
|
||||
(git commit "local change"))
|
||||
(git 'add "local.txt")
|
||||
(git 'commit "local change"))
|
||||
|
||||
(parameterize ([current-directory b])
|
||||
(call-with-output-file "remote.txt"
|
||||
#:exists 'truncate/replace
|
||||
(lambda (out) (displayln "remote" out)))
|
||||
(git add "remote.txt")
|
||||
(git commit "remote change")
|
||||
(git push))
|
||||
(git 'add "remote.txt")
|
||||
(git 'commit "remote change")
|
||||
(git 'push))
|
||||
|
||||
(parameterize ([current-directory a])
|
||||
(define before (git-head))
|
||||
(check-exn #rx"non-fast-forward"
|
||||
(lambda () (git pull)))
|
||||
(lambda () (git 'pull)))
|
||||
(check-equal? (git-head) before)
|
||||
(check-true (file-exists? "local.txt"))
|
||||
(check-false (file-exists? "remote.txt"))))
|
||||
|
||||
Reference in New Issue
Block a user