1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-28 09:08:41 +02:00

Pass -f as single arg in integration test

For some bizarre reason `pkg/integration/tests/filter_by_path/cli_arg.go` is failing as of 8c716184 like so:

```
test_lazygit

  Usage:
    test_lazygit [git-arg]

  Positional Variables:
    git-arg   Panel to focus upon opening lazygit. Accepted values (based on git terminology): status, branch, log, stash. Ignored if --filter arg is passed.
  Flags:
    -h --help               Displays help with available flag, subcommand, and positional value parameters.
    -p --path               Path of git repo. (equivalent to --work-tree=<path> --git-dir=<path>/.git/)
    -f --filter             Path to filter on in `git log -- <path>`. When in filter mode, the commits, reflog, and stash are filtered based on the given path, and some operations are restricted
    -v --version            Print the current version
    -d --debug              Run in debug mode with logging (see --logs flag below). Use the LOG_LEVEL env var to set the log level (debug/info/warn/error) (default: false)
    -l --logs               Tail lazygit logs (intended to be used when `lazygit --debug` is called in a separate terminal tab)
    -c --config             Print the default config
    -cd --print-config-dir   Print the config directory
    -ucd --use-config-dir     override default config directory with provided directory
    -w --work-tree          equivalent of the --work-tree git argument
    -g --git-dir            equivalent of the --git-dir git argument
    -ucf --use-config-file    Comma separated list to custom config file(s)

Unknown arguments supplied:  filterFile
```

where the CLI args are:
```
([]string) (len=5 cap=5) {
 (string) (len=25) "/tmp/lazygit/test_lazygit",
 (string) (len=6) "-debug",
 (string) (len=108) "--use-config-dir=/Users/jesseduffieldduffield/repos/lazygit/test/_results/filter_by_path/cli_arg/used_config",
 (string) (len=2) "-f",
 (string) (len=10) "filterFile"
}
```

This appears to be a bug in flaggy itself. I've updated to the latest version but it still breaks. Bizarrely it works fine on CI and
only fails locally. Running lazygit locally with `lg -f pkg/gui/controllers/helpers/refresh_helper.go` it works fine. So I don't
know what's going on there. At any rate, I'm just going to get the test passing by passing `-f=filterFile` as a single argument.
This commit is contained in:
Jesse Duffield 2024-01-12 20:14:26 +11:00
parent 8c716184c1
commit a1ce6029c1

View File

@ -7,7 +7,7 @@ import (
var CliArg = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter commits by file path, using CLI arg",
ExtraCmdArgs: []string{"-f", "filterFile"},
ExtraCmdArgs: []string{"-f=filterFile"},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},