diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2018-12-25 20:02:10 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2018-12-25 20:02:10 -0500 |
commit | de796fbcedd4edb3ea97b39d4fd05cbdcc168baa (patch) | |
tree | e007af30944f144973438c1ae89d8b74b7b7a1ed /cmd_command.go | |
parent | 2bcfdda7c623f16b71e92d5a6458c669e6ca8ce3 (diff) | |
parent | 92cdee8f4cda65c0495dd39df51f2d199da17253 (diff) |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'cmd_command.go')
-rw-r--r-- | cmd_command.go | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/cmd_command.go b/cmd_command.go index a6c5ec1..ff74f80 100644 --- a/cmd_command.go +++ b/cmd_command.go @@ -1,3 +1,18 @@ +// Copyright (C) 2017-2018 Luke Shumaker <lukeshu@lukeshu.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see <https://www.gnu.org/licenses/>. + package libfastimport import ( @@ -9,6 +24,14 @@ import ( // commit ////////////////////////////////////////////////////////////////////// +// CmdCommit requests that the Backend creates or updates a branch +// with a new commit. +// +// This command may be followed by zero or more "File" or "Note" +// commands to set the content of commit's tree. When reading from a +// Frontend, that sequence of "File" and "Note" commands will be +// terminated by a CmdCommitEnd command. It is not nescessary to +// manually emit a CmdCommitEnd when writing to a Backend. type CmdCommit struct { Ref string Mark int // optional; < 1 for non-use @@ -87,6 +110,13 @@ func (CmdCommit) fiCmdRead(fir fiReader) (cmd Cmd, err error) { return } +// CmdCommitEnd indicates the Frontend will be sending no more "File" +// or "Note" commands that are "part of" the current CmdCommit. +// +// This is a synthesized command to simplify reading from a Frontend; +// it is not really a command in the stream. It is thus not +// nescessary to send a CmdCommitEnd command when writing to a +// Backend. type CmdCommitEnd struct{} func (CmdCommitEnd) fiCmdClass() cmdClass { return cmdClassCommit } @@ -95,6 +125,10 @@ func (CmdCommitEnd) fiCmdRead(fir fiReader) (Cmd, error) { panic("not reached") // tag ///////////////////////////////////////////////////////////////////////// +// CmdTag requests that the Backend creates an *annotated* tag +// referencing a specific commit. +// +// Hint: Use CmdReset to create a *lightweight* tag. type CmdTag struct { RefName string CommitIsh string @@ -144,6 +178,9 @@ func (CmdTag) fiCmdRead(fir fiReader) (cmd Cmd, err error) { // reset /////////////////////////////////////////////////////////////////////// +// CmdReset requests that the Backend creates (or recreates) the named +// ref (usually a branch), optionally starting from a specific +// revision. type CmdReset struct { RefName string CommitIsh string // optional @@ -179,8 +216,12 @@ func (CmdReset) fiCmdRead(fir fiReader) (cmd Cmd, err error) { // blob //////////////////////////////////////////////////////////////////////// +// CmdBlob requests that the Backend write file revision. The blob +// can be later referred to by the specified Mark (if a Mark > 0 is +// given), or by pre-calculating the Git SHA-1 (though this is +// needlessly difficult, just specify a Mark). type CmdBlob struct { - Mark int + Mark int // optional Data string } @@ -220,6 +261,7 @@ func (CmdBlob) fiCmdRead(fir fiReader) (cmd Cmd, err error) { // checkpoint ////////////////////////////////////////////////////////////////// +// CmdCheckpoint requests that the Backend flush already-sent data. type CmdCheckpoint struct{} func (c CmdCheckpoint) fiCmdClass() cmdClass { return cmdClassCommand } @@ -237,6 +279,8 @@ func (CmdCheckpoint) fiCmdRead(fir fiReader) (cmd Cmd, err error) { // progress //////////////////////////////////////////////////////////////////// +// CmdProgress requests that the Backend print the given string to its +// standard output channel. type CmdProgress struct { Str string } @@ -256,6 +300,8 @@ func (CmdProgress) fiCmdRead(fir fiReader) (cmd Cmd, err error) { // feature ///////////////////////////////////////////////////////////////////// +// CmdFeature requests that the Backend immediately aborts with an +// error if it does not support the specified feature. type CmdFeature struct { Feature string Argument string @@ -290,6 +336,7 @@ func (CmdFeature) fiCmdRead(fir fiReader) (cmd Cmd, err error) { // option ////////////////////////////////////////////////////////////////////// +// CmdOption requests that the Backend changes its settings. type CmdOption struct { Option string } @@ -310,6 +357,8 @@ func (CmdOption) fiCmdRead(fir fiReader) (cmd Cmd, err error) { // done //////////////////////////////////////////////////////////////////////// +// CmdDone indicates to the Backend that no more commands will be +// sent. type CmdDone struct{} func (c CmdDone) fiCmdClass() cmdClass { return cmdClassCommand } |