Added git show functionality
This commit is contained in:
+43
-1
@@ -20,7 +20,7 @@ Runs a registered Git @racket[command]. The arguments are passed to the command.
|
||||
Registered command symbols are @racket['status], @racket['add],
|
||||
@racket['commit], @racket['push], @racket['pull], @racket['branch],
|
||||
@racket['clone], @racket['log], @racket['rev-list], @racket['diff],
|
||||
@racket['grep], @racket['help], @racket['version], and
|
||||
@racket['show], @racket['grep], @racket['help], @racket['version], and
|
||||
@racket['new-version].
|
||||
|
||||
Most registered commands invoke the Git command with the same name. Some
|
||||
@@ -94,6 +94,48 @@ extra output lines can also influence how useful @tt{--list} is as a structured
|
||||
result.
|
||||
}
|
||||
|
||||
|
||||
|
||||
@defproc[(git-show [argument any/c] ...) (or/c boolean? string? list?)]{
|
||||
Shows a Git object.
|
||||
|
||||
For a commit that includes a patch, the default git-cli output is HTML. The
|
||||
commit information is shown above the diff and the diff is rendered using the
|
||||
same Diff2Html presentation as @racket[git-diff].
|
||||
|
||||
The git-cli-specific output options are @tt{--output=html},
|
||||
@tt{--output=-}, and @tt{--output=string}. @tt{--output=html} explicitly
|
||||
selects the HTML presentation, @tt{--output=-} keeps Git's normal textual
|
||||
output, and @tt{--output=string} returns that textual output as a string.
|
||||
Options such as @tt{--stat}, @tt{--name-only}, @tt{--name-status}, and
|
||||
@tt{--no-patch} default to textual output because they do not normally contain
|
||||
a patch.
|
||||
|
||||
The git-cli-specific option @tt{--list}, or its short form @tt{-l}, returns a
|
||||
Racket value. Without another show-format option it implies @tt{--stat}.
|
||||
|
||||
@racketblock[
|
||||
(git-show '-l "9741b1c")
|
||||
]
|
||||
|
||||
The result of @tt{--stat --list} contains @racket['file] and
|
||||
@racket['total] items:
|
||||
|
||||
@racketblock[
|
||||
'((file "README.md" 67 "+++---")
|
||||
(file "main.rkt" 532 "++++-------------------------------------------")
|
||||
(total 9 124 823))
|
||||
]
|
||||
|
||||
With @tt{--name-only --list}, the result is a list of file names. With
|
||||
@tt{--name-status --list}, every result item is the tab-separated Git
|
||||
name-status record converted to a list of strings.
|
||||
|
||||
@tt{--list}/@tt{-l} cannot be combined with @tt{--output=...}. Only one of
|
||||
@tt{--stat}, @tt{--name-only}, and @tt{--name-status} can be used with
|
||||
@tt{--list}.
|
||||
}
|
||||
|
||||
@defproc[(git-grep [argument any/c] ...) list?]{
|
||||
Searches tracked files. Each result contains the file, optional line number,
|
||||
optional match count, and matched text. Exit status one means that no matches
|
||||
|
||||
Reference in New Issue
Block a user