diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2021-02-01 15:55:03 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2021-02-01 17:23:29 -0700 |
commit | 01ed9a06b20d32b148446d715d6e1beb3050d069 (patch) | |
tree | 8b0ef328859804e7b6bafb8f1495817fc31bb756 /cmd_comment.go | |
parent | 328f9cc1ac0ebee9499dc8d50bd84f71897d4df7 (diff) |
Tidy up cmdClass
Diffstat (limited to 'cmd_comment.go')
-rw-r--r-- | cmd_comment.go | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/cmd_comment.go b/cmd_comment.go index c0325b4..2124c8e 100644 --- a/cmd_comment.go +++ b/cmd_comment.go @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2018 Luke Shumaker <lukeshu@lukeshu.com> +// Copyright (C) 2017-2018, 2021 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 @@ -22,6 +22,10 @@ import ( "github.com/pkg/errors" ) +// This file deals with comments, and with commands for which the +// specification says (or said) that the command "can be used anywhere +// in the stream that comments are accepted". + // comment ///////////////////////////////////////////////////////////////////// // CmdComment is a comment line; not a real command. @@ -105,19 +109,17 @@ type CmdLs struct { Path Path } -// If you're thinking "but wait, parser_registerCmd will see CmdLs as -// cmdClassCommit, not cmdClassComment, that means it won't be allowed -// embedded inside other commands! (while still allowing it both -// inside and outside of a commit)", you're absolutely correct. -// That's the desired behavior. It's a happy accident that the little -// fiCmdClass hack works out that way, instead of having to add even -// more complexity. - func (c CmdLs) fiCmdClass() cmdClass { + // As of git v2.21, the docs say this is cmdClassComment, but + // the actual code disagrees. if c.DataRef == "" { - return cmdClassCommit + // Yeah, this will give slightly misleading info to + // parser_registerCmd(), but that's OK, + // parser_registerCmd() only really cares about the + // cmdClassInCommand bit. + return cmdClassInCommit } - return cmdClassComment + return cmdClassCommand | cmdClassInCommit } func (c CmdLs) fiCmdWrite(fiw fiWriter) error { if c.DataRef == "" { |