Skip to content

Commit c8359bf

Browse files
committed
git: diff - added missing flags
1 parent 66d0853 commit c8359bf

File tree

6 files changed

+15
-5
lines changed

6 files changed

+15
-5
lines changed

completers/common/git_completer/cmd/common/diff.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func AddDiffFlags(cmd *cobra.Command) {
6565
cmd.Flags().Bool("no-prefix", false, "Do not show any source or destination prefix")
6666
cmd.Flags().Bool("no-rename-empty", false, "Whether to use empty blobs as rename source")
6767
cmd.Flags().Bool("no-renames", false, "Turn off rename detection")
68+
cmd.Flags().String("no-textconv", "", "Disallow external text conversion filters to be run when comparing binary files")
6869
cmd.Flags().Bool("numstat", false, "Similar to --stat, but shows number of added and deleted lines in decimal notation")
6970
cmd.Flags().BoolP("ours", "2", false, "compare with our branch")
7071
cmd.Flags().String("output", "", "Output to a specific file instead of stdout")
@@ -90,7 +91,7 @@ func AddDiffFlags(cmd *cobra.Command) {
9091
cmd.Flags().String("submodule", "", "Specify how differences in submodules are shown")
9192
cmd.Flags().Bool("summary", false, "Output a condensed summary of extended header information")
9293
cmd.Flags().BoolP("text", "a", false, "Treat all files as text")
93-
cmd.Flags().String("textconv", "", "Allow (or disallow) external text conversion filters to be run when comparing binary files")
94+
cmd.Flags().String("textconv", "", "Allow external text conversion filters to be run when comparing binary files")
9495
cmd.Flags().BoolP("theirs", "3", false, "compare with their branch")
9596
cmd.Flags().BoolS("u", "u", false, "Generate patch")
9697
cmd.Flags().StringP("unified", "U", "", "Generate diffs with <n> lines of context instead of the usual three")

completers/common/git_completer/cmd/diff.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,22 @@ var diffCmd = &cobra.Command{
2020
func init() {
2121
carapace.Gen(diffCmd).Standalone()
2222

23+
// TODO move into common flag groups
24+
diffCmd.Flags().StringS("G", "G", "", "Look for differences whose patch text contains added/removed lines that match <regex>")
25+
diffCmd.Flags().String("follow", "", "Continue listing the history of a file beyond renames")
26+
diffCmd.Flags().StringArrayP("ignore-matching-lines", "I", nil, "Ignore changes whose all lines match <regex>")
27+
diffCmd.Flags().Bool("quiet", false, "Disable all output of the program")
28+
diffCmd.Flags().String("rotate-to", "", "Move the files before the named <file> to the end")
29+
diffCmd.Flags().String("skip-to", "", "Discard the files before the named <file> from the output")
30+
diffCmd.Flags().Bool("staged", false, "Show diff between index and named commit")
2331
common.AddDiffFlags(diffCmd)
2432
rootCmd.AddCommand(diffCmd)
2533

34+
carapace.Gen(diffCmd).FlagCompletion(carapace.ActionMap{
35+
"follow": carapace.ActionFiles(), // TODO complete files of specific revision/modified between commits?
36+
"skip-to": carapace.ActionFiles(), // TODO complete files of specific revision/modified between commits?
37+
})
38+
2639
carapace.Gen(diffCmd).PositionalAnyCompletion(
2740
actionDiffArgs(diffCmd),
2841
)

completers/common/git_completer/cmd/diffFiles.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ func init() {
2727
diffFilesCmd.Flags().Bool("log-size", false, "Print log message size in bytes before the message")
2828
diffFilesCmd.Flags().Bool("mailmap", false, "Use mailmap file to map author and committer name")
2929
diffFilesCmd.Flags().Bool("no-relative", false, "Do not show relative pathnames")
30-
diffFilesCmd.Flags().Bool("no-textconv", false, "Disallow external text conversion filters to be run when comparing binary files")
3130
diffFilesCmd.Flags().BoolS("q", "q", false, "Remain silent even for nonexistent files")
3231
diffFilesCmd.Flags().String("rotate-to", "", "Move the files before the named <file> to the end")
3332
diffFilesCmd.Flags().String("skip-to", "", "Discard the files before the named <file> from the output")

completers/common/git_completer/cmd/diffIndex.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ func init() {
2323
diffIndexCmd.Flags().BoolS("m", "m", false, "make git diff-index say that all non-checked-out files are up to date")
2424
diffIndexCmd.Flags().Bool("merge-base", false, "use the merge base between <tree-ish> and HEAD")
2525
diffIndexCmd.Flags().Bool("no-relative", false, "do not make the output relative")
26-
diffIndexCmd.Flags().Bool("no-textconv", false, "do not external text conversion filters to be run")
2726
diffIndexCmd.Flags().Bool("quiet", false, "disable all output of the program")
2827
diffIndexCmd.Flags().String("rotate-to", "", "move files before the named <file> to the end")
2928
diffIndexCmd.Flags().String("skip-to", "", "discard the files before the named <file> from the output ")

completers/common/git_completer/cmd/diffTree.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ func init() {
2727
diffTreeCmd.Flags().Bool("no-commit-id", false, "suppress commit ID output")
2828
diffTreeCmd.Flags().Bool("no-notes", false, "do not show notes")
2929
diffTreeCmd.Flags().Bool("no-relative", false, "do not show relative pathnames")
30-
diffTreeCmd.Flags().Bool("no-textconv", false, "do not allow external text conversion filters")
3130
diffTreeCmd.Flags().String("notes", "", "show the notes that annotate the commit")
3231
diffTreeCmd.Flags().Bool("quiet", false, "disable all output of the program")
3332
diffTreeCmd.Flags().BoolS("r", "r", false, "recurse into sub-trees")

completers/common/git_completer/cmd/log.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ func init() {
4545
logCmd.Flags().Bool("no-mailmap", false, "Do not use mailmap file to map author and committer names and email addresses to canonical real names and email addresses.")
4646
logCmd.Flags().Bool("no-notes", false, "Do not show notes.")
4747
logCmd.Flags().Bool("no-relative", false, "When run from a subdirectory of the project, it can be told to exclude changes outside the directory and show pathnames relative to it with this option.")
48-
logCmd.Flags().Bool("no-textconv", false, "Disallow external text conversion filters to be run when comparing binary files.")
4948
logCmd.Flags().Bool("no-use-mailmap", false, "Do not use mailmap file to map author and committer names and email addresses to canonical real names and email addresses.")
5049
logCmd.Flags().String("notes", "", "Show the notes that annotate the commit")
5150
logCmd.Flags().Bool("reverse", false, "Output the commits chosen to be shown (see Commit Limiting section above) in reverse order. Cannot be combined with --walk-reflogs.")

0 commit comments

Comments
 (0)