Simplifying.

This commit is contained in:
2026-08-09 14:42:54 +02:00
parent 43516e7715
commit 4689c56e4d
6 changed files with 201 additions and 126 deletions
+37 -29
View File
@@ -14,17 +14,25 @@ The short form is intended for build scripts and interactive use:
@racketblock[
(require git)
(git status)
(git add "main.rkt" "info.rkt")
(git commit "Implement raco support")
(git tag "v0.1")
(git checkout "main")
(git 'status)
(git 'add "main.rkt" "info.rkt")
(git 'commit "Implement raco support")
(git 'tag "v0.1")
(git 'checkout "main")
]
@defform[(git command argument ...)]{
The @racket[git] form is syntax sugar for the corresponding procedures. For example, @racket[(git status)] calls @racket[git-status], and @racket[(git commit "message")] calls @racket[git-commit].
@defproc[(git [command symbol?] [argument any/c] ...) any/c]{
Dispatches @racket[command] to the corresponding Git procedure. For example, @racket[(git 'status)] calls @racket[git-status], and @racket[(git 'commit "message")] calls @racket[git-commit]. Command names are ordinary symbols, so @racket[git] can safely be used inside other macros and DSLs.
}
@defproc[(dgit [command symbol?] [argument any/c] ...) any/c]{
Calls @racket[git], displays its result in a compact human-readable form, and returns the original result. Status entries are displayed with labels such as @tt{Modified}, @tt{New}, @tt{Deleted}, and @tt{Renamed}. Ignored files remain omitted, just as with @racket[git-status].
}
@racketblock[
(dgit 'status)
]
@section{Repository}
@defproc[(git-repository? [path path-string? (current-directory)]) boolean?]{Returns whether @racket[path] is inside a Git repository.}
@@ -108,28 +116,28 @@ Remote HTTPS operations automatically use credentials from the @tt{racket-git} c
The following command-like forms are supported directly:
@racketblock[
(git init)
(git clone "https://example/repo.git")
(git status)
(git add "file.rkt")
(git config "user.name" "Name")
(git commit "message")
(git branch)
(git branch "feature")
(git branch -d "feature")
(git checkout "main")
(git checkout -b "feature")
(git tag)
(git tag "v0.1")
(git tag -d "v0.1")
(git log 10)
(git remote)
(git remote add "origin" "https://example/repo.git")
(git remote get-url "origin")
(git fetch)
(git pull)
(git push)
(git push-tag "v0.1")
(git 'init)
(git 'clone "https://example/repo.git")
(git 'status)
(git 'add "file.rkt")
(git 'config "user.name" "Name")
(git 'commit "message")
(git 'branch)
(git 'branch "feature")
(git 'branch '-d "feature")
(git 'checkout "main")
(git 'checkout '-b "feature")
(git 'tag)
(git 'tag "v0.1")
(git 'tag '-d "v0.1")
(git 'log 10)
(git 'remote)
(git 'remote 'add "origin" "https://example/repo.git")
(git 'remote 'get-url "origin")
(git 'fetch)
(git 'pull)
(git 'push)
(git 'push-tag "v0.1")
]
@section{HTTPS credentials}