diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..71e2bd80d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +version: 2 +updates: + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "weekly" + allowed_updates: + - match: + update_type: "security" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 14857c44d..066322b58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,14 @@ on: jobs: ci: - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - windows-latest + name: ci - ${{matrix.os}} + runs-on: ${{matrix.os}} env: GOFLAGS: -mod=vendor steps: @@ -27,7 +34,7 @@ jobs: ${{runner.os}}-go- - name: Test code run: | - ./test.sh + bash ./test.sh build: runs-on: ubuntu-latest env: diff --git a/.gitignore b/.gitignore index 481e36162..0e905b107 100644 --- a/.gitignore +++ b/.gitignore @@ -27,8 +27,10 @@ lazygit test/git_server/data test/integration/*/actual/ +test/integration/*/actual_remote/ test/integration/*/used_config/ -# these sample hooks waste too space space +# these sample hooks waste too much space test/integration/*/expected/.git_keep/hooks/ +test/integration/*/expected_remote/hooks/ !.git_keep/ lazygit.exe diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e59a42044..574088cb7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,14 +1,13 @@ # Contributing - ♥ We love pull requests from everyone ! - When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository -before making a change. +before making a change. ## So all code changes happen through Pull Requests + Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests: @@ -21,15 +20,33 @@ welcome your pull requests: 7. Issue that pull request! ## Code of conduct + Please note by participating in this project, you agree to abide by the [code of conduct]. [code of conduct]: https://github.com/jesseduffield/lazygit/blob/master/CODE-OF-CONDUCT.md ## Any contributions you make will be under the MIT Software License + In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern. ## Report bugs using Github's [issues](https://github.com/jesseduffield/lazygit/issues) + We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/jesseduffield/lazygit/issues/new); it's that easy! + +## Updating Gocui + +Sometimes you will need to make a change in the gocui fork (https://github.com/jesseduffield/gocui). Gocui is the package responsible for rending windows and handling user input. Here's the typical process to follow: + +1. Make the changes in gocui inside the vendor directory so it's easy to test against lazygit +2. Copy the changes over to the actual gocui repo (clone it if you haven't already, and use the `awesome` branch, not `master`) +3. Raise a PR on the gocui repo with your changes +4. After that PR is merged, make a PR in lazygit bumping the gocui version. You can bump the version by running the following at the lazygit repo root: + +```sh +./bump_gocui.sh +``` + +5. Raise a PR in lazygit with those changes diff --git a/README.md b/README.md index 2433f6658..4c523209a 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Github Sponsors is matching all donations dollar-for-dollar for 12 months so if ### Binary Releases -For Windows, Mac OS(10.10+) or Linux, you can download a binary release [here](../../releases). +For Windows, Mac OS(10.12+) or Linux, you can download a binary release [here](../../releases). ### Homebrew diff --git a/bump_gocui.sh b/bump_gocui.sh new file mode 100755 index 000000000..30e565375 --- /dev/null +++ b/bump_gocui.sh @@ -0,0 +1,5 @@ +# Go's proxy servers are not very up-to-date so that's why we use `GOPROXY=direct` +# We specify the `awesome` branch to avoid the default behaviour of looking for a semver tag. +GOPROXY=direct go get -u github.com/jesseduffield/gocui@awesome && go mod vendor + +# Note to self if you ever want to fork a repo be sure to use this same approach: it's important to use the branch name (e.g. master) diff --git a/docs/Config.md b/docs/Config.md index 09ff7641c..7b112aedc 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -22,6 +22,7 @@ gui: sidePanelWidth: 0.3333 # number from 0 to 1 expandFocusedSidePanel: false mainPanelSplitMode: 'flexible' # one of 'horizontal' | 'flexible' | 'vertical' + language: 'auto' # one of 'auto' | 'en' | 'zh' | 'pl' | 'nl' theme: lightTheme: false # For terminals with a light background activeBorderColor: @@ -35,6 +36,10 @@ gui: - default selectedRangeBgColor: - blue + cherryPickedCommitBgColor: + - blue + cherryPickedCommitFgColor: + - cyan commitLength: show: true mouseEvents: true @@ -54,8 +59,6 @@ git: manualCommit: false # extra args passed to `git merge`, e.g. --no-ff args: '' - pull: - mode: 'auto' # one of 'auto' | 'merge' | 'rebase' | 'ff-only', auto reads from git configuration skipHookPrefix: WIP autoFetch: true branchLogCmd: 'git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --' @@ -65,6 +68,7 @@ git: parseEmoji: false os: editCommand: '' # see 'Configuring File Editing' section + editCommandTemplate: '{{editor}} {{filename}}' openCommand: '' refresher: refreshInterval: 10 # file/submodule refresh interval in seconds @@ -97,6 +101,7 @@ keybinding: nextBlock: '' # goto the next block / panel prevBlock-alt: 'h' # goto the previous block / panel nextBlock-alt: 'l' # goto the next block / panel + jumpToBlock: ["1", "2", "3", "4", "5"] # goto the Nth block / panel nextMatch: 'n' prevMatch: 'N' optionMenu: 'x' # show help menu @@ -133,7 +138,9 @@ keybinding: diffingMenu-alt: '' # deprecated copyToClipboard: '' submitEditorText: '' - appendNewline: '' + appendNewline: '' + extrasMenu: '@' + toggleWhitespaceInDiffView: '' status: checkForUpdate: 'u' recentRepos: '' @@ -203,14 +210,14 @@ keybinding: ```yaml os: - openCommand: 'cmd /c "start "" {{filename}}"' + openCommand: 'start "" {{filename}}' ``` ### Linux ```yaml os: - openCommand: 'sh -c "xdg-open {{filename}} >/dev/null"' + openCommand: 'xdg-open {{filename}} >/dev/null' ``` ### OSX @@ -239,6 +246,38 @@ os: Lazygit will log an error if none of these options are set. +You can specify a line number you are currently at when in the line-by-line mode. + +```yaml +os: + editCommand: 'vim' + editCommandTemplate: '{{editor}} +{{line}} {{filename}}' +``` + +or + +```yaml +os: + editCommand: 'code' + editCommandTemplate: '{{editor}} --goto {{filename}}:{{line}}' +``` + +`{{editor}}` in `editCommandTemplate` is replaced with the value of `editCommand`. + +### Overriding default config file location + +To override the default config directory, use `$CONFIG_DIR="~/.config/lazygit"`. This directory contains the config file in addition to some other files lazygit uses to keep track of state across sessions. + +To override the individual config file used, use the `--use-config-file` arg or the `LG_CONFIG_FILE` env var. + +If you want to merge a specific config file into a more general config file, perhaps for the sake of setting some theme-specific options, you can supply a list of comma-separated config file paths, like so: + +```sh +lazygit --use-config-file=~/.base_lg_conf,~/.light_theme_lg_conf +or +LG_CONFIG_FILE="~/.base_lg_conf,~/.light_theme_lg_conf" lazygit +``` + ### Recommended Config Values for users of VSCode @@ -263,7 +302,7 @@ The available attributes are: - magenta - cyan - white -- '#ff00ff' # can't be used on text +- '#ff00ff' **Modifiers** diff --git a/docs/Custom_Command_Keybindings.md b/docs/Custom_Command_Keybindings.md index 9dc42a9da..8b0c769c2 100644 --- a/docs/Custom_Command_Keybindings.md +++ b/docs/Custom_Command_Keybindings.md @@ -47,7 +47,8 @@ customCommands: title: 'Remote branch:' command: 'git branch -r --list {{index .PromptResponses 0}}/*' filter: '.*{{index .PromptResponses 0}}/(?P.*)' - format: '{{ .branch }}' + valueFormat: '{{ .branch }}' + labelFormat: '{{ .branch | green }}' ``` Looking at the command assigned to the 'n' key, here's what the result looks like: @@ -92,19 +93,28 @@ The permitted contexts are: The permitted prompt fields are: -| _field_ | _description_ | _required_ | -| ------------ | -------------------------------------------------------------------------------- | ---------- | -| type | one of 'input' or 'menu' | yes | -| title | the title to display in the popup panel | no | -| initialValue | (only applicable to 'input' prompts) the initial value to appear in the text box | no | -| options | (only applicable to 'menu' prompts) the options to display in the menu | no | -| command | (only applicable to 'menuFromCommand' prompts) the command to run to generate | yes | -| | menu options | | -| filter | (only applicable to 'menuFromCommand' prompts) the regexp to run specifying | yes | -| | groups which are going to be kept from the command's output | | -| format | (only applicable to 'menuFromCommand' prompts) how to format matched groups from | yes | -| | the filter. You can use named groups, or `{{ .group_GROUPID }}`. | yes | -| | PS: named groups keep first match only | yes | +| _field_ | _description_ | _required_ | +| ------------ | -------------------------------------------------------------------------------- | ---------- | +| type | one of 'input' or 'menu' | yes | +| title | the title to display in the popup panel | no | +| initialValue | (only applicable to 'input' prompts) the initial value to appear in the text box | no | +| options | (only applicable to 'menu' prompts) the options to display in the menu | no | +| command | (only applicable to 'menuFromCommand' prompts) the command to run to generate | yes | +| | menu options | | +| filter | (only applicable to 'menuFromCommand' prompts) the regexp to run specifying | yes | +| | groups which are going to be kept from the command's output | | +| valueFormat | (only applicable to 'menuFromCommand' prompts) how to format matched groups from | yes | +| | the filter to construct a menu item's value (What gets appended to prompt | | +| | responses when the item is selected). You can use named groups, | | +| | or `{{ .group_GROUPID }}`. | | +| | PS: named groups keep first match only | | +| labelFormat | (only applicable to 'menuFromCommand' prompts) how to format matched groups from | no | +| | the filter to construct the item's label (What's shown on screen). You can use | | +| | named groups, or `{{ .group_GROUPID }}`. You can also color each match with | | +| | `{{ .group_GROUPID | colorname }}` (Color names from | | +| | [here](https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md)) | | +| | If `labelFormat` is not specified, `valueFormat` is shown instead. | | +| | PS: named groups keep first match only | | The permitted option fields are: | _field_ | _description_ | _required_ | diff --git a/docs/keybindings/Keybindings_en.md b/docs/keybindings/Keybindings_en.md index 3845d860e..04aa16d66 100644 --- a/docs/keybindings/Keybindings_en.md +++ b/docs/keybindings/Keybindings_en.md @@ -208,11 +208,11 @@ esc: return to files panel M: open external merge tool (git mergetool) space: pick hunk - b: pick both hunks + b: pick all hunks : select previous conflict : select next conflict - : select top hunk - : select bottom hunk + : select previous hunk + : select next hunk z: undo diff --git a/docs/keybindings/Keybindings_pl.md b/docs/keybindings/Keybindings_pl.md index 4d090828e..21f9ec093 100644 --- a/docs/keybindings/Keybindings_pl.md +++ b/docs/keybindings/Keybindings_pl.md @@ -208,11 +208,11 @@ esc: wróć do panelu plików M: open external merge tool (git mergetool) space: pick hunk - b: pick both hunks + b: pick all hunks : select previous conflict : select next conflict - : select top hunk - : select bottom hunk + : select previous hunk + : select next hunk z: cofnij diff --git a/go.mod b/go.mod index 70f5a6fef..0149feda5 100644 --- a/go.mod +++ b/go.mod @@ -9,18 +9,21 @@ require ( github.com/cli/safeexec v1.0.0 github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 github.com/creack/pty v1.1.11 - github.com/fatih/color v1.9.0 + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fatih/color v1.9.0 // indirect github.com/fsnotify/fsnotify v1.4.7 - github.com/gdamore/tcell/v2 v2.3.11 // indirect - github.com/go-errors/errors v1.4.0 + github.com/go-errors/errors v1.4.1 github.com/go-logfmt/logfmt v0.5.0 // indirect github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 github.com/golang/protobuf v1.3.2 // indirect github.com/google/go-cmp v0.3.1 // indirect + github.com/gookit/color v1.4.2 github.com/imdario/mergo v0.3.11 github.com/integrii/flaggy v1.4.0 + github.com/iriri/minimal/gitignore v0.3.2 // indirect github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4 - github.com/jesseduffield/gocui v0.3.1-0.20210614081440-74b42ecad52b + github.com/jesseduffield/gocui v0.3.1-0.20211017220056-b2fc03c74a6f + github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e github.com/jesseduffield/yaml v2.1.0+incompatible github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect @@ -28,19 +31,20 @@ require ( github.com/kyokomi/emoji/v2 v2.2.8 github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-colorable v0.1.7 // indirect - github.com/mattn/go-runewidth v0.0.13 + github.com/mattn/go-runewidth v0.0.13 // indirect github.com/mgutz/str v1.2.0 github.com/onsi/ginkgo v1.10.3 // indirect github.com/onsi/gomega v1.7.1 // indirect + github.com/ozeidan/fuzzy-patricia v3.0.0+incompatible // indirect github.com/sahilm/fuzzy v0.1.0 github.com/sirupsen/logrus v1.4.2 github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad - github.com/stretchr/testify v1.4.0 + github.com/stretchr/testify v1.7.0 + github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 // indirect golang.org/x/net v0.0.0-20201002202402-0a1ea396d57c // indirect - golang.org/x/sys v0.0.0-20210611083646-a4fc73990273 // indirect - golang.org/x/term v0.0.0-20210503060354-a79de5458b56 // indirect - golang.org/x/text v0.3.6 // indirect + golang.org/x/sys v0.0.0-20211015200801-69063c4bb744 // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect + golang.org/x/text v0.3.7 // indirect + gopkg.in/ozeidan/fuzzy-patricia.v3 v3.0.0 ) - -replace github.com/go-git/go-git/v5 => github.com/jesseduffield/go-git/v5 v5.1.1 diff --git a/go.sum b/go.sum index 0b6b4d8d0..1d3c41de1 100644 --- a/go.sum +++ b/go.sum @@ -32,14 +32,13 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= -github.com/gdamore/tcell/v2 v2.0.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= -github.com/gdamore/tcell/v2 v2.3.11 h1:ECO6WqHGbKZ3HrSL7bG/zArMCmLaNr5vcjjMVnLHpzc= -github.com/gdamore/tcell/v2 v2.3.11/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU= +github.com/gdamore/tcell/v2 v2.4.0 h1:W6dxJEmaxYvhICFoTY3WrLLEXsQ11SaFnKGVEXW57KM= +github.com/gdamore/tcell/v2 v2.4.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU= github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs= -github.com/go-errors/errors v1.4.0 h1:2OA7MFw38+e9na72T1xgkomPb6GzZzzxvJ5U630FoRM= -github.com/go-errors/errors v1.4.0/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/go-errors/errors v1.4.1 h1:IvVlgbzSsaUNudsw5dcXSzF3EWyXTi5XrAdngnuhRyg= +github.com/go-errors/errors v1.4.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.0.0 h1:7NQHvd9FVid8VL4qVUMm8XifBK+2xCoZ2lSk0agRrHM= @@ -49,6 +48,8 @@ github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12/go.mod github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 h1:zN2lZNZRflqFyxVaTIU61KNKQ9C0055u9CAfpmqUvo4= github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3/go.mod h1:nPpo7qLxd6XL3hWJG/O60sR8ZKfMCiIoNap5GvD12KU= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -57,6 +58,8 @@ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/gookit/color v1.4.2 h1:tXy44JFSFkKnELV6WaMo/lLfu/meqITX3iAV52do7lk= +github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -64,12 +67,26 @@ github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/integrii/flaggy v1.4.0 h1:A1x7SYx4jqu5NSrY14z8Z+0UyX2S5ygfJJrfolWR3zM= github.com/integrii/flaggy v1.4.0/go.mod h1:tnTxHeTJbah0gQ6/K0RW0J7fMUBk9MCF5blhm43LNpI= +github.com/iriri/minimal v0.0.0-20180828191352-9b2348d09c1a h1:mCZYG6QcX0dz/J0rFc1tcRYGeixlDcCGSPXuPMbiS5U= +github.com/iriri/minimal/gitignore v0.3.2 h1:MnTVH89iuwiyZ/a1pByw/mAU2ShWai1yvv0tgHSq5Ww= +github.com/iriri/minimal/gitignore v0.3.2/go.mod h1:v7YhsYBAInyAnQligwCIGRuQmtwQyYxkVy5vEdy2wPU= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4 h1:GOQrmaE8i+KEdB8NzAegKYd4tPn/inM0I1uo0NXFerg= github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4/go.mod h1:nGNEErzf+NRznT+N2SWqmHnDnF9aLgANB1CUNEan09o= -github.com/jesseduffield/gocui v0.3.1-0.20210614081440-74b42ecad52b h1:Wc2zx6xKLNaHc7/wIO6iYyDSjcFGN1Osd6tQvbgMmgo= -github.com/jesseduffield/gocui v0.3.1-0.20210614081440-74b42ecad52b/go.mod h1:QWq79xplEoyhQO+dgpk3sojjTVRKjQklyTlzm5nC5Kg= +github.com/jesseduffield/gocui v0.3.1-0.20211017035223-b68948e63cc3 h1:J5s/4Y860tas8J0AMQ3gJKCbJPx8zNpiTm5UjEgPQfY= +github.com/jesseduffield/gocui v0.3.1-0.20211017035223-b68948e63cc3/go.mod h1:znJuCDnF2Ph40YZSlBwdX/4GEofnIoWLGdT4mK5zRAU= +github.com/jesseduffield/gocui v0.3.1-0.20211017041119-0ec562dfd23b h1:kepukaDQfZ6LBSvHUYReFvVSW5Lx5ZQZDgGhXj0Mx7U= +github.com/jesseduffield/gocui v0.3.1-0.20211017041119-0ec562dfd23b/go.mod h1:znJuCDnF2Ph40YZSlBwdX/4GEofnIoWLGdT4mK5zRAU= +github.com/jesseduffield/gocui v0.3.1-0.20211017063715-c74848d8ad00 h1:5TusU8ir9OHg3By2PPmLwa2y+2G9F+16QRK8bpofsC0= +github.com/jesseduffield/gocui v0.3.1-0.20211017063715-c74848d8ad00/go.mod h1:znJuCDnF2Ph40YZSlBwdX/4GEofnIoWLGdT4mK5zRAU= +github.com/jesseduffield/gocui v0.3.1-0.20211017091015-8bf4a4666b77 h1:MQUxSxVBTZQpSYybEiFA4+oIi02ycTKGCqgHItYi/20= +github.com/jesseduffield/gocui v0.3.1-0.20211017091015-8bf4a4666b77/go.mod h1:znJuCDnF2Ph40YZSlBwdX/4GEofnIoWLGdT4mK5zRAU= +github.com/jesseduffield/gocui v0.3.1-0.20211017220056-b2fc03c74a6f h1:JHrb78pj+gYC3KiJKL1WW6lYzlatBIF46oREn68plTM= +github.com/jesseduffield/gocui v0.3.1-0.20211017220056-b2fc03c74a6f/go.mod h1:znJuCDnF2Ph40YZSlBwdX/4GEofnIoWLGdT4mK5zRAU= +github.com/jesseduffield/minimal v0.0.0-20211018110810-9cde264e6b1e h1:WZc73tBVMMhcO6zXyZBItLEF4jgBpBH0lFCZzDgrjDg= +github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e h1:uw/oo+kg7t/oeMs6sqlAwr85ND/9cpO3up3VxphxY0U= +github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e/go.mod h1:u60qdFGXRd36jyEXxetz0vQceQIxzI13lIo3EFUDf4I= github.com/jesseduffield/yaml v2.1.0+incompatible h1:HWQJ1gIv2zHKbDYNp0Jwjlj24K8aqpFHnMCynY1EpmE= github.com/jesseduffield/yaml v2.1.0+incompatible/go.mod h1:w0xGhOSIJCGYYW+hnFPTutCy5aACpkcwbmORt5axGqk= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -103,8 +120,6 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -119,6 +134,9 @@ github.com/onsi/ginkgo v1.10.3 h1:OoxbjfXVZyod1fmWYhI7SEyaD8B00ynP3T+D5GiyHOY= github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/ozeidan/fuzzy-patricia v1.0.1 h1:YExnavqXH3OvCCqE2TunuJJHdFcFQdVEfUoWzrnPxSg= +github.com/ozeidan/fuzzy-patricia v3.0.0+incompatible h1:Pl61eMyfJqgY/wytiI4vamqPYribq6d8VxeP1CNyg9M= +github.com/ozeidan/fuzzy-patricia v3.0.0+incompatible/go.mod h1:zgvuCcYS7wB7fVCGblsaFFmEe8+aAH13dTYm8FbrpsM= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -138,11 +156,16 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/urfave/cli v1.20.1-0.20180226030253-8e01ec4cd3e2/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70= github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= +github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8= +github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -162,22 +185,23 @@ golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210611083646-a4fc73990273 h1:faDu4veV+8pcThn4fewv6TVlNCezafGoC1gM/mxQLbQ= -golang.org/x/sys v0.0.0-20210611083646-a4fc73990273/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211015200801-69063c4bb744 h1:KzbpndAYEM+4oHRp9JmB2ewj0NHHxO3Z0g7Gus2O1kk= +golang.org/x/sys v0.0.0-20211015200801-69063c4bb744/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210503060354-a79de5458b56 h1:b8jxX3zqjpqb2LklXPzKSGJhzyxCOZSz8ncv8Nv+y7w= -golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -185,6 +209,8 @@ gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8X gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/ozeidan/fuzzy-patricia.v3 v3.0.0 h1:KzcWKJ0nMAmGoBhYVMnkWc1rXjB42lKy5aIys4TdLOA= +gopkg.in/ozeidan/fuzzy-patricia.v3 v3.0.0/go.mod h1:XoytMOotjRRJVkIsQdxsPIioRLYFISEaY9a4tftOXAo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= @@ -193,3 +219,5 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/main.go b/main.go index 67d6e8287..0b6a97e64 100644 --- a/main.go +++ b/main.go @@ -61,6 +61,9 @@ func main() { gitDir := "" flaggy.String(&gitDir, "g", "git-dir", "equivalent of the --git-dir git argument") + customConfig := "" + flaggy.String(&customConfig, "ucf", "use-config-file", "Comma seperated list to custom config file(s)") + flaggy.Parse() if repoPath != "" { @@ -72,6 +75,10 @@ func main() { gitDir = filepath.Join(repoPath, ".git") } + if customConfig != "" { + os.Setenv("LG_CONFIG_FILE", customConfig) + } + if useConfigDir != "" { os.Setenv("CONFIG_DIR", useConfigDir) } diff --git a/pkg/app/app.go b/pkg/app/app.go index 52a168796..bb7485cca 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -4,15 +4,6 @@ import ( "bufio" "errors" "fmt" - "github.com/aybabtme/humanlog" - "github.com/jesseduffield/lazygit/pkg/commands" - "github.com/jesseduffield/lazygit/pkg/commands/oscommands" - "github.com/jesseduffield/lazygit/pkg/config" - "github.com/jesseduffield/lazygit/pkg/env" - "github.com/jesseduffield/lazygit/pkg/gui" - "github.com/jesseduffield/lazygit/pkg/i18n" - "github.com/jesseduffield/lazygit/pkg/updates" - "github.com/sirupsen/logrus" "io" "io/ioutil" "log" @@ -21,6 +12,17 @@ import ( "regexp" "strconv" "strings" + + "github.com/aybabtme/humanlog" + "github.com/jesseduffield/lazygit/pkg/commands" + "github.com/jesseduffield/lazygit/pkg/commands/git_config" + "github.com/jesseduffield/lazygit/pkg/commands/oscommands" + "github.com/jesseduffield/lazygit/pkg/config" + "github.com/jesseduffield/lazygit/pkg/env" + "github.com/jesseduffield/lazygit/pkg/gui" + "github.com/jesseduffield/lazygit/pkg/i18n" + "github.com/jesseduffield/lazygit/pkg/updates" + "github.com/sirupsen/logrus" ) // App struct @@ -102,7 +104,10 @@ func NewApp(config config.AppConfigurer, filterPath string) (*App, error) { } var err error app.Log = newLogger(config) - app.Tr = i18n.NewTranslationSet(app.Log) + app.Tr, err = i18n.NewTranslationSetFromConfig(app.Log, config.GetUserConfig().Gui.Language) + if err != nil { + return app, err + } // if we are being called in 'demon' mode, we can just return here app.ClientContext = os.Getenv("LAZYGIT_CLIENT_COMMAND") @@ -122,7 +127,7 @@ func NewApp(config config.AppConfigurer, filterPath string) (*App, error) { return app, err } - app.GitCommand, err = commands.NewGitCommand(app.Log, app.OSCommand, app.Tr, app.Config) + app.GitCommand, err = commands.NewGitCommand(app.Log, app.OSCommand, app.Tr, app.Config, git_config.NewStdCachedGitConfig(app.Log)) if err != nil { return app, err } diff --git a/pkg/app/logging.go b/pkg/app/logging.go index 6a3c1e7c0..40d58ad62 100644 --- a/pkg/app/logging.go +++ b/pkg/app/logging.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package app diff --git a/pkg/app/logging_windows.go b/pkg/app/logging_windows.go index affd5a018..f8b3d4990 100644 --- a/pkg/app/logging_windows.go +++ b/pkg/app/logging_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package app diff --git a/pkg/commands/branches.go b/pkg/commands/branches.go index 9d4bf4512..3f6820c09 100644 --- a/pkg/commands/branches.go +++ b/pkg/commands/branches.go @@ -11,7 +11,7 @@ import ( // NewBranch create new branch func (c *GitCommand) NewBranch(name string, base string) error { - return c.RunCommand("git checkout -b %s %s", name, base) + return c.RunCommand("git checkout -b %s %s", c.OSCommand.Quote(name), c.OSCommand.Quote(base)) } // CurrentBranchName get the current branch name and displayname. @@ -47,7 +47,7 @@ func (c *GitCommand) DeleteBranch(branch string, force bool) error { command = "git branch -D" } - return c.OSCommand.RunCommand("%s %s", command, branch) + return c.OSCommand.RunCommand("%s %s", command, c.OSCommand.Quote(branch)) } // Checkout checks out a branch (or commit), with --force if you set the force arg to true @@ -61,7 +61,7 @@ func (c *GitCommand) Checkout(branch string, options CheckoutOptions) error { if options.Force { forceArg = " --force" } - return c.OSCommand.RunCommandWithOptions(fmt.Sprintf("git checkout%s %s", forceArg, branch), oscommands.RunCommandOptions{EnvVars: options.EnvVars}) + return c.OSCommand.RunCommandWithOptions(fmt.Sprintf("git checkout%s %s", forceArg, c.OSCommand.Quote(branch)), oscommands.RunCommandOptions{EnvVars: options.EnvVars}) } // GetBranchGraph gets the color-formatted graph of the log for the given branch @@ -73,24 +73,24 @@ func (c *GitCommand) GetBranchGraph(branchName string) (string, error) { } func (c *GitCommand) GetUpstreamForBranch(branchName string) (string, error) { - output, err := c.RunCommandWithOutput("git rev-parse --abbrev-ref --symbolic-full-name %s@{u}", branchName) + output, err := c.RunCommandWithOutput("git rev-parse --abbrev-ref --symbolic-full-name %s@{u}", c.OSCommand.Quote(branchName)) return strings.TrimSpace(output), err } func (c *GitCommand) GetBranchGraphCmdStr(branchName string) string { branchLogCmdTemplate := c.Config.GetUserConfig().Git.BranchLogCmd templateValues := map[string]string{ - "branchName": branchName, + "branchName": c.OSCommand.Quote(branchName), } return utils.ResolvePlaceholderString(branchLogCmdTemplate, templateValues) } func (c *GitCommand) SetUpstreamBranch(upstream string) error { - return c.RunCommand("git branch -u %s", upstream) + return c.RunCommand("git branch -u %s", c.OSCommand.Quote(upstream)) } func (c *GitCommand) SetBranchUpstream(remoteName string, remoteBranchName string, branchName string) error { - return c.RunCommand("git branch --set-upstream-to=%s/%s %s", remoteName, remoteBranchName, branchName) + return c.RunCommand("git branch --set-upstream-to=%s/%s %s", c.OSCommand.Quote(remoteName), c.OSCommand.Quote(remoteBranchName), c.OSCommand.Quote(branchName)) } func (c *GitCommand) GetCurrentBranchUpstreamDifferenceCount() (string, string) { @@ -124,7 +124,7 @@ type MergeOpts struct { func (c *GitCommand) Merge(branchName string, opts MergeOpts) error { mergeArgs := c.Config.GetUserConfig().Git.Merging.Args - command := fmt.Sprintf("git merge --no-edit %s %s", mergeArgs, branchName) + command := fmt.Sprintf("git merge --no-edit %s %s", mergeArgs, c.OSCommand.Quote(branchName)) if opts.FastForwardOnly { command = fmt.Sprintf("%s --ff-only", command) } @@ -144,18 +144,18 @@ func (c *GitCommand) IsHeadDetached() bool { // ResetHardHead runs `git reset --hard` func (c *GitCommand) ResetHard(ref string) error { - return c.RunCommand("git reset --hard " + ref) + return c.RunCommand("git reset --hard " + c.OSCommand.Quote(ref)) } // ResetSoft runs `git reset --soft HEAD` func (c *GitCommand) ResetSoft(ref string) error { - return c.RunCommand("git reset --soft " + ref) + return c.RunCommand("git reset --soft " + c.OSCommand.Quote(ref)) } func (c *GitCommand) ResetMixed(ref string) error { - return c.RunCommand("git reset --mixed " + ref) + return c.RunCommand("git reset --mixed " + c.OSCommand.Quote(ref)) } func (c *GitCommand) RenameBranch(oldName string, newName string) error { - return c.RunCommand("git branch --move %s %s", oldName, newName) + return c.RunCommand("git branch --move %s %s", c.OSCommand.Quote(oldName), c.OSCommand.Quote(newName)) } diff --git a/pkg/commands/commits_test.go b/pkg/commands/commits_test.go index f979e9507..eed6f2207 100644 --- a/pkg/commands/commits_test.go +++ b/pkg/commands/commits_test.go @@ -38,6 +38,8 @@ func TestGitCommandResetToCommit(t *testing.T) { // TestGitCommandCommitStr is a function. func TestGitCommandCommitStr(t *testing.T) { + gitCmd := NewDummyGitCommand() + type scenario struct { testName string message string @@ -50,25 +52,24 @@ func TestGitCommandCommitStr(t *testing.T) { testName: "Commit", message: "test", flags: "", - expected: "git commit -m \"test\"", + expected: "git commit -m " + gitCmd.OSCommand.Quote("test"), }, { testName: "Commit with --no-verify flag", message: "test", flags: "--no-verify", - expected: "git commit --no-verify -m \"test\"", + expected: "git commit --no-verify -m " + gitCmd.OSCommand.Quote("test"), }, { testName: "Commit with multiline message", message: "line1\nline2", flags: "", - expected: "git commit -m \"line1\" -m \"line2\"", + expected: "git commit -m " + gitCmd.OSCommand.Quote("line1") + " -m " + gitCmd.OSCommand.Quote("line2"), }, } for _, s := range scenarios { t.Run(s.testName, func(t *testing.T) { - gitCmd := NewDummyGitCommand() cmdStr := gitCmd.CommitCmdStr(s.message, s.flags) assert.Equal(t, s.expected, cmdStr) }) diff --git a/pkg/commands/config.go b/pkg/commands/config.go index 9600c3403..922e4f580 100644 --- a/pkg/commands/config.go +++ b/pkg/commands/config.go @@ -15,12 +15,8 @@ func (c *GitCommand) ConfiguredPager() string { if os.Getenv("PAGER") != "" { return os.Getenv("PAGER") } - output, err := c.RunCommandWithOutput("git config --get-all core.pager") - if err != nil { - return "" - } - trimmedOutput := strings.TrimSpace(output) - return strings.Split(trimmedOutput, "\n")[0] + output := c.GitConfig.Get("core.pager") + return strings.Split(output, "\n")[0] } func (c *GitCommand) GetPager(width int) string { @@ -42,11 +38,6 @@ func (c *GitCommand) colorArg() string { return c.Config.GetUserConfig().Git.Paging.ColorArg } -func (c *GitCommand) GetConfigValue(key string) string { - output, _ := c.getGitConfigValue(key) - return output -} - // UsingGpg tells us whether the user has gpg enabled so that we can know // whether we need to run a subprocess to allow them to enter their password func (c *GitCommand) UsingGpg() bool { @@ -55,8 +46,5 @@ func (c *GitCommand) UsingGpg() bool { return false } - gpgsign := c.GetConfigValue("commit.gpgsign") - value := strings.ToLower(gpgsign) - - return value == "true" || value == "1" || value == "yes" || value == "on" + return c.GitConfig.GetBool("commit.gpgsign") } diff --git a/pkg/commands/config_test.go b/pkg/commands/config_test.go deleted file mode 100644 index c16b53901..000000000 --- a/pkg/commands/config_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package commands - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -// TestGitCommandUsingGpg is a function. -func TestGitCommandUsingGpg(t *testing.T) { - type scenario struct { - testName string - getGitConfigValue func(string) (string, error) - test func(bool) - } - - scenarios := []scenario{ - { - "Option global and local config commit.gpgsign is not set", - func(string) (string, error) { return "", nil }, - func(gpgEnabled bool) { - assert.False(t, gpgEnabled) - }, - }, - { - "Option commit.gpgsign is true", - func(string) (string, error) { - return "True", nil - }, - func(gpgEnabled bool) { - assert.True(t, gpgEnabled) - }, - }, - { - "Option commit.gpgsign is on", - func(string) (string, error) { - return "ON", nil - }, - func(gpgEnabled bool) { - assert.True(t, gpgEnabled) - }, - }, - { - "Option commit.gpgsign is yes", - func(string) (string, error) { - return "YeS", nil - }, - func(gpgEnabled bool) { - assert.True(t, gpgEnabled) - }, - }, - { - "Option commit.gpgsign is 1", - func(string) (string, error) { - return "1", nil - }, - func(gpgEnabled bool) { - assert.True(t, gpgEnabled) - }, - }, - } - - for _, s := range scenarios { - t.Run(s.testName, func(t *testing.T) { - gitCmd := NewDummyGitCommand() - gitCmd.getGitConfigValue = s.getGitConfigValue - s.test(gitCmd.UsingGpg()) - }) - } -} diff --git a/pkg/commands/dummies.go b/pkg/commands/dummies.go index 6feb908e3..a8178385d 100644 --- a/pkg/commands/dummies.go +++ b/pkg/commands/dummies.go @@ -1,6 +1,7 @@ package commands import ( + "github.com/jesseduffield/lazygit/pkg/commands/git_config" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" "github.com/jesseduffield/lazygit/pkg/config" "github.com/jesseduffield/lazygit/pkg/i18n" @@ -14,11 +15,12 @@ func NewDummyGitCommand() *GitCommand { // NewDummyGitCommandWithOSCommand creates a new dummy GitCommand for testing func NewDummyGitCommandWithOSCommand(osCommand *oscommands.OSCommand) *GitCommand { + newAppConfig := config.NewDummyAppConfig() return &GitCommand{ - Log: utils.NewDummyLog(), - OSCommand: osCommand, - Tr: i18n.NewTranslationSet(utils.NewDummyLog()), - Config: config.NewDummyAppConfig(), - getGitConfigValue: func(string) (string, error) { return "", nil }, + Log: utils.NewDummyLog(), + OSCommand: osCommand, + Tr: i18n.NewTranslationSet(utils.NewDummyLog(), newAppConfig.GetUserConfig().Gui.Language), + Config: newAppConfig, + GitConfig: git_config.NewFakeGitConfig(map[string]string{}), } } diff --git a/pkg/commands/files.go b/pkg/commands/files.go index f4588aac5..07c4c4d28 100644 --- a/pkg/commands/files.go +++ b/pkg/commands/files.go @@ -2,8 +2,10 @@ package commands import ( "fmt" + "io/ioutil" "os" "path/filepath" + "strconv" "time" "github.com/go-errors/errors" @@ -14,7 +16,11 @@ import ( // CatFile obtains the content of a file func (c *GitCommand) CatFile(fileName string) (string, error) { - return c.OSCommand.CatFile(fileName) + buf, err := ioutil.ReadFile(fileName) + if err != nil { + return "", nil + } + return string(buf), nil } func (c *GitCommand) OpenMergeToolCmd() string { @@ -117,14 +123,14 @@ func (c *GitCommand) DiscardAllFileChanges(file *models.File) error { if err := c.RunCommand("git checkout --ours -- %s", quotedFileName); err != nil { return err } - if err := c.RunCommand("git add %s", quotedFileName); err != nil { + if err := c.RunCommand("git add -- %s", quotedFileName); err != nil { return err } return nil } if file.ShortStatus == "DU" { - return c.RunCommand("git rm %s", quotedFileName) + return c.RunCommand("git rm -- %s", quotedFileName) } // if the file isn't tracked, we assume you want to delete it @@ -199,7 +205,7 @@ func (c *GitCommand) WorktreeFileDiffCmdStr(node models.IFile, plain bool, cache cachedArg := "" trackedArg := "--" colorArg := c.colorArg() - path := c.OSCommand.Quote(node.GetPath()) + quotedPath := c.OSCommand.Quote(node.GetPath()) ignoreWhitespaceArg := "" if cached { cachedArg = "--cached" @@ -214,11 +220,11 @@ func (c *GitCommand) WorktreeFileDiffCmdStr(node models.IFile, plain bool, cache ignoreWhitespaceArg = "--ignore-all-space" } - return fmt.Sprintf("git diff --submodule --no-ext-diff --color=%s %s %s %s %s", colorArg, ignoreWhitespaceArg, cachedArg, trackedArg, path) + return fmt.Sprintf("git diff --submodule --no-ext-diff --color=%s %s %s %s %s", colorArg, ignoreWhitespaceArg, cachedArg, trackedArg, quotedPath) } func (c *GitCommand) ApplyPatch(patch string, flags ...string) error { - filepath := filepath.Join(c.Config.GetUserConfigDir(), utils.GetCurrentRepoName(), time.Now().Format("Jan _2 15.04.05.000000000")+".patch") + filepath := filepath.Join(c.Config.GetTempDir(), utils.GetCurrentRepoName(), time.Now().Format("Jan _2 15.04.05.000000000")+".patch") c.Log.Infof("saving temporary patch to %s", filepath) if err := c.OSCommand.CreateFileWithContent(filepath, patch); err != nil { return err @@ -250,12 +256,12 @@ func (c *GitCommand) ShowFileDiffCmdStr(from string, to string, reverse bool, fi reverseFlag = " -R " } - return fmt.Sprintf("git diff --submodule --no-ext-diff --no-renames --color=%s %s %s %s -- %s", colorArg, from, to, reverseFlag, fileName) + return fmt.Sprintf("git diff --submodule --no-ext-diff --no-renames --color=%s %s %s %s -- %s", colorArg, from, to, reverseFlag, c.OSCommand.Quote(fileName)) } // CheckoutFile checks out the file for the given commit func (c *GitCommand) CheckoutFile(commitSha, fileName string) error { - return c.RunCommand("git checkout %s %s", commitSha, fileName) + return c.RunCommand("git checkout %s -- %s", commitSha, c.OSCommand.Quote(fileName)) } // DiscardOldFileChanges discards changes to a file from an old commit @@ -265,7 +271,7 @@ func (c *GitCommand) DiscardOldFileChanges(commits []*models.Commit, commitIndex } // check if file exists in previous commit (this command returns an error if the file doesn't exist) - if err := c.RunCommand("git cat-file -e HEAD^:%s", fileName); err != nil { + if err := c.RunCommand("git cat-file -e HEAD^:%s", c.OSCommand.Quote(fileName)); err != nil { if err := c.OSCommand.Remove(fileName); err != nil { return err } @@ -293,7 +299,7 @@ func (c *GitCommand) DiscardAnyUnstagedFileChanges() error { // RemoveTrackedFiles will delete the given file(s) even if they are currently tracked func (c *GitCommand) RemoveTrackedFiles(name string) error { - return c.RunCommand("git rm -r --cached %s", name) + return c.RunCommand("git rm -r --cached -- %s", c.OSCommand.Quote(name)) } // RemoveUntrackedFiles runs `git clean -fd` @@ -321,11 +327,11 @@ func (c *GitCommand) ResetAndClean() error { return c.RemoveUntrackedFiles() } -func (c *GitCommand) EditFileCmdStr(filename string) (string, error) { +func (c *GitCommand) EditFileCmdStr(filename string, lineNumber int) (string, error) { editor := c.Config.GetUserConfig().OS.EditCommand if editor == "" { - editor = c.GetConfigValue("core.editor") + editor = c.GitConfig.Get("core.editor") } if editor == "" { @@ -346,5 +352,12 @@ func (c *GitCommand) EditFileCmdStr(filename string) (string, error) { return "", errors.New("No editor defined in config file, $GIT_EDITOR, $VISUAL, $EDITOR, or git config") } - return fmt.Sprintf("%s %s", editor, c.OSCommand.Quote(filename)), nil + templateValues := map[string]string{ + "editor": editor, + "filename": c.OSCommand.Quote(filename), + "line": strconv.Itoa(lineNumber), + } + + editCmdTemplate := c.Config.GetUserConfig().OS.EditCommandTemplate + return utils.ResolvePlaceholderString(editCmdTemplate, templateValues), nil } diff --git a/pkg/commands/files_test.go b/pkg/commands/files_test.go index fd4b9f69f..f72b47ca0 100644 --- a/pkg/commands/files_test.go +++ b/pkg/commands/files_test.go @@ -4,37 +4,15 @@ import ( "fmt" "io/ioutil" "os/exec" - "runtime" "testing" + "github.com/jesseduffield/lazygit/pkg/commands/git_config" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/secureexec" "github.com/jesseduffield/lazygit/pkg/test" "github.com/stretchr/testify/assert" ) -// TestGitCommandCatFile tests emitting a file using commands, where commands vary by OS. -func TestGitCommandCatFile(t *testing.T) { - var osCmd string - switch os := runtime.GOOS; os { - case "windows": - osCmd = "type" - default: - osCmd = "cat" - } - gitCmd := NewDummyGitCommand() - gitCmd.OSCommand.Command = func(cmd string, args ...string) *exec.Cmd { - assert.EqualValues(t, osCmd, cmd) - assert.EqualValues(t, []string{"test.txt"}, args) - - return secureexec.Command("echo", "-n", "test") - } - - o, err := gitCmd.CatFile("test.txt") - assert.NoError(t, err) - assert.Equal(t, "test", o) -} - // TestGitCommandStageFile is a function. func TestGitCommandStageFile(t *testing.T) { gitCmd := NewDummyGitCommand() @@ -455,7 +433,7 @@ func TestGitCommandCheckoutFile(t *testing.T) { "test999.txt", test.CreateMockCommand(t, []*test.CommandSwapper{ { - Expect: "git checkout 11af912 test999.txt", + Expect: "git checkout 11af912 -- test999.txt", Replace: "echo", }, }), @@ -469,7 +447,7 @@ func TestGitCommandCheckoutFile(t *testing.T) { "test999.txt", test.CreateMockCommand(t, []*test.CommandSwapper{ { - Expect: "git checkout 11af912 test999.txt", + Expect: "git checkout 11af912 -- test999.txt", Replace: "test", }, }), @@ -546,24 +524,21 @@ func TestGitCommandApplyPatch(t *testing.T) { } } -// TestGitCommandDiscardOldFileChanges is a function. func TestGitCommandDiscardOldFileChanges(t *testing.T) { type scenario struct { - testName string - getGitConfigValue func(string) (string, error) - commits []*models.Commit - commitIndex int - fileName string - command func(string, ...string) *exec.Cmd - test func(error) + testName string + gitConfigMockResponses map[string]string + commits []*models.Commit + commitIndex int + fileName string + command func(string, ...string) *exec.Cmd + test func(error) } scenarios := []scenario{ { "returns error when index outside of range of commits", - func(string) (string, error) { - return "", nil - }, + nil, []*models.Commit{}, 0, "test999.txt", @@ -574,9 +549,7 @@ func TestGitCommandDiscardOldFileChanges(t *testing.T) { }, { "returns error when using gpg", - func(string) (string, error) { - return "true", nil - }, + map[string]string{"commit.gpgsign": "true"}, []*models.Commit{{Name: "commit", Sha: "123456"}}, 0, "test999.txt", @@ -587,9 +560,7 @@ func TestGitCommandDiscardOldFileChanges(t *testing.T) { }, { "checks out file if it already existed", - func(string) (string, error) { - return "", nil - }, + nil, []*models.Commit{ {Name: "commit", Sha: "123456"}, {Name: "commit2", Sha: "abcdef"}, @@ -606,7 +577,7 @@ func TestGitCommandDiscardOldFileChanges(t *testing.T) { Replace: "echo", }, { - Expect: "git checkout HEAD^ test999.txt", + Expect: "git checkout HEAD^ -- test999.txt", Replace: "echo", }, { @@ -631,7 +602,7 @@ func TestGitCommandDiscardOldFileChanges(t *testing.T) { for _, s := range scenarios { t.Run(s.testName, func(t *testing.T) { gitCmd.OSCommand.Command = s.command - gitCmd.getGitConfigValue = s.getGitConfigValue + gitCmd.GitConfig = git_config.NewFakeGitConfig(s.gitConfigMockResponses) s.test(gitCmd.DiscardOldFileChanges(s.commits, s.commitIndex, s.fileName)) }) } @@ -740,28 +711,30 @@ func TestGitCommandRemoveUntrackedFiles(t *testing.T) { // TestEditFileCmdStr is a function. func TestEditFileCmdStr(t *testing.T) { + gitCmd := NewDummyGitCommand() + type scenario struct { - filename string - configEditCommand string - command func(string, ...string) *exec.Cmd - getenv func(string) string - getGitConfigValue func(string) (string, error) - test func(string, error) + filename string + configEditCommand string + configEditCommandTemplate string + command func(string, ...string) *exec.Cmd + getenv func(string) string + gitConfigMockResponses map[string]string + test func(string, error) } scenarios := []scenario{ { "test", "", + "{{editor}} {{filename}}", func(name string, arg ...string) *exec.Cmd { return secureexec.Command("exit", "1") }, func(env string) string { return "" }, - func(cf string) (string, error) { - return "", nil - }, + nil, func(cmdStr string, err error) { assert.EqualError(t, err, "No editor defined in config file, $GIT_EDITOR, $VISUAL, $EDITOR, or git config") }, @@ -769,6 +742,7 @@ func TestEditFileCmdStr(t *testing.T) { { "test", "nano", + "{{editor}} {{filename}}", func(name string, args ...string) *exec.Cmd { assert.Equal(t, "which", name) return secureexec.Command("echo") @@ -776,17 +750,16 @@ func TestEditFileCmdStr(t *testing.T) { func(env string) string { return "" }, - func(cf string) (string, error) { - return "", nil - }, + nil, func(cmdStr string, err error) { assert.NoError(t, err) - assert.Equal(t, "nano \"test\"", cmdStr) + assert.Equal(t, "nano "+gitCmd.OSCommand.Quote("test"), cmdStr) }, }, { "test", "", + "{{editor}} {{filename}}", func(name string, arg ...string) *exec.Cmd { assert.Equal(t, "which", name) return secureexec.Command("exit", "1") @@ -794,17 +767,16 @@ func TestEditFileCmdStr(t *testing.T) { func(env string) string { return "" }, - func(cf string) (string, error) { - return "nano", nil - }, + map[string]string{"core.editor": "nano"}, func(cmdStr string, err error) { assert.NoError(t, err) - assert.Equal(t, "nano \"test\"", cmdStr) + assert.Equal(t, "nano "+gitCmd.OSCommand.Quote("test"), cmdStr) }, }, { "test", "", + "{{editor}} {{filename}}", func(name string, arg ...string) *exec.Cmd { assert.Equal(t, "which", name) return secureexec.Command("exit", "1") @@ -816,9 +788,7 @@ func TestEditFileCmdStr(t *testing.T) { return "" }, - func(cf string) (string, error) { - return "", nil - }, + nil, func(cmdStr string, err error) { assert.NoError(t, err) }, @@ -826,6 +796,7 @@ func TestEditFileCmdStr(t *testing.T) { { "test", "", + "{{editor}} {{filename}}", func(name string, arg ...string) *exec.Cmd { assert.Equal(t, "which", name) return secureexec.Command("exit", "1") @@ -837,17 +808,16 @@ func TestEditFileCmdStr(t *testing.T) { return "" }, - func(cf string) (string, error) { - return "", nil - }, + nil, func(cmdStr string, err error) { assert.NoError(t, err) - assert.Equal(t, "emacs \"test\"", cmdStr) + assert.Equal(t, "emacs "+gitCmd.OSCommand.Quote("test"), cmdStr) }, }, { "test", "", + "{{editor}} {{filename}}", func(name string, arg ...string) *exec.Cmd { assert.Equal(t, "which", name) return secureexec.Command("echo") @@ -855,17 +825,16 @@ func TestEditFileCmdStr(t *testing.T) { func(env string) string { return "" }, - func(cf string) (string, error) { - return "", nil - }, + nil, func(cmdStr string, err error) { assert.NoError(t, err) - assert.Equal(t, "vi \"test\"", cmdStr) + assert.Equal(t, "vi "+gitCmd.OSCommand.Quote("test"), cmdStr) }, }, { "file/with space", "", + "{{editor}} {{filename}}", func(name string, args ...string) *exec.Cmd { assert.Equal(t, "which", name) return secureexec.Command("echo") @@ -873,22 +842,37 @@ func TestEditFileCmdStr(t *testing.T) { func(env string) string { return "" }, - func(cf string) (string, error) { - return "", nil - }, + nil, func(cmdStr string, err error) { assert.NoError(t, err) - assert.Equal(t, "vi \"file/with space\"", cmdStr) + assert.Equal(t, "vi "+gitCmd.OSCommand.Quote("file/with space"), cmdStr) + }, + }, + { + "open file/at line", + "vim", + "{{editor}} +{{line}} {{filename}}", + func(name string, args ...string) *exec.Cmd { + assert.Equal(t, "which", name) + return secureexec.Command("echo") + }, + func(env string) string { + return "" + }, + nil, + func(cmdStr string, err error) { + assert.NoError(t, err) + assert.Equal(t, "vim +1 "+gitCmd.OSCommand.Quote("open file/at line"), cmdStr) }, }, } for _, s := range scenarios { - gitCmd := NewDummyGitCommand() gitCmd.Config.GetUserConfig().OS.EditCommand = s.configEditCommand + gitCmd.Config.GetUserConfig().OS.EditCommandTemplate = s.configEditCommandTemplate gitCmd.OSCommand.Command = s.command gitCmd.OSCommand.Getenv = s.getenv - gitCmd.getGitConfigValue = s.getGitConfigValue - s.test(gitCmd.EditFileCmdStr(s.filename)) + gitCmd.GitConfig = git_config.NewFakeGitConfig(s.gitConfigMockResponses) + s.test(gitCmd.EditFileCmdStr(s.filename, 1)) } } diff --git a/pkg/commands/git.go b/pkg/commands/git.go index b24bd5d0e..894ca253e 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -10,6 +10,7 @@ import ( "github.com/go-errors/errors" gogit "github.com/jesseduffield/go-git/v5" + "github.com/jesseduffield/lazygit/pkg/commands/git_config" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" "github.com/jesseduffield/lazygit/pkg/commands/patch" @@ -33,10 +34,10 @@ type GitCommand struct { Repo *gogit.Repository Tr *i18n.TranslationSet Config config.AppConfigurer - getGitConfigValue func(string) (string, error) DotGitDir string onSuccessfulContinue func() error PatchManager *patch.PatchManager + GitConfig git_config.IGitConfig // Push to current determines whether the user has configured to push to the remote branch of the same name as the current or not PushToCurrent bool @@ -45,22 +46,22 @@ type GitCommand struct { } // NewGitCommand it runs git commands -func NewGitCommand(log *logrus.Entry, osCommand *oscommands.OSCommand, tr *i18n.TranslationSet, config config.AppConfigurer) (*GitCommand, error) { +func NewGitCommand( + log *logrus.Entry, + osCommand *oscommands.OSCommand, + tr *i18n.TranslationSet, + config config.AppConfigurer, + gitConfig git_config.IGitConfig, +) (*GitCommand, error) { var repo *gogit.Repository - // see what our default push behaviour is - output, err := osCommand.RunCommandWithOutput("git config --get push.default") - pushToCurrent := false - if err != nil { - log.Errorf("error reading git config: %v", err) - } else { - pushToCurrent = strings.TrimSpace(output) == "current" - } + pushToCurrent := gitConfig.Get("push.default") == "current" if err := navigateToRepoRootDirectory(os.Stat, os.Chdir); err != nil { return nil, err } + var err error if repo, err = setupRepository(gogit.PlainOpen, tr.GitconfigParseErr); err != nil { return nil, err } @@ -71,14 +72,14 @@ func NewGitCommand(log *logrus.Entry, osCommand *oscommands.OSCommand, tr *i18n. } gitCommand := &GitCommand{ - Log: log, - OSCommand: osCommand, - Tr: tr, - Repo: repo, - Config: config, - getGitConfigValue: getGitConfigValue, - DotGitDir: dotGitDir, - PushToCurrent: pushToCurrent, + Log: log, + OSCommand: osCommand, + Tr: tr, + Repo: repo, + Config: config, + DotGitDir: dotGitDir, + PushToCurrent: pushToCurrent, + GitConfig: gitConfig, } gitCommand.PatchManager = patch.NewPatchManager(log, gitCommand.ApplyPatch, gitCommand.ShowFileDiff) @@ -249,3 +250,7 @@ func (c *GitCommand) RunCommandWithOutput(formatString string, formatArgs ...int return output, err } } + +func (c *GitCommand) NewCmdObjFromStr(cmdStr string) oscommands.ICmdObj { + return c.OSCommand.NewCmdObjFromStr(cmdStr).AddEnvVars("GIT_OPTIONAL_LOCKS=0") +} diff --git a/pkg/commands/git_config/cached_git_config.go b/pkg/commands/git_config/cached_git_config.go new file mode 100644 index 000000000..e2b83bad8 --- /dev/null +++ b/pkg/commands/git_config/cached_git_config.go @@ -0,0 +1,59 @@ +package git_config + +import ( + "strings" + + "github.com/sirupsen/logrus" +) + +type IGitConfig interface { + Get(string) string + GetBool(string) bool +} + +type CachedGitConfig struct { + cache map[string]string + getKey func(string) (string, error) + log *logrus.Entry +} + +func NewStdCachedGitConfig(log *logrus.Entry) *CachedGitConfig { + return NewCachedGitConfig(getGitConfigValue, log) +} + +func NewCachedGitConfig(getKey func(string) (string, error), log *logrus.Entry) *CachedGitConfig { + return &CachedGitConfig{ + cache: make(map[string]string), + getKey: getKey, + log: log, + } +} + +func (self *CachedGitConfig) Get(key string) string { + if value, ok := self.cache[key]; ok { + self.log.Debugf("using cache for key " + key) + return value + } + + value := self.getAux(key) + self.cache[key] = value + return value +} + +func (self *CachedGitConfig) getAux(key string) string { + value, err := self.getKey(key) + if err != nil { + self.log.Debugf("Error getting git config value for key: " + key + ". Error: " + err.Error()) + return "" + } + return strings.TrimSpace(value) +} + +func (self *CachedGitConfig) GetBool(key string) bool { + return isTruthy(self.Get(key)) +} + +func isTruthy(value string) bool { + lcValue := strings.ToLower(value) + return lcValue == "true" || lcValue == "1" || lcValue == "yes" || lcValue == "on" +} diff --git a/pkg/commands/git_config/cached_git_config_test.go b/pkg/commands/git_config/cached_git_config_test.go new file mode 100644 index 000000000..f03535a6e --- /dev/null +++ b/pkg/commands/git_config/cached_git_config_test.go @@ -0,0 +1,116 @@ +package git_config + +import ( + "testing" + + "github.com/jesseduffield/lazygit/pkg/utils" + "github.com/stretchr/testify/assert" +) + +func TestGetBool(t *testing.T) { + type scenario struct { + testName string + mockResponses map[string]string + expected bool + } + + scenarios := []scenario{ + { + "Option global and local config commit.gpgsign is not set", + map[string]string{}, + false, + }, + { + "Some other random key is set", + map[string]string{"blah": "blah"}, + false, + }, + { + "Option commit.gpgsign is true", + map[string]string{"commit.gpgsign": "True"}, + true, + }, + { + "Option commit.gpgsign is on", + map[string]string{"commit.gpgsign": "ON"}, + true, + }, + { + "Option commit.gpgsign is yes", + map[string]string{"commit.gpgsign": "YeS"}, + true, + }, + { + "Option commit.gpgsign is 1", + map[string]string{"commit.gpgsign": "1"}, + true, + }, + } + + for _, s := range scenarios { + s := s + t.Run(s.testName, func(t *testing.T) { + fake := NewFakeGitConfig(s.mockResponses) + real := NewCachedGitConfig( + func(key string) (string, error) { + return fake.Get(key), nil + }, + utils.NewDummyLog(), + ) + result := real.GetBool("commit.gpgsign") + assert.Equal(t, s.expected, result) + }) + } +} + +func TestGet(t *testing.T) { + type scenario struct { + testName string + mockResponses map[string]string + expected string + } + + scenarios := []scenario{ + { + "not set", + map[string]string{}, + "", + }, + { + "is set", + map[string]string{"commit.gpgsign": "blah"}, + "blah", + }, + } + + for _, s := range scenarios { + s := s + t.Run(s.testName, func(t *testing.T) { + fake := NewFakeGitConfig(s.mockResponses) + real := NewCachedGitConfig( + func(key string) (string, error) { + return fake.Get(key), nil + }, + utils.NewDummyLog(), + ) + result := real.Get("commit.gpgsign") + assert.Equal(t, s.expected, result) + }) + } + + // verifying that the cache is used + count := 0 + real := NewCachedGitConfig( + func(key string) (string, error) { + count++ + assert.Equal(t, "commit.gpgsign", key) + return "blah", nil + }, + utils.NewDummyLog(), + ) + result := real.Get("commit.gpgsign") + assert.Equal(t, "blah", result) + result = real.Get("commit.gpgsign") + assert.Equal(t, "blah", result) + assert.Equal(t, 1, count) +} diff --git a/pkg/commands/git_config/fake_git_config.go b/pkg/commands/git_config/fake_git_config.go new file mode 100644 index 000000000..f010efd8c --- /dev/null +++ b/pkg/commands/git_config/fake_git_config.go @@ -0,0 +1,22 @@ +package git_config + +type FakeGitConfig struct { + mockResponses map[string]string +} + +func NewFakeGitConfig(mockResponses map[string]string) *FakeGitConfig { + return &FakeGitConfig{ + mockResponses: mockResponses, + } +} + +func (self *FakeGitConfig) Get(key string) string { + if self.mockResponses == nil { + return "" + } + return self.mockResponses[key] +} + +func (self *FakeGitConfig) GetBool(key string) bool { + return isTruthy(self.Get(key)) +} diff --git a/pkg/commands/gitconfig.go b/pkg/commands/git_config/get_key.go similarity index 99% rename from pkg/commands/gitconfig.go rename to pkg/commands/git_config/get_key.go index dbe72c570..85892ea2d 100644 --- a/pkg/commands/gitconfig.go +++ b/pkg/commands/git_config/get_key.go @@ -1,4 +1,4 @@ -package commands +package git_config import ( "bytes" diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go index e31fe8910..19eabd583 100644 --- a/pkg/commands/git_test.go +++ b/pkg/commands/git_test.go @@ -8,6 +8,7 @@ import ( "github.com/go-errors/errors" gogit "github.com/jesseduffield/go-git/v5" + "github.com/jesseduffield/lazygit/pkg/commands/git_config" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" "github.com/jesseduffield/lazygit/pkg/config" "github.com/jesseduffield/lazygit/pkg/i18n" @@ -209,7 +210,8 @@ func TestNewGitCommand(t *testing.T) { for _, s := range scenarios { t.Run(s.testName, func(t *testing.T) { s.setup() - s.test(NewGitCommand(utils.NewDummyLog(), oscommands.NewDummyOSCommand(), i18n.NewTranslationSet(utils.NewDummyLog()), config.NewDummyAppConfig())) + newAppConfig := config.NewDummyAppConfig() + s.test(NewGitCommand(utils.NewDummyLog(), oscommands.NewDummyOSCommand(), i18n.NewTranslationSet(utils.NewDummyLog(), newAppConfig.GetUserConfig().Gui.Language), newAppConfig, git_config.NewFakeGitConfig(nil))) }) } } diff --git a/pkg/commands/loading_commits.go b/pkg/commands/loading_commits.go index bf7e4cf56..f5c1d662e 100644 --- a/pkg/commands/loading_commits.go +++ b/pkg/commands/loading_commits.go @@ -10,9 +10,9 @@ import ( "strconv" "strings" - "github.com/fatih/color" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/i18n" "github.com/sirupsen/logrus" ) @@ -165,8 +165,7 @@ func (c *CommitListBuilder) GetCommits(opts GetCommitsOptions) ([]*models.Commit if rebaseMode != "" { currentCommit := commits[len(rebasingCommits)] - blue := color.New(color.FgYellow) - youAreHere := blue.Sprintf("<-- %s ---", c.Tr.YouAreHere) + youAreHere := style.FgYellow.Sprintf("<-- %s ---", c.Tr.YouAreHere) currentCommit.Name = fmt.Sprintf("%s %s", youAreHere, currentCommit.Name) } @@ -323,7 +322,7 @@ func (c *CommitListBuilder) getMergeBase(refName string) (string, error) { } // swallowing error because it's not a big deal; probably because there are no commits yet - output, _ := c.OSCommand.RunCommandWithOutput("git merge-base %s %s", refName, baseBranch) + output, _ := c.OSCommand.RunCommandWithOutput("git merge-base %s %s", c.OSCommand.Quote(refName), c.OSCommand.Quote(baseBranch)) return ignoringWarnings(output), nil } @@ -340,7 +339,7 @@ func ignoringWarnings(commandOutput string) string { // getFirstPushedCommit returns the first commit SHA which has been pushed to the ref's upstream. // all commits above this are deemed unpushed and marked as such. func (c *CommitListBuilder) getFirstPushedCommit(refName string) (string, error) { - output, err := c.OSCommand.RunCommandWithOutput("git merge-base %s %s@{u}", refName, refName) + output, err := c.OSCommand.RunCommandWithOutput("git merge-base %s %s@{u}", c.OSCommand.Quote(refName), c.OSCommand.Quote(refName)) if err != nil { return "", err } @@ -362,8 +361,8 @@ func (c *CommitListBuilder) getLogCmd(opts GetCommitsOptions) *exec.Cmd { return c.OSCommand.ExecutableFromString( fmt.Sprintf( - "git log %s --oneline --pretty=format:\"%%H%s%%at%s%%aN%s%%d%s%%p%s%%s\" %s --abbrev=%d --date=unix %s", - opts.RefName, + "git log %s --oneline --pretty=format:\"%%H%s%%at%s%%aN%s%%d%s%%p%s%%s\" %s --abbrev=%d %s", + c.OSCommand.Quote(opts.RefName), SEPARATION_CHAR, SEPARATION_CHAR, SEPARATION_CHAR, diff --git a/pkg/commands/loading_commits_test.go b/pkg/commands/loading_commits_test.go index a637f5bd5..bd35556d4 100644 --- a/pkg/commands/loading_commits_test.go +++ b/pkg/commands/loading_commits_test.go @@ -19,7 +19,7 @@ func NewDummyCommitListBuilder() *CommitListBuilder { Log: utils.NewDummyLog(), GitCommand: NewDummyGitCommandWithOSCommand(osCommand), OSCommand: osCommand, - Tr: i18n.NewTranslationSet(utils.NewDummyLog()), + Tr: i18n.NewTranslationSet(utils.NewDummyLog(), "auto"), } } diff --git a/pkg/commands/loading_files.go b/pkg/commands/loading_files.go index 2b9bfc2be..098948ed4 100644 --- a/pkg/commands/loading_files.go +++ b/pkg/commands/loading_files.go @@ -8,8 +8,6 @@ import ( "github.com/jesseduffield/lazygit/pkg/utils" ) -const RENAME_SEPARATOR = " -> " - // GetStatusFiles git status files type GetStatusFileOptions struct { NoRenames bool @@ -17,43 +15,36 @@ type GetStatusFileOptions struct { func (c *GitCommand) GetStatusFiles(opts GetStatusFileOptions) []*models.File { // check if config wants us ignoring untracked files - untrackedFilesSetting := c.GetConfigValue("status.showUntrackedFiles") + untrackedFilesSetting := c.GitConfig.Get("status.showUntrackedFiles") if untrackedFilesSetting == "" { untrackedFilesSetting = "all" } untrackedFilesArg := fmt.Sprintf("--untracked-files=%s", untrackedFilesSetting) - statusStrings, err := c.GitStatus(GitStatusOptions{NoRenames: opts.NoRenames, UntrackedFilesArg: untrackedFilesArg}) + statuses, err := c.GitStatus(GitStatusOptions{NoRenames: opts.NoRenames, UntrackedFilesArg: untrackedFilesArg}) if err != nil { c.Log.Error(err) } files := []*models.File{} - for _, statusString := range statusStrings { - if strings.HasPrefix(statusString, "warning") { - c.Log.Warningf("warning when calling git status: %s", statusString) + for _, status := range statuses { + if strings.HasPrefix(status.StatusString, "warning") { + c.Log.Warningf("warning when calling git status: %s", status.StatusString) continue } - change := statusString[0:2] + change := status.Change stagedChange := change[0:1] - unstagedChange := statusString[1:2] - name := statusString[3:] + unstagedChange := change[1:2] untracked := utils.IncludesString([]string{"??", "A ", "AM"}, change) hasNoStagedChanges := utils.IncludesString([]string{" ", "U", "?"}, stagedChange) hasMergeConflicts := utils.IncludesString([]string{"DD", "AA", "UU", "AU", "UA", "UD", "DU"}, change) hasInlineMergeConflicts := utils.IncludesString([]string{"UU", "AA"}, change) - previousName := "" - if strings.Contains(name, RENAME_SEPARATOR) { - split := strings.Split(name, RENAME_SEPARATOR) - name = split[1] - previousName = split[0] - } file := &models.File{ - Name: name, - PreviousName: previousName, - DisplayString: statusString, + Name: status.Name, + PreviousName: status.PreviousName, + DisplayString: status.StatusString, HasStagedChanges: !hasNoStagedChanges, HasUnstagedChanges: unstagedChange != " ", Tracked: !untracked, @@ -61,7 +52,7 @@ func (c *GitCommand) GetStatusFiles(opts GetStatusFileOptions) []*models.File { Added: unstagedChange == "A" || untracked, HasMergeConflicts: hasMergeConflicts, HasInlineMergeConflicts: hasInlineMergeConflicts, - Type: c.OSCommand.FileType(name), + Type: c.OSCommand.FileType(status.Name), ShortStatus: change, } files = append(files, file) @@ -70,13 +61,20 @@ func (c *GitCommand) GetStatusFiles(opts GetStatusFileOptions) []*models.File { return files } -// GitStatus returns the plaintext short status of the repo +// GitStatus returns the file status of the repo type GitStatusOptions struct { NoRenames bool UntrackedFilesArg string } -func (c *GitCommand) GitStatus(opts GitStatusOptions) ([]string, error) { +type FileStatus struct { + StatusString string + Change string // ??, MM, AM, ... + Name string + PreviousName string +} + +func (c *GitCommand) GitStatus(opts GitStatusOptions) ([]FileStatus, error) { noRenamesFlag := "" if opts.NoRenames { noRenamesFlag = "--no-renames" @@ -84,23 +82,34 @@ func (c *GitCommand) GitStatus(opts GitStatusOptions) ([]string, error) { statusLines, err := c.RunCommandWithOutput("git status %s --porcelain -z %s", opts.UntrackedFilesArg, noRenamesFlag) if err != nil { - return []string{}, err + return []FileStatus{}, err } splitLines := strings.Split(statusLines, "\x00") - response := []string{} + response := []FileStatus{} for i := 0; i < len(splitLines); i++ { original := splitLines[i] - if len(original) < 2 { + + if len(original) < 3 { continue - } else if strings.HasPrefix(original, "R ") { + } + + status := FileStatus{ + StatusString: original, + Change: original[:2], + Name: original[3:], + PreviousName: "", + } + + if strings.HasPrefix(status.Change, "R") { // if a line starts with 'R' then the next line is the original file. - next := strings.TrimSpace(splitLines[i+1]) - original = "R " + next + RENAME_SEPARATOR + strings.TrimPrefix(original, "R ") + status.PreviousName = strings.TrimSpace(splitLines[i+1]) + status.StatusString = fmt.Sprintf("%s %s -> %s", status.Change, status.PreviousName, status.Name) i++ } - response = append(response, original) + + response = append(response, status) } return response, nil diff --git a/pkg/commands/loading_files_test.go b/pkg/commands/loading_files_test.go index eefb8f924..456e4aca7 100644 --- a/pkg/commands/loading_files_test.go +++ b/pkg/commands/loading_files_test.go @@ -136,6 +136,81 @@ func TestGitCommandGetStatusFiles(t *testing.T) { }, } + assert.EqualValues(t, expected, files) + }, + }, + { + "Renamed files", + func(cmd string, args ...string) *exec.Cmd { + return secureexec.Command( + "printf", + `R after1.txt\0before1.txt\0RM after2.txt\0before2.txt`, + ) + }, + func(files []*models.File) { + assert.Len(t, files, 2) + + expected := []*models.File{ + { + Name: "after1.txt", + PreviousName: "before1.txt", + HasStagedChanges: true, + HasUnstagedChanges: false, + Tracked: true, + Added: false, + Deleted: false, + HasMergeConflicts: false, + HasInlineMergeConflicts: false, + DisplayString: "R before1.txt -> after1.txt", + Type: "other", + ShortStatus: "R ", + }, + { + Name: "after2.txt", + PreviousName: "before2.txt", + HasStagedChanges: true, + HasUnstagedChanges: true, + Tracked: true, + Added: false, + Deleted: false, + HasMergeConflicts: false, + HasInlineMergeConflicts: false, + DisplayString: "RM before2.txt -> after2.txt", + Type: "other", + ShortStatus: "RM", + }, + } + + assert.EqualValues(t, expected, files) + }, + }, + { + "File with arrow in name", + func(cmd string, args ...string) *exec.Cmd { + return secureexec.Command( + "printf", + `?? a -> b.txt`, + ) + }, + func(files []*models.File) { + assert.Len(t, files, 1) + + expected := []*models.File{ + { + Name: "a -> b.txt", + HasStagedChanges: false, + HasUnstagedChanges: true, + Tracked: false, + Added: true, + Deleted: false, + HasMergeConflicts: false, + HasInlineMergeConflicts: false, + DisplayString: "?? a -> b.txt", + Type: "other", + ShortStatus: "??", + }, + } + assert.EqualValues(t, expected, files) }, }, diff --git a/pkg/commands/loading_reflog_commits.go b/pkg/commands/loading_reflog_commits.go index 0c6915543..619e5c225 100644 --- a/pkg/commands/loading_reflog_commits.go +++ b/pkg/commands/loading_reflog_commits.go @@ -2,8 +2,8 @@ package commands import ( "fmt" - "regexp" "strconv" + "strings" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" @@ -13,26 +13,25 @@ import ( // if none is passed (i.e. it's value is nil) then we get all the reflog commits func (c *GitCommand) GetReflogCommits(lastReflogCommit *models.Commit, filterPath string) ([]*models.Commit, bool, error) { commits := make([]*models.Commit, 0) - re := regexp.MustCompile(`(\w+).*HEAD@\{([^\}]+)\}: (.*)`) filterPathArg := "" if filterPath != "" { filterPathArg = fmt.Sprintf(" --follow -- %s", c.OSCommand.Quote(filterPath)) } - cmd := c.OSCommand.ExecutableFromString(fmt.Sprintf("git reflog --abbrev=20 --date=unix %s", filterPathArg)) + cmd := c.OSCommand.ExecutableFromString(fmt.Sprintf(`git log -g --abbrev=20 --format="%%h %%ct %%gs" %s`, filterPathArg)) onlyObtainedNewReflogCommits := false err := oscommands.RunLineOutputCmd(cmd, func(line string) (bool, error) { - match := re.FindStringSubmatch(line) - if len(match) <= 1 { + fields := strings.SplitN(line, " ", 3) + if len(fields) <= 2 { return false, nil } - unixTimestamp, _ := strconv.Atoi(match[2]) + unixTimestamp, _ := strconv.Atoi(fields[1]) commit := &models.Commit{ - Sha: match[1], - Name: match[3], + Sha: fields[0], + Name: fields[2], UnixTimestamp: int64(unixTimestamp), Status: "reflog", } diff --git a/pkg/commands/models/file.go b/pkg/commands/models/file.go index 0bbca78ae..c5e76949a 100644 --- a/pkg/commands/models/file.go +++ b/pkg/commands/models/file.go @@ -29,8 +29,6 @@ type IFile interface { GetPath() string } -const RENAME_SEPARATOR = " -> " - func (f *File) IsRename() bool { return f.PreviousName != "" } @@ -63,7 +61,7 @@ func (f *File) IsSubmodule(configs []*SubmoduleConfig) bool { func (f *File) SubmoduleConfig(configs []*SubmoduleConfig) *SubmoduleConfig { for _, config := range configs { - if f.Name == config.Name { + if f.Name == config.Path { return config } } diff --git a/pkg/commands/oscommands/cmd_obj.go b/pkg/commands/oscommands/cmd_obj.go new file mode 100644 index 000000000..592a4a61d --- /dev/null +++ b/pkg/commands/oscommands/cmd_obj.go @@ -0,0 +1,33 @@ +package oscommands + +import ( + "os/exec" +) + +// A command object is a general way to represent a command to be run on the +// command line. If you want to log the command you'll use .ToString() and +// if you want to run it you'll use .GetCmd() +type ICmdObj interface { + GetCmd() *exec.Cmd + ToString() string + AddEnvVars(...string) ICmdObj +} + +type CmdObj struct { + cmdStr string + cmd *exec.Cmd +} + +func (self *CmdObj) GetCmd() *exec.Cmd { + return self.cmd +} + +func (self *CmdObj) ToString() string { + return self.cmdStr +} + +func (self *CmdObj) AddEnvVars(vars ...string) ICmdObj { + self.cmd.Env = append(self.cmd.Env, vars...) + + return self +} diff --git a/pkg/commands/oscommands/exec_live_default.go b/pkg/commands/oscommands/exec_live_default.go index 124792840..95d5d09fb 100644 --- a/pkg/commands/oscommands/exec_live_default.go +++ b/pkg/commands/oscommands/exec_live_default.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package oscommands @@ -18,11 +19,10 @@ import ( // Output is a function that executes by every word that gets read by bufio // As return of output you need to give a string that will be written to stdin // NOTE: If the return data is empty it won't written anything to stdin -func RunCommandWithOutputLiveWrapper(c *OSCommand, command string, output func(string) string) error { - c.Log.WithField("command", command).Info("RunCommand") - c.LogCommand(command, true) - cmd := c.ExecutableFromString(command) - cmd.Env = append(cmd.Env, "LANG=en_US.UTF-8", "LC_ALL=en_US.UTF-8") +func RunCommandWithOutputLiveWrapper(c *OSCommand, cmdObj ICmdObj, output func(string) string) error { + c.Log.WithField("command", cmdObj.ToString()).Info("RunCommand") + c.LogCommand(cmdObj.ToString(), true) + cmd := cmdObj.AddEnvVars("LANG=en_US.UTF-8", "LC_ALL=en_US.UTF-8").GetCmd() var stderr bytes.Buffer cmd.Stderr = &stderr diff --git a/pkg/commands/oscommands/exec_live_win.go b/pkg/commands/oscommands/exec_live_win.go index 1f5a4df52..aa17242e3 100644 --- a/pkg/commands/oscommands/exec_live_win.go +++ b/pkg/commands/oscommands/exec_live_win.go @@ -1,9 +1,10 @@ +//go:build windows // +build windows package oscommands // RunCommandWithOutputLiveWrapper runs a command live but because of windows compatibility this command can't be ran there // TODO: Remove this hack and replace it with a proper way to run commands live on windows -func RunCommandWithOutputLiveWrapper(c *OSCommand, command string, output func(string) string) error { - return c.RunCommand(command) +func RunCommandWithOutputLiveWrapper(c *OSCommand, cmdObj ICmdObj, output func(string) string) error { + return c.RunCommand(cmdObj.ToString()) } diff --git a/pkg/commands/oscommands/os.go b/pkg/commands/oscommands/os.go index cf050cf53..f0c9525a5 100644 --- a/pkg/commands/oscommands/os.go +++ b/pkg/commands/oscommands/os.go @@ -24,10 +24,8 @@ import ( // Platform stores the os state type Platform struct { OS string - CatCmd []string Shell string ShellArg string - EscapedQuote string OpenCommand string OpenLinkCommand string } @@ -203,7 +201,14 @@ func (c *OSCommand) ShellCommandFromString(commandStr string) *exec.Cmd { quotedCommand := "" // Windows does not seem to like quotes around the command if c.Platform.OS == "windows" { - quotedCommand = commandStr + quotedCommand = strings.NewReplacer( + "^", "^^", + "&", "^&", + "|", "^|", + "<", "^<", + ">", "^>", + "%", "^%", + ).Replace(commandStr) } else { quotedCommand = c.Quote(commandStr) } @@ -213,28 +218,16 @@ func (c *OSCommand) ShellCommandFromString(commandStr string) *exec.Cmd { } // RunCommandWithOutputLive runs RunCommandWithOutputLiveWrapper -func (c *OSCommand) RunCommandWithOutputLive(command string, output func(string) string) error { - return RunCommandWithOutputLiveWrapper(c, command, output) -} - -func (c *OSCommand) CatFile(filename string) (string, error) { - arr := append(c.Platform.CatCmd, filename) - cmdStr := strings.Join(arr, " ") - c.Log.WithField("command", cmdStr).Info("Cat") - cmd := c.Command(arr[0], arr[1:]...) - output, err := sanitisedCommandOutput(cmd.CombinedOutput()) - if err != nil { - c.Log.WithField("command", cmdStr).Error(output) - } - return output, err +func (c *OSCommand) RunCommandWithOutputLive(cmdObj ICmdObj, output func(string) string) error { + return RunCommandWithOutputLiveWrapper(c, cmdObj, output) } // DetectUnamePass detect a username / password / passphrase question in a command // promptUserForCredential is a function that gets executed when this function detect you need to fillin a password or passphrase // The promptUserForCredential argument will be "username", "password" or "passphrase" and expects the user's password/passphrase or username back -func (c *OSCommand) DetectUnamePass(command string, promptUserForCredential func(string) string) error { +func (c *OSCommand) DetectUnamePass(cmdObj ICmdObj, promptUserForCredential func(string) string) error { ttyText := "" - errMessage := c.RunCommandWithOutputLive(command, func(word string) string { + errMessage := c.RunCommandWithOutputLive(cmdObj, func(word string) string { ttyText = ttyText + " " + word prompts := map[string]string{ @@ -265,7 +258,7 @@ func (c *OSCommand) RunCommand(formatString string, formatArgs ...interface{}) e // RunShellCommand runs shell commands i.e. 'sh -c '. Good for when you // need access to the shell func (c *OSCommand) RunShellCommand(command string) error { - cmd := c.Command(c.Platform.Shell, c.Platform.ShellArg, command) + cmd := c.ShellCommandFromString(command) c.LogExecCmd(cmd) _, err := sanitisedCommandOutput(cmd.CombinedOutput()) @@ -301,17 +294,11 @@ func sanitisedCommandOutput(output []byte, err error) (string, error) { // OpenFile opens a file with the given func (c *OSCommand) OpenFile(filename string) error { commandTemplate := c.Config.GetUserConfig().OS.OpenCommand - quoted := c.Quote(filename) - if c.Platform.OS == "linux" { - // Add extra quoting to avoid issues with shell command string - quoted = c.Quote(quoted) - quoted = quoted[1 : len(quoted)-1] - } templateValues := map[string]string{ - "filename": quoted, + "filename": c.Quote(filename), } command := utils.ResolvePlaceholderString(commandTemplate, templateValues) - err := c.RunCommand(command) + err := c.RunShellCommand(command) return err } @@ -324,7 +311,7 @@ func (c *OSCommand) OpenLink(link string) error { } command := utils.ResolvePlaceholderString(commandTemplate, templateValues) - err := c.RunCommand(command) + err := c.RunShellCommand(command) return err } @@ -346,17 +333,23 @@ func (c *OSCommand) PrepareShellSubProcess(command string) *exec.Cmd { // Quote wraps a message in platform-specific quotation marks func (c *OSCommand) Quote(message string) string { + var quote string if c.Platform.OS == "windows" { - message = strings.Replace(message, `"`, `"'"'"`, -1) - message = strings.Replace(message, `\"`, `\\"`, -1) + quote = `\"` + message = strings.NewReplacer( + `"`, `"'"'"`, + `\"`, `\\"`, + ).Replace(message) } else { - message = strings.Replace(message, `\`, `\\`, -1) - message = strings.Replace(message, `"`, `\"`, -1) - message = strings.Replace(message, "`", "\\`", -1) - message = strings.Replace(message, "$", "\\$", -1) + quote = `"` + message = strings.NewReplacer( + `\`, `\\`, + `"`, `\"`, + `$`, `\$`, + "`", "\\`", + ).Replace(message) } - escapedQuote := c.Platform.EscapedQuote - return escapedQuote + message + escapedQuote + return quote + message + quote } // AppendLineToFile adds a new line in file @@ -559,7 +552,9 @@ func RunLineOutputCmd(cmd *exec.Cmd, onLine func(line string) (bool, error)) err } func (c *OSCommand) CopyToClipboard(str string) error { - c.LogCommand(fmt.Sprintf("Copying '%s' to clipboard", utils.TruncateWithEllipsis(str, 40)), false) + escaped := strings.Replace(str, "\n", "\\n", -1) + truncated := utils.TruncateWithEllipsis(escaped, 40) + c.LogCommand(fmt.Sprintf("Copying '%s' to clipboard", truncated), false) return clipboard.WriteAll(str) } @@ -568,3 +563,30 @@ func (c *OSCommand) RemoveFile(path string) error { return c.removeFile(path) } + +func (c *OSCommand) NewCmdObjFromStr(cmdStr string) ICmdObj { + args := str.ToArgv(cmdStr) + cmd := c.Command(args[0], args[1:]...) + cmd.Env = os.Environ() + + return &CmdObj{ + cmdStr: cmdStr, + cmd: cmd, + } +} + +func (c *OSCommand) NewCmdObjFromArgs(args []string) ICmdObj { + cmd := c.Command(args[0], args[1:]...) + + return &CmdObj{ + cmdStr: strings.Join(args, " "), + cmd: cmd, + } +} + +func (c *OSCommand) NewCmdObj(cmd *exec.Cmd) ICmdObj { + return &CmdObj{ + cmdStr: strings.Join(cmd.Args, " "), + cmd: cmd, + } +} diff --git a/pkg/commands/oscommands/os_default_platform.go b/pkg/commands/oscommands/os_default_platform.go index 3fb579eec..f5b1f4dbc 100644 --- a/pkg/commands/oscommands/os_default_platform.go +++ b/pkg/commands/oscommands/os_default_platform.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package oscommands @@ -9,10 +10,8 @@ import ( func getPlatform() *Platform { return &Platform{ OS: runtime.GOOS, - CatCmd: []string{"cat"}, Shell: "bash", ShellArg: "-c", - EscapedQuote: `"`, OpenCommand: "open {{filename}}", OpenLinkCommand: "open {{link}}", } diff --git a/pkg/commands/oscommands/os_default_test.go b/pkg/commands/oscommands/os_default_test.go new file mode 100644 index 000000000..5e15b1498 --- /dev/null +++ b/pkg/commands/oscommands/os_default_test.go @@ -0,0 +1,138 @@ +//go:build !windows +// +build !windows + +package oscommands + +import ( + "os/exec" + "testing" + + "github.com/jesseduffield/lazygit/pkg/secureexec" + "github.com/stretchr/testify/assert" +) + +// TestOSCommandOpenFileDarwin is a function. +func TestOSCommandOpenFileDarwin(t *testing.T) { + type scenario struct { + filename string + command func(string, ...string) *exec.Cmd + test func(error) + } + + scenarios := []scenario{ + { + "test", + func(name string, arg ...string) *exec.Cmd { + return secureexec.Command("exit", "1") + }, + func(err error) { + assert.Error(t, err) + }, + }, + { + "test", + func(name string, arg ...string) *exec.Cmd { + assert.Equal(t, "bash", name) + assert.Equal(t, []string{"-c", `open "test"`}, arg) + return secureexec.Command("echo") + }, + func(err error) { + assert.NoError(t, err) + }, + }, + { + "filename with spaces", + func(name string, arg ...string) *exec.Cmd { + assert.Equal(t, "bash", name) + assert.Equal(t, []string{"-c", `open "filename with spaces"`}, arg) + return secureexec.Command("echo") + }, + func(err error) { + assert.NoError(t, err) + }, + }, + } + + for _, s := range scenarios { + OSCmd := NewDummyOSCommand() + OSCmd.Platform.OS = "darwin" + OSCmd.Command = s.command + OSCmd.Config.GetUserConfig().OS.OpenCommand = "open {{filename}}" + + s.test(OSCmd.OpenFile(s.filename)) + } +} + +// TestOSCommandOpenFileLinux tests the OpenFile command on Linux +func TestOSCommandOpenFileLinux(t *testing.T) { + type scenario struct { + filename string + command func(string, ...string) *exec.Cmd + test func(error) + } + + scenarios := []scenario{ + { + "test", + func(name string, arg ...string) *exec.Cmd { + return secureexec.Command("exit", "1") + }, + func(err error) { + assert.Error(t, err) + }, + }, + { + "test", + func(name string, arg ...string) *exec.Cmd { + assert.Equal(t, "bash", name) + assert.Equal(t, []string{"-c", `xdg-open "test" > /dev/null`}, arg) + return secureexec.Command("echo") + }, + func(err error) { + assert.NoError(t, err) + }, + }, + { + "filename with spaces", + func(name string, arg ...string) *exec.Cmd { + assert.Equal(t, "bash", name) + assert.Equal(t, []string{"-c", `xdg-open "filename with spaces" > /dev/null`}, arg) + return secureexec.Command("echo") + }, + func(err error) { + assert.NoError(t, err) + }, + }, + { + "let's_test_with_single_quote", + func(name string, arg ...string) *exec.Cmd { + assert.Equal(t, "bash", name) + assert.Equal(t, []string{"-c", `xdg-open "let's_test_with_single_quote" > /dev/null`}, arg) + return secureexec.Command("echo") + }, + func(err error) { + assert.NoError(t, err) + }, + }, + { + "$USER.txt", + func(name string, arg ...string) *exec.Cmd { + assert.Equal(t, "bash", name) + assert.Equal(t, []string{"-c", `xdg-open "\$USER.txt" > /dev/null`}, arg) + return secureexec.Command("echo") + }, + func(err error) { + assert.NoError(t, err) + }, + }, + } + + for _, s := range scenarios { + OSCmd := NewDummyOSCommand() + OSCmd.Command = s.command + OSCmd.Platform.OS = "linux" + OSCmd.Config.GetUserConfig().OS.OpenCommand = `xdg-open {{filename}} > /dev/null` + + s.test(OSCmd.OpenFile(s.filename)) + } +} diff --git a/pkg/commands/oscommands/os_test.go b/pkg/commands/oscommands/os_test.go index 2f015c21c..4dcca3790 100644 --- a/pkg/commands/oscommands/os_test.go +++ b/pkg/commands/oscommands/os_test.go @@ -3,10 +3,8 @@ package oscommands import ( "io/ioutil" "os" - "os/exec" "testing" - "github.com/jesseduffield/lazygit/pkg/secureexec" "github.com/stretchr/testify/assert" ) @@ -59,132 +57,6 @@ func TestOSCommandRunCommand(t *testing.T) { } } -// TestOSCommandOpenFile is a function. -func TestOSCommandOpenFile(t *testing.T) { - type scenario struct { - filename string - command func(string, ...string) *exec.Cmd - test func(error) - } - - scenarios := []scenario{ - { - "test", - func(name string, arg ...string) *exec.Cmd { - return secureexec.Command("exit", "1") - }, - func(err error) { - assert.Error(t, err) - }, - }, - { - "test", - func(name string, arg ...string) *exec.Cmd { - assert.Equal(t, "open", name) - assert.Equal(t, []string{"test"}, arg) - return secureexec.Command("echo") - }, - func(err error) { - assert.NoError(t, err) - }, - }, - { - "filename with spaces", - func(name string, arg ...string) *exec.Cmd { - assert.Equal(t, "open", name) - assert.Equal(t, []string{"filename with spaces"}, arg) - return secureexec.Command("echo") - }, - func(err error) { - assert.NoError(t, err) - }, - }, - } - - for _, s := range scenarios { - OSCmd := NewDummyOSCommand() - OSCmd.Platform.OS = "darwin" - OSCmd.Command = s.command - OSCmd.Config.GetUserConfig().OS.OpenCommand = "open {{filename}}" - - s.test(OSCmd.OpenFile(s.filename)) - } -} - -// TestOSCommandOpenFile tests the OpenFile command on Linux -func TestOSCommandOpenFileLinux(t *testing.T) { - type scenario struct { - filename string - command func(string, ...string) *exec.Cmd - test func(error) - } - - scenarios := []scenario{ - { - "test", - func(name string, arg ...string) *exec.Cmd { - return secureexec.Command("exit", "1") - }, - func(err error) { - assert.Error(t, err) - }, - }, - { - "test", - func(name string, arg ...string) *exec.Cmd { - assert.Equal(t, "sh", name) - assert.Equal(t, []string{"-c", "xdg-open \"test\" > /dev/null"}, arg) - return secureexec.Command("echo") - }, - func(err error) { - assert.NoError(t, err) - }, - }, - { - "filename with spaces", - func(name string, arg ...string) *exec.Cmd { - assert.Equal(t, "sh", name) - assert.Equal(t, []string{"-c", "xdg-open \"filename with spaces\" > /dev/null"}, arg) - return secureexec.Command("echo") - }, - func(err error) { - assert.NoError(t, err) - }, - }, - { - "let's_test_with_single_quote", - func(name string, arg ...string) *exec.Cmd { - assert.Equal(t, "sh", name) - assert.Equal(t, []string{"-c", "xdg-open \"let's_test_with_single_quote\" > /dev/null"}, arg) - return secureexec.Command("echo") - }, - func(err error) { - assert.NoError(t, err) - }, - }, - { - "$USER.txt", - func(name string, arg ...string) *exec.Cmd { - assert.Equal(t, "sh", name) - assert.Equal(t, []string{"-c", "xdg-open \"\\$USER.txt\" > /dev/null"}, arg) - return secureexec.Command("echo") - }, - func(err error) { - assert.NoError(t, err) - }, - }, - } - - for _, s := range scenarios { - OSCmd := NewDummyOSCommand() - OSCmd.Command = s.command - OSCmd.Platform.OS = "linux" - OSCmd.Config.GetUserConfig().OS.OpenCommand = `sh -c "xdg-open {{filename}} > /dev/null"` - - s.test(OSCmd.OpenFile(s.filename)) - } -} - // TestOSCommandQuote is a function. func TestOSCommandQuote(t *testing.T) { osCommand := NewDummyOSCommand() @@ -193,7 +65,7 @@ func TestOSCommandQuote(t *testing.T) { actual := osCommand.Quote("hello `test`") - expected := osCommand.Platform.EscapedQuote + "hello \\`test\\`" + osCommand.Platform.EscapedQuote + expected := "\"hello \\`test\\`\"" assert.EqualValues(t, expected, actual) } @@ -206,7 +78,7 @@ func TestOSCommandQuoteSingleQuote(t *testing.T) { actual := osCommand.Quote("hello 'test'") - expected := osCommand.Platform.EscapedQuote + "hello 'test'" + osCommand.Platform.EscapedQuote + expected := `"hello 'test'"` assert.EqualValues(t, expected, actual) } @@ -219,7 +91,7 @@ func TestOSCommandQuoteDoubleQuote(t *testing.T) { actual := osCommand.Quote(`hello "test"`) - expected := osCommand.Platform.EscapedQuote + `hello \"test\"` + osCommand.Platform.EscapedQuote + expected := `"hello \"test\""` assert.EqualValues(t, expected, actual) } @@ -230,9 +102,9 @@ func TestOSCommandQuoteWindows(t *testing.T) { osCommand.Platform.OS = "windows" - actual := osCommand.Quote(`hello "test"`) + actual := osCommand.Quote(`hello "test" 'test2'`) - expected := osCommand.Platform.EscapedQuote + `hello "'"'"test"'"'"` + osCommand.Platform.EscapedQuote + expected := `\"hello "'"'"test"'"'" 'test2'\"` assert.EqualValues(t, expected, actual) } diff --git a/pkg/commands/oscommands/os_windows.go b/pkg/commands/oscommands/os_windows.go index 206d50433..f3b3b4056 100644 --- a/pkg/commands/oscommands/os_windows.go +++ b/pkg/commands/oscommands/os_windows.go @@ -2,10 +2,8 @@ package oscommands func getPlatform() *Platform { return &Platform{ - OS: "windows", - CatCmd: []string{"cmd", "/c", "type"}, - Shell: "cmd", - ShellArg: "/c", - EscapedQuote: `\"`, + OS: "windows", + Shell: "cmd", + ShellArg: "/c", } } diff --git a/pkg/commands/oscommands/os_windows_test.go b/pkg/commands/oscommands/os_windows_test.go new file mode 100644 index 000000000..720f2705a --- /dev/null +++ b/pkg/commands/oscommands/os_windows_test.go @@ -0,0 +1,86 @@ +//go:build windows +// +build windows + +package oscommands + +import ( + "os/exec" + "testing" + + "github.com/jesseduffield/lazygit/pkg/secureexec" + "github.com/stretchr/testify/assert" +) + +// TestOSCommandOpenFileWindows tests the OpenFile command on Linux +func TestOSCommandOpenFileWindows(t *testing.T) { + type scenario struct { + filename string + command func(string, ...string) *exec.Cmd + test func(error) + } + + scenarios := []scenario{ + { + "test", + func(name string, arg ...string) *exec.Cmd { + return secureexec.Command("exit", "1") + }, + func(err error) { + assert.Error(t, err) + }, + }, + { + "test", + func(name string, arg ...string) *exec.Cmd { + assert.Equal(t, "cmd", name) + assert.Equal(t, []string{"/c", "start", "", "test"}, arg) + return secureexec.Command("echo") + }, + func(err error) { + assert.NoError(t, err) + }, + }, + { + "filename with spaces", + func(name string, arg ...string) *exec.Cmd { + assert.Equal(t, "cmd", name) + assert.Equal(t, []string{"/c", "start", "", "filename with spaces"}, arg) + return secureexec.Command("echo") + }, + func(err error) { + assert.NoError(t, err) + }, + }, + { + "let's_test_with_single_quote", + func(name string, arg ...string) *exec.Cmd { + assert.Equal(t, "cmd", name) + assert.Equal(t, []string{"/c", "start", "", "let's_test_with_single_quote"}, arg) + return secureexec.Command("echo") + }, + func(err error) { + assert.NoError(t, err) + }, + }, + { + "$USER.txt", + func(name string, arg ...string) *exec.Cmd { + assert.Equal(t, "cmd", name) + assert.Equal(t, []string{"/c", "start", "", "$USER.txt"}, arg) + return secureexec.Command("echo") + }, + func(err error) { + assert.NoError(t, err) + }, + }, + } + + for _, s := range scenarios { + OSCmd := NewDummyOSCommand() + OSCmd.Command = s.command + OSCmd.Platform.OS = "windows" + OSCmd.Config.GetUserConfig().OS.OpenCommand = `start "" {{filename}}` + + s.test(OSCmd.OpenFile(s.filename)) + } +} diff --git a/pkg/commands/patch/patch_modifier.go b/pkg/commands/patch/patch_modifier.go index c2bbc60f6..3ab13931b 100644 --- a/pkg/commands/patch/patch_modifier.go +++ b/pkg/commands/patch/patch_modifier.go @@ -138,7 +138,14 @@ func ModifiedPatchForLines(log *logrus.Entry, filename string, diffText string, // I want to know, given a hunk, what line a given index is on func (hunk *PatchHunk) LineNumberOfLine(idx int) int { - lines := hunk.bodyLines[0 : idx-hunk.FirstLineIdx-1] + n := idx - hunk.FirstLineIdx - 1 + if n < 0 { + n = 0 + } else if n >= len(hunk.bodyLines) { + n = len(hunk.bodyLines) - 1 + } + + lines := hunk.bodyLines[0:n] offset := nLinesWithPrefix(lines, []string{"+", " "}) diff --git a/pkg/commands/patch/patch_parser.go b/pkg/commands/patch/patch_parser.go index a5a94964f..1fefe0748 100644 --- a/pkg/commands/patch/patch_parser.go +++ b/pkg/commands/patch/patch_parser.go @@ -4,7 +4,7 @@ import ( "regexp" "strings" - "github.com/fatih/color" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/theme" "github.com/jesseduffield/lazygit/pkg/utils" "github.com/sirupsen/logrus" @@ -95,45 +95,39 @@ func (l *PatchLine) render(selected bool, included bool) string { if l.Kind == HUNK_HEADER { re := regexp.MustCompile("(@@.*?@@)(.*)") match := re.FindStringSubmatch(content) - return coloredString(color.FgCyan, match[1], selected, included) + coloredString(theme.DefaultTextColor, match[2], selected, false) + return coloredString(style.FgCyan, match[1], selected, included) + coloredString(theme.DefaultTextColor, match[2], selected, false) } - var colorAttr color.Attribute + textStyle := theme.DefaultTextColor switch l.Kind { case PATCH_HEADER: - colorAttr = color.Bold + textStyle = textStyle.SetBold() case ADDITION: - colorAttr = color.FgGreen + textStyle = style.FgGreen case DELETION: - colorAttr = color.FgRed + textStyle = style.FgRed case COMMIT_SHA: - colorAttr = color.FgYellow - default: - colorAttr = theme.DefaultTextColor + textStyle = style.FgYellow } - return coloredString(colorAttr, content, selected, included) + return coloredString(textStyle, content, selected, included) } -func coloredString(colorAttr color.Attribute, str string, selected bool, included bool) string { - var cl *color.Color - attributes := []color.Attribute{colorAttr} +func coloredString(textStyle style.TextStyle, str string, selected bool, included bool) string { if selected { - attributes = append(attributes, theme.SelectedRangeBgColor) + textStyle = textStyle.MergeStyle(theme.SelectedRangeBgColor) } - cl = color.New(attributes...) - var clIncluded *color.Color + + firstCharStyle := textStyle if included { - clIncluded = color.New(append(attributes, color.BgGreen)...) - } else { - clIncluded = color.New(attributes...) + firstCharStyle = firstCharStyle.MergeStyle(style.BgGreen) } if len(str) < 2 { - return utils.ColoredStringDirect(str, clIncluded) + return firstCharStyle.Sprint(str) } - return utils.ColoredStringDirect(str[:1], clIncluded) + utils.ColoredStringDirect(str[1:], cl) + return firstCharStyle.Sprint(str[:1]) + textStyle.Sprint(str[1:]) } func parsePatch(patch string) ([]int, []int, []*PatchLine) { @@ -200,6 +194,19 @@ func (p *PatchParser) Render(firstLineIndex int, lastLineIndex int, incLineIndic return result } +// PlainRenderLines returns the non-coloured string of diff part from firstLineIndex to +// lastLineIndex +func (p *PatchParser) PlainRenderLines(firstLineIndex, lastLineIndex int) string { + linesToCopy := p.PatchLines[firstLineIndex : lastLineIndex+1] + + renderedLines := make([]string, len(linesToCopy)) + for index, line := range linesToCopy { + renderedLines[index] = line.Content + } + + return strings.Join(renderedLines, "\n") +} + // GetNextStageableLineIndex takes a line index and returns the line index of the next stageable line // note this will actually include the current index if it is stageable func (p *PatchParser) GetNextStageableLineIndex(currentIndex int) int { diff --git a/pkg/commands/pull_request_default_test.go b/pkg/commands/pull_request_default_test.go new file mode 100644 index 000000000..e1ce61a5a --- /dev/null +++ b/pkg/commands/pull_request_default_test.go @@ -0,0 +1,256 @@ +//go:build !windows +// +build !windows + +package commands + +import ( + "os/exec" + "strings" + "testing" + + "github.com/jesseduffield/lazygit/pkg/commands/git_config" + "github.com/jesseduffield/lazygit/pkg/secureexec" + "github.com/stretchr/testify/assert" +) + +// TestCreatePullRequest is a function. +func TestCreatePullRequest(t *testing.T) { + type scenario struct { + testName string + from string + to string + remoteUrl string + command func(string, ...string) *exec.Cmd + test func(url string, err error) + } + + scenarios := []scenario{ + { + testName: "Opens a link to new pull request on bitbucket", + from: "feature/profile-page", + remoteUrl: "git@bitbucket.org:johndoe/social_network.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@bitbucket.org:johndoe/social_network.git") + } + + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page&t=1"`}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page&t=1", url) + }, + }, + { + testName: "Opens a link to new pull request on bitbucket with http remote url", + from: "feature/events", + remoteUrl: "https://my_username@bitbucket.org/johndoe/social_network.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "https://my_username@bitbucket.org/johndoe/social_network.git") + } + + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/events&t=1"`}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/events&t=1", url) + }, + }, + { + testName: "Opens a link to new pull request on github", + from: "feature/sum-operation", + remoteUrl: "git@github.com:peter/calculator.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@github.com:peter/calculator.git") + } + + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://github.com/peter/calculator/compare/feature/sum-operation?expand=1"`}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://github.com/peter/calculator/compare/feature/sum-operation?expand=1", url) + }, + }, + { + testName: "Opens a link to new pull request on bitbucket with specific target branch", + from: "feature/profile-page/avatar", + to: "feature/profile-page", + remoteUrl: "git@bitbucket.org:johndoe/social_network.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@bitbucket.org:johndoe/social_network.git") + } + + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page/avatar&dest=feature/profile-page&t=1"`}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page/avatar&dest=feature/profile-page&t=1", url) + }, + }, + { + testName: "Opens a link to new pull request on bitbucket with http remote url with specified target branch", + from: "feature/remote-events", + to: "feature/events", + remoteUrl: "https://my_username@bitbucket.org/johndoe/social_network.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "https://my_username@bitbucket.org/johndoe/social_network.git") + } + + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/remote-events&dest=feature/events&t=1"`}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/remote-events&dest=feature/events&t=1", url) + }, + }, + { + testName: "Opens a link to new pull request on github with specific target branch", + from: "feature/sum-operation", + to: "feature/operations", + remoteUrl: "git@github.com:peter/calculator.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@github.com:peter/calculator.git") + } + + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://github.com/peter/calculator/compare/feature/operations...feature/sum-operation?expand=1"`}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://github.com/peter/calculator/compare/feature/operations...feature/sum-operation?expand=1", url) + }, + }, + { + testName: "Opens a link to new pull request on gitlab", + from: "feature/ui", + remoteUrl: "git@gitlab.com:peter/calculator.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") + } + + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/ui"`}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/ui", url) + }, + }, + { + testName: "Opens a link to new pull request on gitlab in nested groups", + from: "feature/ui", + remoteUrl: "git@gitlab.com:peter/public/calculator.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") + } + + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/ui"`}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/ui", url) + }, + }, + { + testName: "Opens a link to new pull request on gitlab with specific target branch", + from: "feature/commit-ui", + to: "epic/ui", + remoteUrl: "git@gitlab.com:peter/calculator.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") + } + + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui&merge_request[target_branch]=epic/ui"`}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui&merge_request[target_branch]=epic/ui", url) + }, + }, + { + testName: "Opens a link to new pull request on gitlab with specific target branch in nested groups", + from: "feature/commit-ui", + to: "epic/ui", + remoteUrl: "git@gitlab.com:peter/public/calculator.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") + } + + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui&merge_request[target_branch]=epic/ui"`}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui&merge_request[target_branch]=epic/ui", url) + }, + }, + { + testName: "Throws an error if git service is unsupported", + from: "feature/divide-operation", + remoteUrl: "git@something.com:peter/calculator.git", + command: func(cmd string, args ...string) *exec.Cmd { + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.Error(t, err) + }, + }, + } + + for _, s := range scenarios { + t.Run(s.testName, func(t *testing.T) { + gitCommand := NewDummyGitCommand() + gitCommand.OSCommand.Command = s.command + gitCommand.OSCommand.Platform.OS = "darwin" + gitCommand.OSCommand.Platform.Shell = "bash" + gitCommand.OSCommand.Platform.ShellArg = "-c" + gitCommand.OSCommand.Config.GetUserConfig().OS.OpenLinkCommand = "open {{link}}" + gitCommand.OSCommand.Config.GetUserConfig().Services = map[string]string{ + // valid configuration for a custom service URL + "git.work.com": "gitlab:code.work.com", + // invalid configurations for a custom service URL + "invalid.work.com": "noservice:invalid.work.com", + "noservice.work.com": "noservice.work.com", + } + gitCommand.GitConfig = git_config.NewFakeGitConfig(map[string]string{"remote.origin.url": s.remoteUrl}) + dummyPullRequest := NewPullRequest(gitCommand) + s.test(dummyPullRequest.Create(s.from, s.to)) + }) + } +} diff --git a/pkg/commands/pull_request_test.go b/pkg/commands/pull_request_test.go index 2af57529f..66fd06716 100644 --- a/pkg/commands/pull_request_test.go +++ b/pkg/commands/pull_request_test.go @@ -1,11 +1,8 @@ package commands import ( - "os/exec" - "strings" "testing" - "github.com/jesseduffield/lazygit/pkg/secureexec" "github.com/stretchr/testify/assert" ) @@ -42,245 +39,3 @@ func TestGetRepoInfoFromURL(t *testing.T) { }) } } - -// TestCreatePullRequest is a function. -func TestCreatePullRequest(t *testing.T) { - type scenario struct { - testName string - from string - to string - remoteUrl string - command func(string, ...string) *exec.Cmd - test func(url string, err error) - } - - scenarios := []scenario{ - { - testName: "Opens a link to new pull request on bitbucket", - from: "feature/profile-page", - remoteUrl: "git@bitbucket.org:johndoe/social_network.git", - command: func(cmd string, args ...string) *exec.Cmd { - // Handle git remote url call - if strings.HasPrefix(cmd, "git") { - return secureexec.Command("echo", "git@bitbucket.org:johndoe/social_network.git") - } - - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page&t=1"}) - return secureexec.Command("echo") - }, - test: func(url string, err error) { - assert.NoError(t, err) - assert.Equal(t, "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page&t=1", url) - }, - }, - { - testName: "Opens a link to new pull request on bitbucket with http remote url", - from: "feature/events", - remoteUrl: "https://my_username@bitbucket.org/johndoe/social_network.git", - command: func(cmd string, args ...string) *exec.Cmd { - // Handle git remote url call - if strings.HasPrefix(cmd, "git") { - return secureexec.Command("echo", "https://my_username@bitbucket.org/johndoe/social_network.git") - } - - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/events&t=1"}) - return secureexec.Command("echo") - }, - test: func(url string, err error) { - assert.NoError(t, err) - assert.Equal(t, "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/events&t=1", url) - }, - }, - { - testName: "Opens a link to new pull request on github", - from: "feature/sum-operation", - remoteUrl: "git@github.com:peter/calculator.git", - command: func(cmd string, args ...string) *exec.Cmd { - // Handle git remote url call - if strings.HasPrefix(cmd, "git") { - return secureexec.Command("echo", "git@github.com:peter/calculator.git") - } - - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://github.com/peter/calculator/compare/feature/sum-operation?expand=1"}) - return secureexec.Command("echo") - }, - test: func(url string, err error) { - assert.NoError(t, err) - assert.Equal(t, "https://github.com/peter/calculator/compare/feature/sum-operation?expand=1", url) - }, - }, - { - testName: "Opens a link to new pull request on bitbucket with specific target branch", - from: "feature/profile-page/avatar", - to: "feature/profile-page", - remoteUrl: "git@bitbucket.org:johndoe/social_network.git", - command: func(cmd string, args ...string) *exec.Cmd { - // Handle git remote url call - if strings.HasPrefix(cmd, "git") { - return secureexec.Command("echo", "git@bitbucket.org:johndoe/social_network.git") - } - - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page/avatar&dest=feature/profile-page&t=1"}) - return secureexec.Command("echo") - }, - test: func(url string, err error) { - assert.NoError(t, err) - assert.Equal(t, "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page/avatar&dest=feature/profile-page&t=1", url) - }, - }, - { - testName: "Opens a link to new pull request on bitbucket with http remote url with specified target branch", - from: "feature/remote-events", - to: "feature/events", - remoteUrl: "https://my_username@bitbucket.org/johndoe/social_network.git", - command: func(cmd string, args ...string) *exec.Cmd { - // Handle git remote url call - if strings.HasPrefix(cmd, "git") { - return secureexec.Command("echo", "https://my_username@bitbucket.org/johndoe/social_network.git") - } - - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/remote-events&dest=feature/events&t=1"}) - return secureexec.Command("echo") - }, - test: func(url string, err error) { - assert.NoError(t, err) - assert.Equal(t, "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/remote-events&dest=feature/events&t=1", url) - }, - }, - { - testName: "Opens a link to new pull request on github with specific target branch", - from: "feature/sum-operation", - to: "feature/operations", - remoteUrl: "git@github.com:peter/calculator.git", - command: func(cmd string, args ...string) *exec.Cmd { - // Handle git remote url call - if strings.HasPrefix(cmd, "git") { - return secureexec.Command("echo", "git@github.com:peter/calculator.git") - } - - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://github.com/peter/calculator/compare/feature/operations...feature/sum-operation?expand=1"}) - return secureexec.Command("echo") - }, - test: func(url string, err error) { - assert.NoError(t, err) - assert.Equal(t, "https://github.com/peter/calculator/compare/feature/operations...feature/sum-operation?expand=1", url) - }, - }, - { - testName: "Opens a link to new pull request on gitlab", - from: "feature/ui", - remoteUrl: "git@gitlab.com:peter/calculator.git", - command: func(cmd string, args ...string) *exec.Cmd { - // Handle git remote url call - if strings.HasPrefix(cmd, "git") { - return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") - } - - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/ui"}) - return secureexec.Command("echo") - }, - test: func(url string, err error) { - assert.NoError(t, err) - assert.Equal(t, "https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/ui", url) - }, - }, - { - testName: "Opens a link to new pull request on gitlab in nested groups", - from: "feature/ui", - remoteUrl: "git@gitlab.com:peter/public/calculator.git", - command: func(cmd string, args ...string) *exec.Cmd { - // Handle git remote url call - if strings.HasPrefix(cmd, "git") { - return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") - } - - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/ui"}) - return secureexec.Command("echo") - }, - test: func(url string, err error) { - assert.NoError(t, err) - assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/ui", url) - }, - }, - { - testName: "Opens a link to new pull request on gitlab with specific target branch", - from: "feature/commit-ui", - to: "epic/ui", - remoteUrl: "git@gitlab.com:peter/calculator.git", - command: func(cmd string, args ...string) *exec.Cmd { - // Handle git remote url call - if strings.HasPrefix(cmd, "git") { - return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") - } - - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui&merge_request[target_branch]=epic/ui"}) - return secureexec.Command("echo") - }, - test: func(url string, err error) { - assert.NoError(t, err) - assert.Equal(t, "https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui&merge_request[target_branch]=epic/ui", url) - }, - }, - { - testName: "Opens a link to new pull request on gitlab with specific target branch in nested groups", - from: "feature/commit-ui", - to: "epic/ui", - remoteUrl: "git@gitlab.com:peter/public/calculator.git", - command: func(cmd string, args ...string) *exec.Cmd { - // Handle git remote url call - if strings.HasPrefix(cmd, "git") { - return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") - } - - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui&merge_request[target_branch]=epic/ui"}) - return secureexec.Command("echo") - }, - test: func(url string, err error) { - assert.NoError(t, err) - assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui&merge_request[target_branch]=epic/ui", url) - }, - }, - { - testName: "Throws an error if git service is unsupported", - from: "feature/divide-operation", - remoteUrl: "git@something.com:peter/calculator.git", - command: func(cmd string, args ...string) *exec.Cmd { - return secureexec.Command("echo") - }, - test: func(url string, err error) { - assert.Error(t, err) - }, - }, - } - - for _, s := range scenarios { - t.Run(s.testName, func(t *testing.T) { - gitCommand := NewDummyGitCommand() - gitCommand.OSCommand.Command = s.command - gitCommand.OSCommand.Config.GetUserConfig().OS.OpenLinkCommand = "open {{link}}" - gitCommand.OSCommand.Config.GetUserConfig().Services = map[string]string{ - // valid configuration for a custom service URL - "git.work.com": "gitlab:code.work.com", - // invalid configurations for a custom service URL - "invalid.work.com": "noservice:invalid.work.com", - "noservice.work.com": "noservice.work.com", - } - gitCommand.getGitConfigValue = func(path string) (string, error) { - assert.Equal(t, path, "remote.origin.url") - return s.remoteUrl, nil - } - dummyPullRequest := NewPullRequest(gitCommand) - s.test(dummyPullRequest.Create(s.from, s.to)) - }) - } -} diff --git a/pkg/commands/pull_request_windows_test.go b/pkg/commands/pull_request_windows_test.go new file mode 100644 index 000000000..73e91f157 --- /dev/null +++ b/pkg/commands/pull_request_windows_test.go @@ -0,0 +1,256 @@ +//go:build windows +// +build windows + +package commands + +import ( + "os/exec" + "strings" + "testing" + + "github.com/jesseduffield/lazygit/pkg/commands/git_config" + "github.com/jesseduffield/lazygit/pkg/secureexec" + "github.com/stretchr/testify/assert" +) + +// TestCreatePullRequestOnWindows is a function. +func TestCreatePullRequestOnWindows(t *testing.T) { + type scenario struct { + testName string + from string + to string + remoteUrl string + command func(string, ...string) *exec.Cmd + test func(url string, err error) + } + + scenarios := []scenario{ + { + testName: "Opens a link to new pull request on bitbucket", + from: "feature/profile-page", + remoteUrl: "git@bitbucket.org:johndoe/social_network.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@bitbucket.org:johndoe/social_network.git") + } + + assert.Equal(t, cmd, "cmd") + assert.Equal(t, args, []string{"/c", "start", "", "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page^&t=1"}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page&t=1", url) + }, + }, + { + testName: "Opens a link to new pull request on bitbucket with http remote url", + from: "feature/events", + remoteUrl: "https://my_username@bitbucket.org/johndoe/social_network.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "https://my_username@bitbucket.org/johndoe/social_network.git") + } + + assert.Equal(t, cmd, "cmd") + assert.Equal(t, args, []string{"/c", "start", "", "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/events^&t=1"}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/events&t=1", url) + }, + }, + { + testName: "Opens a link to new pull request on github", + from: "feature/sum-operation", + remoteUrl: "git@github.com:peter/calculator.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@github.com:peter/calculator.git") + } + + assert.Equal(t, cmd, "cmd") + assert.Equal(t, args, []string{"/c", "start", "", "https://github.com/peter/calculator/compare/feature/sum-operation?expand=1"}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://github.com/peter/calculator/compare/feature/sum-operation?expand=1", url) + }, + }, + { + testName: "Opens a link to new pull request on bitbucket with specific target branch", + from: "feature/profile-page/avatar", + to: "feature/profile-page", + remoteUrl: "git@bitbucket.org:johndoe/social_network.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@bitbucket.org:johndoe/social_network.git") + } + + assert.Equal(t, cmd, "cmd") + assert.Equal(t, args, []string{"/c", "start", "", "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page/avatar^&dest=feature/profile-page^&t=1"}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page/avatar&dest=feature/profile-page&t=1", url) + }, + }, + { + testName: "Opens a link to new pull request on bitbucket with http remote url with specified target branch", + from: "feature/remote-events", + to: "feature/events", + remoteUrl: "https://my_username@bitbucket.org/johndoe/social_network.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "https://my_username@bitbucket.org/johndoe/social_network.git") + } + + assert.Equal(t, cmd, "cmd") + assert.Equal(t, args, []string{"/c", "start", "", "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/remote-events^&dest=feature/events^&t=1"}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/remote-events&dest=feature/events&t=1", url) + }, + }, + { + testName: "Opens a link to new pull request on github with specific target branch", + from: "feature/sum-operation", + to: "feature/operations", + remoteUrl: "git@github.com:peter/calculator.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@github.com:peter/calculator.git") + } + + assert.Equal(t, cmd, "cmd") + assert.Equal(t, args, []string{"/c", "start", "", "https://github.com/peter/calculator/compare/feature/operations...feature/sum-operation?expand=1"}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://github.com/peter/calculator/compare/feature/operations...feature/sum-operation?expand=1", url) + }, + }, + { + testName: "Opens a link to new pull request on gitlab", + from: "feature/ui", + remoteUrl: "git@gitlab.com:peter/calculator.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") + } + + assert.Equal(t, cmd, "cmd") + assert.Equal(t, args, []string{"/c", "start", "", "https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/ui"}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/ui", url) + }, + }, + { + testName: "Opens a link to new pull request on gitlab in nested groups", + from: "feature/ui", + remoteUrl: "git@gitlab.com:peter/public/calculator.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") + } + + assert.Equal(t, cmd, "cmd") + assert.Equal(t, args, []string{"/c", "start", "", "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/ui"}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/ui", url) + }, + }, + { + testName: "Opens a link to new pull request on gitlab with specific target branch", + from: "feature/commit-ui", + to: "epic/ui", + remoteUrl: "git@gitlab.com:peter/calculator.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") + } + + assert.Equal(t, cmd, "cmd") + assert.Equal(t, args, []string{"/c", "start", "", "https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui^&merge_request[target_branch]=epic/ui"}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui&merge_request[target_branch]=epic/ui", url) + }, + }, + { + testName: "Opens a link to new pull request on gitlab with specific target branch in nested groups", + from: "feature/commit-ui", + to: "epic/ui", + remoteUrl: "git@gitlab.com:peter/public/calculator.git", + command: func(cmd string, args ...string) *exec.Cmd { + // Handle git remote url call + if strings.HasPrefix(cmd, "git") { + return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") + } + + assert.Equal(t, cmd, "cmd") + assert.Equal(t, args, []string{"/c", "start", "", "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui^&merge_request[target_branch]=epic/ui"}) + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui&merge_request[target_branch]=epic/ui", url) + }, + }, + { + testName: "Throws an error if git service is unsupported", + from: "feature/divide-operation", + remoteUrl: "git@something.com:peter/calculator.git", + command: func(cmd string, args ...string) *exec.Cmd { + return secureexec.Command("echo") + }, + test: func(url string, err error) { + assert.Error(t, err) + }, + }, + } + + for _, s := range scenarios { + t.Run(s.testName, func(t *testing.T) { + gitCommand := NewDummyGitCommand() + gitCommand.OSCommand.Command = s.command + gitCommand.OSCommand.Platform.OS = "windows" + gitCommand.OSCommand.Platform.Shell = "cmd" + gitCommand.OSCommand.Platform.ShellArg = "/c" + gitCommand.OSCommand.Config.GetUserConfig().OS.OpenLinkCommand = `start "" {{link}}` + gitCommand.OSCommand.Config.GetUserConfig().Services = map[string]string{ + // valid configuration for a custom service URL + "git.work.com": "gitlab:code.work.com", + // invalid configurations for a custom service URL + "invalid.work.com": "noservice:invalid.work.com", + "noservice.work.com": "noservice.work.com", + } + gitCommand.GitConfig = git_config.NewFakeGitConfig(map[string]string{"remote.origin.url": s.remoteUrl}) + dummyPullRequest := NewPullRequest(gitCommand) + s.test(dummyPullRequest.Create(s.from, s.to)) + }) + } +} diff --git a/pkg/commands/remotes.go b/pkg/commands/remotes.go index 1eb24d761..226198e7a 100644 --- a/pkg/commands/remotes.go +++ b/pkg/commands/remotes.go @@ -6,31 +6,32 @@ import ( ) func (c *GitCommand) AddRemote(name string, url string) error { - return c.RunCommand("git remote add %s %s", name, url) + return c.RunCommand("git remote add %s %s", c.OSCommand.Quote(name), c.OSCommand.Quote(url)) } func (c *GitCommand) RemoveRemote(name string) error { - return c.RunCommand("git remote remove %s", name) + return c.RunCommand("git remote remove %s", c.OSCommand.Quote(name)) } func (c *GitCommand) RenameRemote(oldRemoteName string, newRemoteName string) error { - return c.RunCommand("git remote rename %s %s", oldRemoteName, newRemoteName) + return c.RunCommand("git remote rename %s %s", c.OSCommand.Quote(oldRemoteName), c.OSCommand.Quote(newRemoteName)) } func (c *GitCommand) UpdateRemoteUrl(remoteName string, updatedUrl string) error { - return c.RunCommand("git remote set-url %s %s", remoteName, updatedUrl) + return c.RunCommand("git remote set-url %s %s", c.OSCommand.Quote(remoteName), c.OSCommand.Quote(updatedUrl)) } func (c *GitCommand) DeleteRemoteBranch(remoteName string, branchName string, promptUserForCredential func(string) string) error { - command := fmt.Sprintf("git push %s --delete %s", remoteName, branchName) - return c.OSCommand.DetectUnamePass(command, promptUserForCredential) + command := fmt.Sprintf("git push %s --delete %s", c.OSCommand.Quote(remoteName), c.OSCommand.Quote(branchName)) + cmdObj := c.NewCmdObjFromStr(command) + return c.OSCommand.DetectUnamePass(cmdObj, promptUserForCredential) } // CheckRemoteBranchExists Returns remote branch func (c *GitCommand) CheckRemoteBranchExists(branchName string) bool { _, err := c.OSCommand.RunCommandWithOutput( "git show-ref --verify -- refs/remotes/origin/%s", - branchName, + c.OSCommand.Quote(branchName), ) return err == nil @@ -38,7 +39,7 @@ func (c *GitCommand) CheckRemoteBranchExists(branchName string) bool { // GetRemoteURL returns current repo remote url func (c *GitCommand) GetRemoteURL() string { - return c.GetConfigValue("remote.origin.url") + return c.GitConfig.Get("remote.origin.url") } func (c *GitCommand) GetRemoteURLs() (map[string]string, error) { diff --git a/pkg/commands/submodules.go b/pkg/commands/submodules.go index 856bc4cbe..45e830d10 100644 --- a/pkg/commands/submodules.go +++ b/pkg/commands/submodules.go @@ -69,11 +69,11 @@ func (c *GitCommand) SubmoduleStash(submodule *models.SubmoduleConfig) error { return nil } - return c.RunCommand("git -C %s stash --include-untracked", submodule.Path) + return c.RunCommand("git -C %s stash --include-untracked", c.OSCommand.Quote(submodule.Path)) } func (c *GitCommand) SubmoduleReset(submodule *models.SubmoduleConfig) error { - return c.RunCommand("git submodule update --init --force %s", submodule.Path) + return c.RunCommand("git submodule update --init --force -- %s", c.OSCommand.Quote(submodule.Path)) } func (c *GitCommand) SubmoduleUpdateAll() error { @@ -84,13 +84,13 @@ func (c *GitCommand) SubmoduleUpdateAll() error { func (c *GitCommand) SubmoduleDelete(submodule *models.SubmoduleConfig) error { // based on https://gist.github.com/myusuf3/7f645819ded92bda6677 - if err := c.RunCommand("git submodule deinit --force %s", submodule.Path); err != nil { + if err := c.RunCommand("git submodule deinit --force -- %s", c.OSCommand.Quote(submodule.Path)); err != nil { if strings.Contains(err.Error(), "did not match any file(s) known to git") { - if err := c.RunCommand("git config --file .gitmodules --remove-section submodule.%s", submodule.Name); err != nil { + if err := c.RunCommand("git config --file .gitmodules --remove-section submodule.%s", c.OSCommand.Quote(submodule.Name)); err != nil { return err } - if err := c.RunCommand("git config --remove-section submodule.%s", submodule.Name); err != nil { + if err := c.RunCommand("git config --remove-section submodule.%s", c.OSCommand.Quote(submodule.Name)); err != nil { return err } @@ -119,11 +119,11 @@ func (c *GitCommand) SubmoduleAdd(name string, path string, url string) error { func (c *GitCommand) SubmoduleUpdateUrl(name string, path string, newUrl string) error { // the set-url command is only for later git versions so we're doing it manually here - if err := c.RunCommand("git config --file .gitmodules submodule.%s.url %s", name, newUrl); err != nil { + if err := c.RunCommand("git config --file .gitmodules submodule.%s.url %s", c.OSCommand.Quote(name), c.OSCommand.Quote(newUrl)); err != nil { return err } - if err := c.RunCommand("git submodule sync %s", path); err != nil { + if err := c.RunCommand("git submodule sync -- %s", c.OSCommand.Quote(path)); err != nil { return err } @@ -131,11 +131,11 @@ func (c *GitCommand) SubmoduleUpdateUrl(name string, path string, newUrl string) } func (c *GitCommand) SubmoduleInit(path string) error { - return c.RunCommand("git submodule init %s", path) + return c.RunCommand("git submodule init -- %s", c.OSCommand.Quote(path)) } func (c *GitCommand) SubmoduleUpdate(path string) error { - return c.RunCommand("git submodule update --init %s", path) + return c.RunCommand("git submodule update --init -- %s", c.OSCommand.Quote(path)) } func (c *GitCommand) SubmoduleBulkInitCmdStr() string { diff --git a/pkg/commands/sync.go b/pkg/commands/sync.go index e032d0a65..3f94c5f4e 100644 --- a/pkg/commands/sync.go +++ b/pkg/commands/sync.go @@ -2,28 +2,43 @@ package commands import ( "fmt" - "sync" + + "github.com/go-errors/errors" ) // Push pushes to a branch -func (c *GitCommand) Push(branchName string, force bool, upstream string, args string, promptUserForCredential func(string) string) error { - followTagsFlag := "--follow-tags" - if c.GetConfigValue("push.followTags") == "false" { - followTagsFlag = "" +type PushOpts struct { + Force bool + UpstreamRemote string + UpstreamBranch string + SetUpstream bool + PromptUserForCredential func(string) string +} + +func (c *GitCommand) Push(opts PushOpts) error { + cmdStr := "git push" + + if opts.Force { + cmdStr += " --force-with-lease" } - forceFlag := "" - if force { - forceFlag = "--force-with-lease" + if opts.SetUpstream { + cmdStr += " --set-upstream" } - setUpstreamArg := "" - if upstream != "" { - setUpstreamArg = "--set-upstream " + upstream + if opts.UpstreamRemote != "" { + cmdStr += " " + c.OSCommand.Quote(opts.UpstreamRemote) } - cmd := fmt.Sprintf("git push %s %s %s %s", followTagsFlag, forceFlag, setUpstreamArg, args) - return c.OSCommand.DetectUnamePass(cmd, promptUserForCredential) + if opts.UpstreamBranch != "" { + if opts.UpstreamRemote == "" { + return errors.New(c.Tr.MustSpecifyOriginError) + } + cmdStr += " " + c.OSCommand.Quote(opts.UpstreamBranch) + } + + cmdObj := c.NewCmdObjFromStr(cmdStr) + return c.OSCommand.DetectUnamePass(cmdObj, opts.PromptUserForCredential) } type FetchOptions struct { @@ -34,16 +49,17 @@ type FetchOptions struct { // Fetch fetch git repo func (c *GitCommand) Fetch(opts FetchOptions) error { - command := "git fetch" + cmdStr := "git fetch" if opts.RemoteName != "" { - command = fmt.Sprintf("%s %s", command, opts.RemoteName) + cmdStr = fmt.Sprintf("%s %s", cmdStr, c.OSCommand.Quote(opts.RemoteName)) } if opts.BranchName != "" { - command = fmt.Sprintf("%s %s", command, opts.BranchName) + cmdStr = fmt.Sprintf("%s %s", cmdStr, c.OSCommand.Quote(opts.BranchName)) } - return c.OSCommand.DetectUnamePass(command, func(question string) string { + cmdObj := c.NewCmdObjFromStr(cmdStr) + return c.OSCommand.DetectUnamePass(cmdObj, func(question string) string { if opts.PromptUserForCredential != nil { return opts.PromptUserForCredential(question) } @@ -51,41 +67,45 @@ func (c *GitCommand) Fetch(opts FetchOptions) error { }) } +type PullOptions struct { + PromptUserForCredential func(string) string + RemoteName string + BranchName string + FastForwardOnly bool +} + +func (c *GitCommand) Pull(opts PullOptions) error { + if opts.PromptUserForCredential == nil { + return errors.New("PromptUserForCredential is required") + } + + cmdStr := "git pull --no-edit" + + if opts.FastForwardOnly { + cmdStr += " --ff-only" + } + + if opts.RemoteName != "" { + cmdStr = fmt.Sprintf("%s %s", cmdStr, c.OSCommand.Quote(opts.RemoteName)) + } + if opts.BranchName != "" { + cmdStr = fmt.Sprintf("%s %s", cmdStr, c.OSCommand.Quote(opts.BranchName)) + } + + // setting GIT_SEQUENCE_EDITOR to ':' as a way of skipping it, in case the user + // has 'pull.rebase = interactive' configured. + cmdObj := c.NewCmdObjFromStr(cmdStr).AddEnvVars("GIT_SEQUENCE_EDITOR=:") + return c.OSCommand.DetectUnamePass(cmdObj, opts.PromptUserForCredential) +} + func (c *GitCommand) FastForward(branchName string, remoteName string, remoteBranchName string, promptUserForCredential func(string) string) error { - command := fmt.Sprintf("git fetch %s %s:%s", remoteName, remoteBranchName, branchName) - return c.OSCommand.DetectUnamePass(command, promptUserForCredential) + cmdStr := fmt.Sprintf("git fetch %s %s:%s", c.OSCommand.Quote(remoteName), c.OSCommand.Quote(remoteBranchName), c.OSCommand.Quote(branchName)) + cmdObj := c.NewCmdObjFromStr(cmdStr) + return c.OSCommand.DetectUnamePass(cmdObj, promptUserForCredential) } func (c *GitCommand) FetchRemote(remoteName string, promptUserForCredential func(string) string) error { - command := fmt.Sprintf("git fetch %s", remoteName) - return c.OSCommand.DetectUnamePass(command, promptUserForCredential) -} - -func (c *GitCommand) GetPullMode(mode string) string { - if mode != "auto" { - return mode - } - - var isRebase bool - var isFf bool - var wg sync.WaitGroup - - wg.Add(2) - go func() { - isRebase = c.GetConfigValue("pull.rebase") == "true" - wg.Done() - }() - go func() { - isFf = c.GetConfigValue("pull.ff") == "only" - wg.Done() - }() - wg.Wait() - - if isRebase { - return "rebase" - } else if isFf { - return "ff-only" - } else { - return "merge" - } + cmdStr := fmt.Sprintf("git fetch %s", c.OSCommand.Quote(remoteName)) + cmdObj := c.NewCmdObjFromStr(cmdStr) + return c.OSCommand.DetectUnamePass(cmdObj, promptUserForCredential) } diff --git a/pkg/commands/sync_test.go b/pkg/commands/sync_test.go index 9f7ed1b01..924bd56ef 100644 --- a/pkg/commands/sync_test.go +++ b/pkg/commands/sync_test.go @@ -11,213 +11,154 @@ import ( // TestGitCommandPush is a function. func TestGitCommandPush(t *testing.T) { type scenario struct { - testName string - getGitConfigValue func(string) (string, error) - command func(string, ...string) *exec.Cmd - forcePush bool - test func(error) + testName string + command func(string, ...string) *exec.Cmd + opts PushOpts + test func(error) + } + + prompt := func(passOrUname string) string { + return "\n" } scenarios := []scenario{ { - "Push with force disabled, follow-tags on", - func(string) (string, error) { - return "", nil - }, - func(cmd string, args ...string) *exec.Cmd { - assert.EqualValues(t, "git", cmd) - assert.EqualValues(t, []string{"push", "--follow-tags"}, args) - - return secureexec.Command("echo") - }, - false, - func(err error) { - assert.NoError(t, err) - }, - }, - { - "Push with force enabled, follow-tags on", - func(string) (string, error) { - return "", nil - }, - func(cmd string, args ...string) *exec.Cmd { - assert.EqualValues(t, "git", cmd) - assert.EqualValues(t, []string{"push", "--follow-tags", "--force-with-lease"}, args) - - return secureexec.Command("echo") - }, - true, - func(err error) { - assert.NoError(t, err) - }, - }, - { - "Push with force disabled, follow-tags off", - func(string) (string, error) { - return "false", nil - }, + "Push with force disabled", func(cmd string, args ...string) *exec.Cmd { assert.EqualValues(t, "git", cmd) assert.EqualValues(t, []string{"push"}, args) return secureexec.Command("echo") }, - false, + PushOpts{Force: false, PromptUserForCredential: prompt}, func(err error) { assert.NoError(t, err) }, }, { - "Push with an error occurring, follow-tags on", - func(string) (string, error) { - return "", nil - }, + "Push with force enabled", func(cmd string, args ...string) *exec.Cmd { assert.EqualValues(t, "git", cmd) - assert.EqualValues(t, []string{"push", "--follow-tags"}, args) + assert.EqualValues(t, []string{"push", "--force-with-lease"}, args) + + return secureexec.Command("echo") + }, + PushOpts{Force: true, PromptUserForCredential: prompt}, + func(err error) { + assert.NoError(t, err) + }, + }, + { + "Push with an error occurring", + func(cmd string, args ...string) *exec.Cmd { + assert.EqualValues(t, "git", cmd) + assert.EqualValues(t, []string{"push"}, args) return secureexec.Command("test") }, - false, + PushOpts{Force: false, PromptUserForCredential: prompt}, func(err error) { assert.Error(t, err) }, }, + { + "Push with force disabled, upstream supplied", + func(cmd string, args ...string) *exec.Cmd { + assert.EqualValues(t, "git", cmd) + assert.EqualValues(t, []string{"push", "origin", "master"}, args) + + return secureexec.Command("echo") + }, + PushOpts{ + Force: false, + UpstreamRemote: "origin", + UpstreamBranch: "master", + PromptUserForCredential: prompt, + }, + func(err error) { + assert.NoError(t, err) + }, + }, + { + "Push with force disabled, setting upstream", + func(cmd string, args ...string) *exec.Cmd { + assert.EqualValues(t, "git", cmd) + assert.EqualValues(t, []string{"push", "--set-upstream", "origin", "master"}, args) + + return secureexec.Command("echo") + }, + PushOpts{ + Force: false, + UpstreamRemote: "origin", + UpstreamBranch: "master", + PromptUserForCredential: prompt, + SetUpstream: true, + }, + func(err error) { + assert.NoError(t, err) + }, + }, + { + "Push with force enabled, setting upstream", + func(cmd string, args ...string) *exec.Cmd { + assert.EqualValues(t, "git", cmd) + assert.EqualValues(t, []string{"push", "--force-with-lease", "--set-upstream", "origin", "master"}, args) + + return secureexec.Command("echo") + }, + PushOpts{ + Force: true, + UpstreamRemote: "origin", + UpstreamBranch: "master", + PromptUserForCredential: prompt, + SetUpstream: true, + }, + func(err error) { + assert.NoError(t, err) + }, + }, + { + "Push with remote branch but no origin", + func(cmd string, args ...string) *exec.Cmd { + return nil + }, + PushOpts{ + Force: true, + UpstreamRemote: "", + UpstreamBranch: "master", + PromptUserForCredential: prompt, + SetUpstream: true, + }, + func(err error) { + assert.Error(t, err) + assert.EqualValues(t, "Must specify a remote if specifying a branch", err.Error()) + }, + }, + { + "Push with force disabled, upstream supplied", + func(cmd string, args ...string) *exec.Cmd { + assert.EqualValues(t, "git", cmd) + assert.EqualValues(t, []string{"push", "origin", "master"}, args) + + return secureexec.Command("echo") + }, + PushOpts{ + Force: false, + UpstreamRemote: "origin", + UpstreamBranch: "master", + PromptUserForCredential: prompt, + }, + func(err error) { + assert.NoError(t, err) + }, + }, } for _, s := range scenarios { t.Run(s.testName, func(t *testing.T) { gitCmd := NewDummyGitCommand() gitCmd.OSCommand.Command = s.command - gitCmd.getGitConfigValue = s.getGitConfigValue - err := gitCmd.Push("test", s.forcePush, "", "", func(passOrUname string) string { - return "\n" - }) + err := gitCmd.Push(s.opts) s.test(err) }) } } - -type getPullModeScenario struct { - testName string - getGitConfigValueMock func(string) (string, error) - configPullModeValue string - test func(string) -} - -func TestGetPullMode(t *testing.T) { - - scenarios := getPullModeScenarios(t) - - for _, s := range scenarios { - t.Run(s.testName, func(t *testing.T) { - gitCmd := NewDummyGitCommand() - gitCmd.getGitConfigValue = s.getGitConfigValueMock - s.test(gitCmd.GetPullMode(s.configPullModeValue)) - }) - } -} - -func getPullModeScenarios(t *testing.T) []getPullModeScenario { - return []getPullModeScenario{ - { - testName: "Merge is default", - getGitConfigValueMock: func(s string) (string, error) { - return "", nil - }, - configPullModeValue: "auto", - test: func(actual string) { - assert.Equal(t, "merge", actual) - }, - }, { - testName: "Reads rebase when pull.rebase is true", - getGitConfigValueMock: func(s string) (string, error) { - if s == "pull.rebase" { - return "true", nil - } - return "", nil - }, - configPullModeValue: "auto", - test: func(actual string) { - assert.Equal(t, "rebase", actual) - }, - }, { - testName: "Reads ff-only when pull.ff is only", - getGitConfigValueMock: func(s string) (string, error) { - if s == "pull.ff" { - return "only", nil - } - return "", nil - }, - configPullModeValue: "auto", - test: func(actual string) { - assert.Equal(t, "ff-only", actual) - }, - }, { - testName: "Reads rebase when rebase is true and ff is only", - getGitConfigValueMock: func(s string) (string, error) { - if s == "pull.rebase" { - return "true", nil - } - if s == "pull.ff" { - return "only", nil - } - return "", nil - }, - configPullModeValue: "auto", - test: func(actual string) { - assert.Equal(t, "rebase", actual) - }, - }, { - testName: "Reads rebase when pull.rebase is true", - getGitConfigValueMock: func(s string) (string, error) { - if s == "pull.rebase" { - return "true", nil - } - return "", nil - }, - configPullModeValue: "auto", - test: func(actual string) { - assert.Equal(t, "rebase", actual) - }, - }, { - testName: "Reads ff-only when pull.ff is only", - getGitConfigValueMock: func(s string) (string, error) { - if s == "pull.ff" { - return "only", nil - } - return "", nil - }, - configPullModeValue: "auto", - test: func(actual string) { - assert.Equal(t, "ff-only", actual) - }, - }, { - testName: "Respects merge config", - getGitConfigValueMock: func(s string) (string, error) { - return "", nil - }, - configPullModeValue: "merge", - test: func(actual string) { - assert.Equal(t, "merge", actual) - }, - }, { - testName: "Respects rebase config", - getGitConfigValueMock: func(s string) (string, error) { - return "", nil - }, - configPullModeValue: "rebase", - test: func(actual string) { - assert.Equal(t, "rebase", actual) - }, - }, { - testName: "Respects ff-only config", - getGitConfigValueMock: func(s string) (string, error) { - return "", nil - }, - configPullModeValue: "ff-only", - test: func(actual string) { - assert.Equal(t, "ff-only", actual) - }, - }, - } -} diff --git a/pkg/commands/tags.go b/pkg/commands/tags.go index 18c09194c..af40ae603 100644 --- a/pkg/commands/tags.go +++ b/pkg/commands/tags.go @@ -1,16 +1,19 @@ package commands -import "fmt" +import ( + "fmt" +) func (c *GitCommand) CreateLightweightTag(tagName string, commitSha string) error { - return c.RunCommand("git tag %s %s", tagName, commitSha) + return c.RunCommand("git tag -- %s %s", c.OSCommand.Quote(tagName), commitSha) } func (c *GitCommand) DeleteTag(tagName string) error { - return c.RunCommand("git tag -d %s", tagName) + return c.RunCommand("git tag -d %s", c.OSCommand.Quote(tagName)) } func (c *GitCommand) PushTag(remoteName string, tagName string, promptUserForCredential func(string) string) error { - command := fmt.Sprintf("git push %s %s", remoteName, tagName) - return c.OSCommand.DetectUnamePass(command, promptUserForCredential) + cmdStr := fmt.Sprintf("git push %s %s", c.OSCommand.Quote(remoteName), c.OSCommand.Quote(tagName)) + cmdObj := c.NewCmdObjFromStr(cmdStr) + return c.OSCommand.DetectUnamePass(cmdObj, promptUserForCredential) } diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index b6d668439..b1b1acb0c 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -12,17 +12,19 @@ import ( // AppConfig contains the base configuration fields required for lazygit. type AppConfig struct { - Debug bool `long:"debug" env:"DEBUG" default:"false"` - Version string `long:"version" env:"VERSION" default:"unversioned"` - Commit string `long:"commit" env:"COMMIT"` - BuildDate string `long:"build-date" env:"BUILD_DATE"` - Name string `long:"name" env:"NAME" default:"lazygit"` - BuildSource string `long:"build-source" env:"BUILD_SOURCE" default:""` - UserConfig *UserConfig - UserConfigDir string - UserConfigPath string - AppState *AppState - IsNewRepo bool + Debug bool `long:"debug" env:"DEBUG" default:"false"` + Version string `long:"version" env:"VERSION" default:"unversioned"` + Commit string `long:"commit" env:"COMMIT"` + BuildDate string `long:"build-date" env:"BUILD_DATE"` + Name string `long:"name" env:"NAME" default:"lazygit"` + BuildSource string `long:"build-source" env:"BUILD_SOURCE" default:""` + UserConfig *UserConfig + UserConfigPaths []string + DeafultConfFiles bool + UserConfigDir string + TempDir string + AppState *AppState + IsNewRepo bool } // AppConfigurer interface allows individual app config structs to inherit Fields @@ -35,23 +37,35 @@ type AppConfigurer interface { GetName() string GetBuildSource() string GetUserConfig() *UserConfig + GetUserConfigPaths() []string GetUserConfigDir() string - GetUserConfigPath() string + GetTempDir() string GetAppState() *AppState SaveAppState() error SetIsNewRepo(bool) GetIsNewRepo() bool ReloadUserConfig() error + ShowCommandLogOnStartup() bool } // NewAppConfig makes a new app config func NewAppConfig(name, version, commit, date string, buildSource string, debuggingFlag bool) (*AppConfig, error) { configDir, err := findOrCreateConfigDir() - if err != nil { + if err != nil && !os.IsPermission(err) { return nil, err } - userConfig, err := loadUserConfigWithDefaults(configDir) + var userConfigPaths []string + customConfigFiles := os.Getenv("LG_CONFIG_FILE") + if customConfigFiles != "" { + // Load user defined config files + userConfigPaths = strings.Split(customConfigFiles, ",") + } else { + // Load default config files + userConfigPaths = []string{filepath.Join(configDir, ConfigFilename)} + } + + userConfig, err := loadUserConfigWithDefaults(userConfigPaths) if err != nil { return nil, err } @@ -60,28 +74,35 @@ func NewAppConfig(name, version, commit, date string, buildSource string, debugg debuggingFlag = true } + tempDir := filepath.Join(os.TempDir(), "lazygit") + appState, err := loadAppState() if err != nil { return nil, err } appConfig := &AppConfig{ - Name: "lazygit", - Version: version, - Commit: commit, - BuildDate: date, - Debug: debuggingFlag, - BuildSource: buildSource, - UserConfig: userConfig, - UserConfigDir: configDir, - UserConfigPath: filepath.Join(configDir, "config.yml"), - AppState: appState, - IsNewRepo: false, + Name: "lazygit", + Version: version, + Commit: commit, + BuildDate: date, + Debug: debuggingFlag, + BuildSource: buildSource, + UserConfig: userConfig, + UserConfigPaths: userConfigPaths, + UserConfigDir: configDir, + TempDir: tempDir, + AppState: appState, + IsNewRepo: false, } return appConfig, nil } +func isCustomConfigFile(path string) bool { + return path != filepath.Join(ConfigDir(), ConfigFilename) +} + func ConfigDir() string { legacyConfigDirectory := configDirForVendor("jesseduffield") if _, err := os.Stat(legacyConfigDirectory); !os.IsNotExist(err) { @@ -102,43 +123,45 @@ func configDirForVendor(vendor string) string { func findOrCreateConfigDir() (string, error) { folder := ConfigDir() - err := os.MkdirAll(folder, 0755) - if err != nil { - return "", err - } - - return folder, nil + return folder, os.MkdirAll(folder, 0755) } -func loadUserConfigWithDefaults(configDir string) (*UserConfig, error) { - return loadUserConfig(configDir, GetDefaultConfig()) +func loadUserConfigWithDefaults(configFiles []string) (*UserConfig, error) { + return loadUserConfig(configFiles, GetDefaultConfig()) } -func loadUserConfig(configDir string, base *UserConfig) (*UserConfig, error) { - fileName := filepath.Join(configDir, "config.yml") +func loadUserConfig(configFiles []string, base *UserConfig) (*UserConfig, error) { + for _, path := range configFiles { + if _, err := os.Stat(path); err != nil { + if !os.IsNotExist(err) { + return nil, err + } - if _, err := os.Stat(fileName); err != nil { - if os.IsNotExist(err) { - file, err := os.Create(fileName) + // if use has supplied their own custom config file path(s), we assume + // the files have already been created, so we won't go and create them here. + if isCustomConfigFile(path) { + return nil, err + } + + file, err := os.Create(path) if err != nil { - if strings.Contains(err.Error(), "read-only file system") { - return base, nil + if os.IsPermission(err) { + // apparently when people have read-only permissions they prefer us to fail silently + continue } return nil, err } file.Close() - } else { + } + + content, err := ioutil.ReadFile(path) + if err != nil { return nil, err } - } - content, err := ioutil.ReadFile(fileName) - if err != nil { - return nil, err - } - - if err := yaml.Unmarshal(content, base); err != nil { - return nil, err + if err := yaml.Unmarshal(content, base); err != nil { + return nil, err + } } return base, nil @@ -190,22 +213,25 @@ func (c *AppConfig) GetUserConfig() *UserConfig { return c.UserConfig } -// GetUserConfig returns the user config -func (c *AppConfig) GetUserConfigPath() string { - return c.UserConfigPath -} - // GetAppState returns the app state func (c *AppConfig) GetAppState() *AppState { return c.AppState } +func (c *AppConfig) GetUserConfigPaths() []string { + return c.UserConfigPaths +} + func (c *AppConfig) GetUserConfigDir() string { return c.UserConfigDir } +func (c *AppConfig) GetTempDir() string { + return c.TempDir +} + func (c *AppConfig) ReloadUserConfig() error { - userConfig, err := loadUserConfigWithDefaults(c.UserConfigDir) + userConfig, err := loadUserConfigWithDefaults(c.UserConfigPaths) if err != nil { return err } @@ -223,9 +249,11 @@ func configFilePath(filename string) (string, error) { return filepath.Join(folder, filename), nil } -// ConfigFilename returns the filename of the current config file +var ConfigFilename = "config.yml" + +// ConfigFilename returns the filename of the deafult config file func (c *AppConfig) ConfigFilename() string { - return filepath.Join(c.UserConfigDir, "config.yml") + return filepath.Join(c.UserConfigDir, ConfigFilename) } // SaveAppState marshalls the AppState struct and writes it to the disk @@ -240,13 +268,34 @@ func (c *AppConfig) SaveAppState() error { return err } - return ioutil.WriteFile(filepath, marshalledAppState, 0644) + err = ioutil.WriteFile(filepath, marshalledAppState, 0644) + if err != nil && os.IsPermission(err) { + // apparently when people have read-only permissions they prefer us to fail silently + return nil + } + + return err +} + +// originally we could only hide the command log permanently via the config +// but now we do it via state. So we need to still support the config for the +// sake of backwards compatibility +func (c *AppConfig) ShowCommandLogOnStartup() bool { + if !c.UserConfig.Gui.ShowCommandLog { + return false + } + + return !c.AppState.HideCommandLog } // loadAppState loads recorded AppState from file func loadAppState() (*AppState, error) { filepath, err := configFilePath("state.yml") if err != nil { + if os.IsPermission(err) { + // apparently when people have read-only permissions they prefer us to fail silently + return getDefaultAppState(), nil + } return nil, err } @@ -274,6 +323,10 @@ type AppState struct { LastUpdateCheck int64 RecentRepos []string StartupPopupVersion int + + // these are for custom commands typed in directly, not for custom commands in the lazygit config + CustomCommandsHistory []string + HideCommandLog bool } func getDefaultAppState() *AppState { diff --git a/pkg/config/config_default_platform.go b/pkg/config/config_default_platform.go index fabdf8a88..32b1df473 100644 --- a/pkg/config/config_default_platform.go +++ b/pkg/config/config_default_platform.go @@ -1,3 +1,4 @@ +//go:build !windows && !linux // +build !windows,!linux package config @@ -5,8 +6,9 @@ package config // GetPlatformDefaultConfig gets the defaults for the platform func GetPlatformDefaultConfig() OSConfig { return OSConfig{ - EditCommand: ``, - OpenCommand: "open {{filename}}", - OpenLinkCommand: "open {{link}}", + EditCommand: ``, + EditCommandTemplate: `{{editor}} {{filename}}`, + OpenCommand: "open {{filename}}", + OpenLinkCommand: "open {{link}}", } } diff --git a/pkg/config/config_linux.go b/pkg/config/config_linux.go index 8399e0e47..dd5708a53 100644 --- a/pkg/config/config_linux.go +++ b/pkg/config/config_linux.go @@ -3,8 +3,9 @@ package config // GetPlatformDefaultConfig gets the defaults for the platform func GetPlatformDefaultConfig() OSConfig { return OSConfig{ - EditCommand: ``, - OpenCommand: `sh -c "xdg-open {{filename}} >/dev/null"`, - OpenLinkCommand: `sh -c "xdg-open {{link}} >/dev/null"`, + EditCommand: ``, + EditCommandTemplate: `{{editor}} {{filename}}`, + OpenCommand: `xdg-open {{filename}} >/dev/null`, + OpenLinkCommand: `xdg-open {{link}} >/dev/null`, } } diff --git a/pkg/config/config_windows.go b/pkg/config/config_windows.go index f6780eb6b..301eecec1 100644 --- a/pkg/config/config_windows.go +++ b/pkg/config/config_windows.go @@ -3,8 +3,9 @@ package config // GetPlatformDefaultConfig gets the defaults for the platform func GetPlatformDefaultConfig() OSConfig { return OSConfig{ - EditCommand: ``, - OpenCommand: `cmd /c "start "" {{filename}}"`, - OpenLinkCommand: `cmd /c "start "" {{link}}"`, + EditCommand: ``, + EditCommandTemplate: `{{editor}} {{filename}}`, + OpenCommand: `start "" {{filename}}`, + OpenLinkCommand: `start "" {{link}}`, } } diff --git a/pkg/config/dummies.go b/pkg/config/dummies.go index 40548d732..bd973909a 100644 --- a/pkg/config/dummies.go +++ b/pkg/config/dummies.go @@ -14,6 +14,7 @@ func NewDummyAppConfig() *AppConfig { Debug: false, BuildSource: "", UserConfig: GetDefaultConfig(), + AppState: &AppState{}, } _ = yaml.Unmarshal([]byte{}, appConfig.AppState) return appConfig diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index 9ad7578a7..cfb30779f 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -32,6 +32,7 @@ type GuiConfig struct { SidePanelWidth float64 `yaml:"sidePanelWidth"` ExpandFocusedSidePanel bool `yaml:"expandFocusedSidePanel"` MainPanelSplitMode string `yaml:"mainPanelSplitMode"` + Language string `yaml:"language"` Theme ThemeConfig `yaml:"theme"` CommitLength CommitLengthConfig `yaml:"commitLength"` SkipNoStagedFilesWarning bool `yaml:"skipNoStagedFilesWarning"` @@ -43,12 +44,14 @@ type GuiConfig struct { } type ThemeConfig struct { - LightTheme bool `yaml:"lightTheme"` - ActiveBorderColor []string `yaml:"activeBorderColor"` - InactiveBorderColor []string `yaml:"inactiveBorderColor"` - OptionsTextColor []string `yaml:"optionsTextColor"` - SelectedLineBgColor []string `yaml:"selectedLineBgColor"` - SelectedRangeBgColor []string `yaml:"selectedRangeBgColor"` + LightTheme bool `yaml:"lightTheme"` + ActiveBorderColor []string `yaml:"activeBorderColor"` + InactiveBorderColor []string `yaml:"inactiveBorderColor"` + OptionsTextColor []string `yaml:"optionsTextColor"` + SelectedLineBgColor []string `yaml:"selectedLineBgColor"` + SelectedRangeBgColor []string `yaml:"selectedRangeBgColor"` + CherryPickedCommitBgColor []string `yaml:"cherryPickedCommitBgColor"` + CherryPickedCommitFgColor []string `yaml:"cherryPickedCommitFgColor"` } type CommitLengthConfig struct { @@ -58,7 +61,6 @@ type CommitLengthConfig struct { type GitConfig struct { Paging PagingConfig `yaml:"paging"` Merging MergingConfig `yaml:"merging"` - Pull PullConfig `yaml:"pull"` SkipHookPrefix string `yaml:"skipHookPrefix"` AutoFetch bool `yaml:"autoFetch"` BranchLogCmd string `yaml:"branchLogCmd"` @@ -80,10 +82,6 @@ type MergingConfig struct { Args string `yaml:"args"` } -type PullConfig struct { - Mode string `yaml:"mode"` -} - type CommitPrefixConfig struct { Pattern string `yaml:"pattern"` Replace string `yaml:"replace"` @@ -108,65 +106,66 @@ type KeybindingConfig struct { // damn looks like we have some inconsistencies here with -alt and -alt1 type KeybindingUniversalConfig struct { - Quit string `yaml:"quit"` - QuitAlt1 string `yaml:"quit-alt1"` - Return string `yaml:"return"` - QuitWithoutChangingDirectory string `yaml:"quitWithoutChangingDirectory"` - TogglePanel string `yaml:"togglePanel"` - PrevItem string `yaml:"prevItem"` - NextItem string `yaml:"nextItem"` - PrevItemAlt string `yaml:"prevItem-alt"` - NextItemAlt string `yaml:"nextItem-alt"` - PrevPage string `yaml:"prevPage"` - NextPage string `yaml:"nextPage"` - GotoTop string `yaml:"gotoTop"` - GotoBottom string `yaml:"gotoBottom"` - PrevBlock string `yaml:"prevBlock"` - NextBlock string `yaml:"nextBlock"` - PrevBlockAlt string `yaml:"prevBlock-alt"` - NextBlockAlt string `yaml:"nextBlock-alt"` - NextBlockAlt2 string `yaml:"nextBlock-alt2"` - PrevBlockAlt2 string `yaml:"prevBlock-alt2"` - NextMatch string `yaml:"nextMatch"` - PrevMatch string `yaml:"prevMatch"` - StartSearch string `yaml:"startSearch"` - OptionMenu string `yaml:"optionMenu"` - OptionMenuAlt1 string `yaml:"optionMenu-alt1"` - Select string `yaml:"select"` - GoInto string `yaml:"goInto"` - Confirm string `yaml:"confirm"` - ConfirmAlt1 string `yaml:"confirm-alt1"` - Remove string `yaml:"remove"` - New string `yaml:"new"` - Edit string `yaml:"edit"` - OpenFile string `yaml:"openFile"` - ScrollUpMain string `yaml:"scrollUpMain"` - ScrollDownMain string `yaml:"scrollDownMain"` - ScrollUpMainAlt1 string `yaml:"scrollUpMain-alt1"` - ScrollDownMainAlt1 string `yaml:"scrollDownMain-alt1"` - ScrollUpMainAlt2 string `yaml:"scrollUpMain-alt2"` - ScrollDownMainAlt2 string `yaml:"scrollDownMain-alt2"` - ExecuteCustomCommand string `yaml:"executeCustomCommand"` - CreateRebaseOptionsMenu string `yaml:"createRebaseOptionsMenu"` - PushFiles string `yaml:"pushFiles"` - PullFiles string `yaml:"pullFiles"` - Refresh string `yaml:"refresh"` - CreatePatchOptionsMenu string `yaml:"createPatchOptionsMenu"` - NextTab string `yaml:"nextTab"` - PrevTab string `yaml:"prevTab"` - NextScreenMode string `yaml:"nextScreenMode"` - PrevScreenMode string `yaml:"prevScreenMode"` - Undo string `yaml:"undo"` - Redo string `yaml:"redo"` - FilteringMenu string `yaml:"filteringMenu"` - DiffingMenu string `yaml:"diffingMenu"` - DiffingMenuAlt string `yaml:"diffingMenu-alt"` - CopyToClipboard string `yaml:"copyToClipboard"` - OpenRecentRepos string `yaml:"openRecentRepos"` - SubmitEditorText string `yaml:"submitEditorText"` - AppendNewline string `yaml:"appendNewline"` - ExtrasMenu string `yaml:"extrasMenu"` - ToggleWhitespaceInDiffView string `yaml:"toggleWhitespaceInDiffView"` + Quit string `yaml:"quit"` + QuitAlt1 string `yaml:"quit-alt1"` + Return string `yaml:"return"` + QuitWithoutChangingDirectory string `yaml:"quitWithoutChangingDirectory"` + TogglePanel string `yaml:"togglePanel"` + PrevItem string `yaml:"prevItem"` + NextItem string `yaml:"nextItem"` + PrevItemAlt string `yaml:"prevItem-alt"` + NextItemAlt string `yaml:"nextItem-alt"` + PrevPage string `yaml:"prevPage"` + NextPage string `yaml:"nextPage"` + GotoTop string `yaml:"gotoTop"` + GotoBottom string `yaml:"gotoBottom"` + PrevBlock string `yaml:"prevBlock"` + NextBlock string `yaml:"nextBlock"` + PrevBlockAlt string `yaml:"prevBlock-alt"` + NextBlockAlt string `yaml:"nextBlock-alt"` + NextBlockAlt2 string `yaml:"nextBlock-alt2"` + PrevBlockAlt2 string `yaml:"prevBlock-alt2"` + JumpToBlock []string `yaml:"jumpToBlock"` + NextMatch string `yaml:"nextMatch"` + PrevMatch string `yaml:"prevMatch"` + StartSearch string `yaml:"startSearch"` + OptionMenu string `yaml:"optionMenu"` + OptionMenuAlt1 string `yaml:"optionMenu-alt1"` + Select string `yaml:"select"` + GoInto string `yaml:"goInto"` + Confirm string `yaml:"confirm"` + ConfirmAlt1 string `yaml:"confirm-alt1"` + Remove string `yaml:"remove"` + New string `yaml:"new"` + Edit string `yaml:"edit"` + OpenFile string `yaml:"openFile"` + ScrollUpMain string `yaml:"scrollUpMain"` + ScrollDownMain string `yaml:"scrollDownMain"` + ScrollUpMainAlt1 string `yaml:"scrollUpMain-alt1"` + ScrollDownMainAlt1 string `yaml:"scrollDownMain-alt1"` + ScrollUpMainAlt2 string `yaml:"scrollUpMain-alt2"` + ScrollDownMainAlt2 string `yaml:"scrollDownMain-alt2"` + ExecuteCustomCommand string `yaml:"executeCustomCommand"` + CreateRebaseOptionsMenu string `yaml:"createRebaseOptionsMenu"` + PushFiles string `yaml:"pushFiles"` + PullFiles string `yaml:"pullFiles"` + Refresh string `yaml:"refresh"` + CreatePatchOptionsMenu string `yaml:"createPatchOptionsMenu"` + NextTab string `yaml:"nextTab"` + PrevTab string `yaml:"prevTab"` + NextScreenMode string `yaml:"nextScreenMode"` + PrevScreenMode string `yaml:"prevScreenMode"` + Undo string `yaml:"undo"` + Redo string `yaml:"redo"` + FilteringMenu string `yaml:"filteringMenu"` + DiffingMenu string `yaml:"diffingMenu"` + DiffingMenuAlt string `yaml:"diffingMenu-alt"` + CopyToClipboard string `yaml:"copyToClipboard"` + OpenRecentRepos string `yaml:"openRecentRepos"` + SubmitEditorText string `yaml:"submitEditorText"` + AppendNewline string `yaml:"appendNewline"` + ExtrasMenu string `yaml:"extrasMenu"` + ToggleWhitespaceInDiffView string `yaml:"toggleWhitespaceInDiffView"` } type KeybindingStatusConfig struct { @@ -189,6 +188,7 @@ type KeybindingFilesConfig struct { Fetch string `yaml:"fetch"` ToggleTreeView string `yaml:"toggleTreeView"` OpenMergeTool string `yaml:"openMergeTool"` + OpenStatusFilter string `yaml:"openStatusFilter"` } type KeybindingBranchesConfig struct { @@ -255,6 +255,9 @@ type OSConfig struct { // EditCommand is the command for editing a file EditCommand string `yaml:"editCommand,omitempty"` + // EditCommandTemplate is the command template for editing a file + EditCommandTemplate string `yaml:"editCommandTemplate,omitempty"` + // OpenCommand is the command for opening a file OpenCommand string `yaml:"openCommand,omitempty"` @@ -283,9 +286,10 @@ type CustomCommandPrompt struct { Options []CustomCommandMenuOption // this only applies to menuFromCommand - Command string `yaml:"command"` - Filter string `yaml:"filter"` - Format string `yaml:"format"` + Command string `yaml:"command"` + Filter string `yaml:"filter"` + ValueFormat string `yaml:"valueFormat"` + LabelFormat string `yaml:"labelFormat"` } type CustomCommandMenuOption struct { @@ -305,19 +309,22 @@ func GetDefaultConfig() *UserConfig { SidePanelWidth: 0.3333, ExpandFocusedSidePanel: false, MainPanelSplitMode: "flexible", + Language: "auto", Theme: ThemeConfig{ - LightTheme: false, - ActiveBorderColor: []string{"green", "bold"}, - InactiveBorderColor: []string{"white"}, - OptionsTextColor: []string{"blue"}, - SelectedLineBgColor: []string{"default"}, - SelectedRangeBgColor: []string{"blue"}, + LightTheme: false, + ActiveBorderColor: []string{"green", "bold"}, + InactiveBorderColor: []string{"white"}, + OptionsTextColor: []string{"blue"}, + SelectedLineBgColor: []string{"default"}, + SelectedRangeBgColor: []string{"blue"}, + CherryPickedCommitBgColor: []string{"blue"}, + CherryPickedCommitFgColor: []string{"cyan"}, }, CommitLength: CommitLengthConfig{Show: true}, SkipNoStagedFilesWarning: false, ShowListFooter: true, ShowCommandLog: true, - ShowFileTree: false, + ShowFileTree: true, ShowRandomTip: true, CommandLogSize: 8, }, @@ -330,9 +337,6 @@ func GetDefaultConfig() *UserConfig { ManualCommit: false, Args: "", }, - Pull: PullConfig{ - Mode: "auto", - }, SkipHookPrefix: "WIP", AutoFetch: true, BranchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --", @@ -374,6 +378,7 @@ func GetDefaultConfig() *UserConfig { NextBlockAlt: "l", PrevBlockAlt2: "", NextBlockAlt2: "", + JumpToBlock: []string{"1", "2", "3", "4", "5"}, NextMatch: "n", PrevMatch: "N", StartSearch: "/", @@ -434,6 +439,7 @@ func GetDefaultConfig() *UserConfig { Fetch: "f", ToggleTreeView: "`", OpenMergeTool: "M", + OpenStatusFilter: "", }, Branches: KeybindingBranchesConfig{ CopyPullRequestURL: "", diff --git a/pkg/gui/arrangement.go b/pkg/gui/arrangement.go index b865850d3..db1c3c172 100644 --- a/pkg/gui/arrangement.go +++ b/pkg/gui/arrangement.go @@ -210,7 +210,7 @@ func (gui *Gui) getWindowDimensions(informationStr string, appStatus string) map // The stash window by default only contains one line so that it's not hogging // too much space, but if you access it it should take up some space. This is -// the default behaviour when accordian mode is NOT in effect. If it is in effect +// the default behaviour when accordion mode is NOT in effect. If it is in effect // then when it's accessed it will have weight 2, not 1. func (gui *Gui) getDefaultStashWindowBox() *boxlayout.Box { gui.State.ContextManager.RLock() @@ -259,9 +259,9 @@ func (gui *Gui) sidePanelChildren(width int, height int) []*boxlayout.Box { fullHeightBox("stash"), } } else if height >= 28 { - accordianMode := gui.Config.GetUserConfig().Gui.ExpandFocusedSidePanel - accordianBox := func(defaultBox *boxlayout.Box) *boxlayout.Box { - if accordianMode && defaultBox.Window == currentWindow { + accordionMode := gui.Config.GetUserConfig().Gui.ExpandFocusedSidePanel + accordionBox := func(defaultBox *boxlayout.Box) *boxlayout.Box { + if accordionMode && defaultBox.Window == currentWindow { return &boxlayout.Box{ Window: defaultBox.Window, Weight: 2, @@ -276,10 +276,10 @@ func (gui *Gui) sidePanelChildren(width int, height int) []*boxlayout.Box { Window: "status", Size: 3, }, - accordianBox(&boxlayout.Box{Window: "files", Weight: 1}), - accordianBox(&boxlayout.Box{Window: "branches", Weight: 1}), - accordianBox(&boxlayout.Box{Window: "commits", Weight: 1}), - accordianBox(gui.getDefaultStashWindowBox()), + accordionBox(&boxlayout.Box{Window: "files", Weight: 1}), + accordionBox(&boxlayout.Box{Window: "branches", Weight: 1}), + accordionBox(&boxlayout.Box{Window: "commits", Weight: 1}), + accordionBox(gui.getDefaultStashWindowBox()), } } else { squashedHeight := 1 diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 18227992a..ba512c423 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -7,8 +7,6 @@ import ( "github.com/jesseduffield/lazygit/pkg/commands" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" - "github.com/jesseduffield/lazygit/pkg/gui/presentation" - "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/jesseduffield/lazygit/pkg/utils" ) @@ -230,7 +228,7 @@ func (gui *Gui) handleCheckoutRef(ref string, options handleCheckoutRefOptions) func (gui *Gui) handleCheckoutByName() error { return gui.prompt(promptOpts{ title: gui.Tr.BranchName + ":", - findSuggestionsFunc: gui.findBranchNameSuggestions, + findSuggestionsFunc: gui.getRefsSuggestionsFunc(), handleConfirm: func(response string) error { return gui.handleCheckoutRef(response, handleCheckoutRefOptions{ span: "Checkout branch", @@ -308,7 +306,7 @@ func (gui *Gui) deleteNamedBranch(selectedBranch *models.Branch, force bool) err handleConfirm: func() error { if err := gui.GitCommand.WithSpan(gui.Tr.Spans.DeleteBranch).DeleteBranch(selectedBranch.Name, force); err != nil { errMessage := err.Error() - if !force && strings.Contains(errMessage, "is not fully merged") { + if !force && strings.Contains(errMessage, "git branch -D ") { return gui.deleteNamedBranch(selectedBranch, true) } return gui.createErrorPanel(errMessage) @@ -424,7 +422,7 @@ func (gui *Gui) handleFastForward() error { _ = gui.createLoaderPanel(message) if gui.State.Panels.Branches.SelectedLineIdx == 0 { - _ = gui.pullWithMode("ff-only", PullFilesOptions{span: span}) + _ = gui.pullWithLock(PullFilesOptions{span: span, FastForwardOnly: true}) } else { err := gui.GitCommand.WithSpan(span).FastForward(branch.Name, remoteName, remoteBranchName, gui.promptUserForCredential) gui.handleCredentialsPopup(err) @@ -545,32 +543,6 @@ func (gui *Gui) handleNewBranchOffCurrentItem() error { }) } -func (gui *Gui) getBranchNames() []string { - result := make([]string, len(gui.State.Branches)) - - for i, branch := range gui.State.Branches { - result[i] = branch.Name - } - - return result -} - -func (gui *Gui) findBranchNameSuggestions(input string) []*types.Suggestion { - branchNames := gui.getBranchNames() - - matchingBranchNames := utils.FuzzySearch(sanitizedBranchName(input), branchNames) - - suggestions := make([]*types.Suggestion, len(matchingBranchNames)) - for i, branchName := range matchingBranchNames { - suggestions[i] = &types.Suggestion{ - Value: branchName, - Label: utils.ColoredString(branchName, presentation.GetBranchColor(branchName)), - } - } - - return suggestions -} - // sanitizedBranchName will remove all spaces in favor of a dash "-" to meet // git's branch naming requirement. func sanitizedBranchName(input string) string { diff --git a/pkg/gui/command_log_panel.go b/pkg/gui/command_log_panel.go index 5cd632c17..261ceda90 100644 --- a/pkg/gui/command_log_panel.go +++ b/pkg/gui/command_log_panel.go @@ -6,11 +6,10 @@ import ( "strings" "time" - "github.com/fatih/color" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" "github.com/jesseduffield/lazygit/pkg/constants" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/theme" - "github.com/jesseduffield/lazygit/pkg/utils" ) func (gui *Gui) GetOnRunCommand() func(entry oscommands.CmdLogEntry) { @@ -25,17 +24,17 @@ func (gui *Gui) GetOnRunCommand() func(entry oscommands.CmdLogEntry) { gui.Views.Extras.Autoscroll = true if entry.GetSpan() != currentSpan { - fmt.Fprint(gui.Views.Extras, "\n"+utils.ColoredString(entry.GetSpan(), color.FgYellow)) + fmt.Fprint(gui.Views.Extras, "\n"+style.FgYellow.Sprint(entry.GetSpan())) currentSpan = entry.GetSpan() } - clrAttr := theme.DefaultTextColor + textStyle := theme.DefaultTextColor if !entry.GetCommandLine() { - clrAttr = color.FgMagenta + textStyle = style.FgMagenta } gui.CmdLog = append(gui.CmdLog, entry.GetCmdStr()) indentedCmdStr := " " + strings.Replace(entry.GetCmdStr(), "\n", "\n ", -1) - fmt.Fprint(gui.Views.Extras, "\n"+utils.ColoredString(indentedCmdStr, clrAttr)) + fmt.Fprint(gui.Views.Extras, "\n"+textStyle.Sprint(indentedCmdStr)) } } @@ -44,14 +43,14 @@ func (gui *Gui) printCommandLogHeader() { gui.Tr.CommandLogHeader, gui.getKeyDisplay(gui.Config.GetUserConfig().Keybinding.Universal.ExtrasMenu), ) - fmt.Fprintln(gui.Views.Extras, utils.ColoredString(introStr, color.FgCyan)) + fmt.Fprintln(gui.Views.Extras, style.FgCyan.Sprint(introStr)) if gui.Config.GetUserConfig().Gui.ShowRandomTip { fmt.Fprintf( gui.Views.Extras, "%s: %s", - utils.ColoredString(gui.Tr.RandomTip, color.FgYellow), - utils.ColoredString(gui.getRandomTip(), color.FgGreen), + style.FgYellow.Sprint(gui.Tr.RandomTip), + style.FgGreen.Sprint(gui.getRandomTip()), ) } } @@ -174,7 +173,7 @@ func (gui *Gui) getRandomTip() string { constants.Links.Docs.CustomCommands, ), fmt.Sprintf( - "If you ever find a bug, do not hesistate to raise an issue on the repo:\n%s", + "If you ever find a bug, do not hesitate to raise an issue on the repo:\n%s", constants.Links.Issues, ), } diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go index 4c131db20..7ed9669ab 100644 --- a/pkg/gui/commit_message_panel.go +++ b/pkg/gui/commit_message_panel.go @@ -10,7 +10,7 @@ import ( ) func (gui *Gui) handleCommitConfirm() error { - message := gui.trimmedContent(gui.Views.CommitMessage) + message := strings.TrimSpace(gui.Views.CommitMessage.TextArea.GetContent()) if message == "" { return gui.createErrorPanel(gui.Tr.CommitWithoutMessageErr) } @@ -23,8 +23,8 @@ func (gui *Gui) handleCommitConfirm() error { cmdStr := gui.GitCommand.CommitCmdStr(message, flags) gui.OnRunCommand(oscommands.NewCmdLogEntry(cmdStr, gui.Tr.Spans.Commit, true)) return gui.withGpgHandling(cmdStr, gui.Tr.CommittingStatus, func() error { + gui.Views.CommitMessage.ClearTextArea() _ = gui.returnFromContext() - gui.clearEditorView(gui.Views.CommitMessage) return nil }) } @@ -48,7 +48,7 @@ func (gui *Gui) handleCommitMessageFocused() error { } func (gui *Gui) getBufferLength(view *gocui.View) string { - return " " + strconv.Itoa(strings.Count(view.Buffer(), "")-1) + " " + return " " + strconv.Itoa(strings.Count(view.TextArea.GetContent(), "")-1) + " " } // RenderCommitLength is a function. diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index f04cd43b3..e1b78bc3a 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -1,16 +1,13 @@ // lots of this has been directly ported from one of the example files, will brush up later -// Copyright 2014 The gocui Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - package gui import ( + "fmt" "strings" - "github.com/fatih/color" "github.com/jesseduffield/gocui" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/jesseduffield/lazygit/pkg/theme" "github.com/jesseduffield/lazygit/pkg/utils" @@ -37,7 +34,6 @@ type askOpts struct { handleConfirm func() error handleClose func() error handlersManageFocus bool - findSuggestionsFunc func(string) []*types.Suggestion } type promptOpts struct { @@ -54,7 +50,6 @@ func (gui *Gui) ask(opts askOpts) error { handleConfirm: opts.handleConfirm, handleClose: opts.handleClose, handlersManageFocus: opts.handlersManageFocus, - findSuggestionsFunc: opts.findSuggestionsFunc, }) } @@ -107,13 +102,6 @@ func (gui *Gui) wrappedPromptConfirmationFunction(handlersManageFocus bool, func } } -func (gui *Gui) clearConfirmationViewKeyBindings() { - keybindingConfig := gui.Config.GetUserConfig().Keybinding - _ = gui.g.DeleteKeybinding("confirmation", gui.getKey(keybindingConfig.Universal.Confirm), gocui.ModNone) - _ = gui.g.DeleteKeybinding("confirmation", gui.getKey(keybindingConfig.Universal.ConfirmAlt1), gocui.ModNone) - _ = gui.g.DeleteKeybinding("confirmation", gui.getKey(keybindingConfig.Universal.Return), gocui.ModNone) -} - func (gui *Gui) closeConfirmationPrompt(handlersManageFocus bool) error { // we've already closed it so we can just return if !gui.Views.Confirmation.Visible { @@ -169,7 +157,13 @@ func (gui *Gui) getConfirmationPanelDimensions(wrap bool, prompt string) (int, i height/2 + panelHeight/2 } -func (gui *Gui) prepareConfirmationPanel(title, prompt string, hasLoader bool, findSuggestionsFunc func(string) []*types.Suggestion) error { +func (gui *Gui) prepareConfirmationPanel( + title, + prompt string, + hasLoader bool, + findSuggestionsFunc func(string) []*types.Suggestion, + editable bool, +) error { x0, y0, x1, y1 := gui.getConfirmationPanelDimensions(true, prompt) // calling SetView on an existing view returns the same view, so I'm not bothering // to reassign to gui.Views.Confirmation @@ -182,20 +176,22 @@ func (gui *Gui) prepareConfirmationPanel(title, prompt string, hasLoader bool, f gui.g.StartTicking() } gui.Views.Confirmation.Title = title - gui.Views.Confirmation.Wrap = true + // for now we do not support wrapping in our editor + gui.Views.Confirmation.Wrap = !editable gui.Views.Confirmation.FgColor = theme.GocuiDefaultTextColor gui.findSuggestions = findSuggestionsFunc if findSuggestionsFunc != nil { suggestionsViewHeight := 11 - suggestionsView, err := gui.g.SetView("suggestions", x0, y1, x1, y1+suggestionsViewHeight, 0) + suggestionsView, err := gui.g.SetView("suggestions", x0, y1+1, x1, y1+suggestionsViewHeight, 0) if err != nil { return err } - suggestionsView.Wrap = true + suggestionsView.Wrap = false suggestionsView.FgColor = theme.GocuiDefaultTextColor - gui.setSuggestions([]*types.Suggestion{}) + gui.setSuggestions(findSuggestionsFunc("")) suggestionsView.Visible = true + suggestionsView.Title = fmt.Sprintf(gui.Tr.SuggestionsTitle, gui.Config.GetUserConfig().Keybinding.Universal.TogglePanel) } gui.g.Update(func(g *gocui.Gui) error { @@ -209,19 +205,27 @@ func (gui *Gui) createPopupPanel(opts createPopupPanelOpts) error { // remove any previous keybindings gui.clearConfirmationViewKeyBindings() - err := gui.prepareConfirmationPanel(opts.title, opts.prompt, opts.hasLoader, opts.findSuggestionsFunc) + err := gui.prepareConfirmationPanel( + opts.title, + opts.prompt, + opts.hasLoader, + opts.findSuggestionsFunc, + opts.editable, + ) if err != nil { return err } - gui.Views.Confirmation.Editable = opts.editable - gui.Views.Confirmation.Editor = gocui.EditorFunc(gui.defaultEditor) + confirmationView := gui.Views.Confirmation + confirmationView.Editable = opts.editable + confirmationView.Editor = gocui.EditorFunc(gui.defaultEditor) if opts.editable { - if err := gui.Views.Confirmation.SetEditorContent(opts.prompt); err != nil { - return err - } + textArea := confirmationView.TextArea + textArea.Clear() + textArea.TypeString(opts.prompt) + confirmationView.RenderTextArea() } else { - if err := gui.renderStringSync(gui.Views.Confirmation, opts.prompt); err != nil { + if err := gui.renderStringSync(confirmationView, opts.prompt); err != nil { return err } } @@ -243,7 +247,7 @@ func (gui *Gui) setKeyBindings(opts createPopupPanelOpts) error { gui.renderString(gui.Views.Options, actions) var onConfirm func() error if opts.handleConfirmPrompt != nil { - onConfirm = gui.wrappedPromptConfirmationFunction(opts.handlersManageFocus, opts.handleConfirmPrompt, func() string { return gui.Views.Confirmation.Buffer() }) + onConfirm = gui.wrappedPromptConfirmationFunction(opts.handlersManageFocus, opts.handleConfirmPrompt, func() string { return gui.Views.Confirmation.TextArea.GetContent() }) } else { onConfirm = gui.wrappedConfirmationFunction(opts.handlersManageFocus, opts.handleConfirm) } @@ -255,7 +259,11 @@ func (gui *Gui) setKeyBindings(opts createPopupPanelOpts) error { } keybindingConfig := gui.Config.GetUserConfig().Keybinding - onSuggestionConfirm := gui.wrappedPromptConfirmationFunction(opts.handlersManageFocus, opts.handleConfirmPrompt, func() string { return gui.getSelectedSuggestionValue() }) + onSuggestionConfirm := gui.wrappedPromptConfirmationFunction( + opts.handlersManageFocus, + opts.handleConfirmPrompt, + gui.getSelectedSuggestionValue, + ) confirmationKeybindings := []confirmationKeybinding{ { @@ -276,7 +284,12 @@ func (gui *Gui) setKeyBindings(opts createPopupPanelOpts) error { { viewName: "confirmation", key: gui.getKey(keybindingConfig.Universal.TogglePanel), - handler: func() error { return gui.replaceContext(gui.State.Contexts.Suggestions) }, + handler: func() error { + if len(gui.State.Suggestions) > 0 { + return gui.replaceContext(gui.State.Contexts.Suggestions) + } + return nil + }, }, { viewName: "suggestions", @@ -309,6 +322,16 @@ func (gui *Gui) setKeyBindings(opts createPopupPanelOpts) error { return nil } +func (gui *Gui) clearConfirmationViewKeyBindings() { + keybindingConfig := gui.Config.GetUserConfig().Keybinding + _ = gui.g.DeleteKeybinding("confirmation", gui.getKey(keybindingConfig.Universal.Confirm), gocui.ModNone) + _ = gui.g.DeleteKeybinding("confirmation", gui.getKey(keybindingConfig.Universal.ConfirmAlt1), gocui.ModNone) + _ = gui.g.DeleteKeybinding("confirmation", gui.getKey(keybindingConfig.Universal.Return), gocui.ModNone) + _ = gui.g.DeleteKeybinding("suggestions", gui.getKey(keybindingConfig.Universal.Confirm), gocui.ModNone) + _ = gui.g.DeleteKeybinding("suggestions", gui.getKey(keybindingConfig.Universal.ConfirmAlt1), gocui.ModNone) + _ = gui.g.DeleteKeybinding("suggestions", gui.getKey(keybindingConfig.Universal.Return), gocui.ModNone) +} + func (gui *Gui) wrappedHandler(f func() error) func(g *gocui.Gui, v *gocui.View) error { return func(g *gocui.Gui, v *gocui.View) error { return f() @@ -316,8 +339,7 @@ func (gui *Gui) wrappedHandler(f func() error) func(g *gocui.Gui, v *gocui.View) } func (gui *Gui) createErrorPanel(message string) error { - colorFunction := color.New(color.FgRed).SprintFunc() - coloredMessage := colorFunction(strings.TrimSpace(message)) + coloredMessage := style.FgRed.Sprint(strings.TrimSpace(message)) if err := gui.refreshSidePanels(refreshOptions{mode: ASYNC}); err != nil { return err } diff --git a/pkg/gui/context.go b/pkg/gui/context.go index af5fdc71b..a74b12749 100644 --- a/pkg/gui/context.go +++ b/pkg/gui/context.go @@ -128,33 +128,37 @@ func (gui *Gui) pushContextWithView(viewName string) error { func (gui *Gui) returnFromContext() error { gui.g.Update(func(*gocui.Gui) error { - gui.State.ContextManager.Lock() - - if len(gui.State.ContextManager.ContextStack) == 1 { - // cannot escape from bottommost context - gui.State.ContextManager.Unlock() - return nil - } - - n := len(gui.State.ContextManager.ContextStack) - 1 - - currentContext := gui.State.ContextManager.ContextStack[n] - newContext := gui.State.ContextManager.ContextStack[n-1] - - gui.State.ContextManager.ContextStack = gui.State.ContextManager.ContextStack[:n] - - gui.State.ContextManager.Unlock() - - if err := gui.deactivateContext(currentContext); err != nil { - return err - } - - return gui.activateContext(newContext) + return gui.returnFromContextSync() }) return nil } +func (gui *Gui) returnFromContextSync() error { + gui.State.ContextManager.Lock() + + if len(gui.State.ContextManager.ContextStack) == 1 { + // cannot escape from bottommost context + gui.State.ContextManager.Unlock() + return nil + } + + n := len(gui.State.ContextManager.ContextStack) - 1 + + currentContext := gui.State.ContextManager.ContextStack[n] + newContext := gui.State.ContextManager.ContextStack[n-1] + + gui.State.ContextManager.ContextStack = gui.State.ContextManager.ContextStack[:n] + + gui.State.ContextManager.Unlock() + + if err := gui.deactivateContext(currentContext); err != nil { + return err + } + + return gui.activateContext(newContext) +} + func (gui *Gui) deactivateContext(c Context) error { view, _ := gui.g.View(c.GetViewName()) diff --git a/pkg/gui/credentials_panel.go b/pkg/gui/credentials_panel.go index ac162ae02..320f535f5 100644 --- a/pkg/gui/credentials_panel.go +++ b/pkg/gui/credentials_panel.go @@ -41,9 +41,9 @@ func (gui *Gui) promptUserForCredential(passOrUname string) string { func (gui *Gui) handleSubmitCredential() error { credentialsView := gui.Views.Credentials - message := gui.trimmedContent(credentialsView) + message := strings.TrimSpace(credentialsView.TextArea.GetContent()) gui.credentials <- message - gui.clearEditorView(credentialsView) + credentialsView.ClearTextArea() if err := gui.returnFromContext(); err != nil { return err } diff --git a/pkg/gui/custom_commands.go b/pkg/gui/custom_commands.go index 752587e69..8f98d6597 100644 --- a/pkg/gui/custom_commands.go +++ b/pkg/gui/custom_commands.go @@ -9,10 +9,10 @@ import ( "strings" "text/template" - "github.com/fatih/color" "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/config" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/utils" ) @@ -33,6 +33,11 @@ type CustomCommandObjects struct { PromptResponses []string } +type commandMenuEntry struct { + label string + value string +} + func (gui *Gui) resolveTemplate(templateStr string, promptResponses []string) (string, error) { objects := CustomCommandObjects{ SelectedFile: gui.getSelectedFile(), @@ -102,7 +107,7 @@ func (gui *Gui) menuPrompt(prompt config.CustomCommandPrompt, promptResponses [] } menuItems[i] = &menuItem{ - displayStrings: []string{name, utils.ColoredString(description, color.FgYellow)}, + displayStrings: []string{name, style.FgYellow.Sprint(description)}, onPress: func() error { promptResponses[responseIdx] = value return wrappedF() @@ -118,21 +123,32 @@ func (gui *Gui) menuPrompt(prompt config.CustomCommandPrompt, promptResponses [] return gui.createMenu(title, menuItems, createMenuOptions{showCancel: true}) } -func (gui *Gui) GenerateMenuCandidates(commandOutput string, filter string, format string) ([]string, error) { - candidates := []string{} +func (gui *Gui) GenerateMenuCandidates(commandOutput, filter, valueFormat, labelFormat string) ([]commandMenuEntry, error) { reg, err := regexp.Compile(filter) if err != nil { - return candidates, gui.surfaceError(errors.New("unable to parse filter regex, error: " + err.Error())) + return nil, gui.surfaceError(errors.New("unable to parse filter regex, error: " + err.Error())) } + buff := bytes.NewBuffer(nil) - temp, err := template.New("format").Parse(format) + + valueTemp, err := template.New("format").Parse(valueFormat) if err != nil { - return candidates, gui.surfaceError(errors.New("unable to parse format, error: " + err.Error())) + return nil, gui.surfaceError(errors.New("unable to parse value format, error: " + err.Error())) } + + colorFuncMap := style.TemplateFuncMapAddColors(template.FuncMap{}) + + descTemp, err := template.New("format").Funcs(colorFuncMap).Parse(labelFormat) + if err != nil { + return nil, gui.surfaceError(errors.New("unable to parse label format, error: " + err.Error())) + } + + candidates := []commandMenuEntry{} for _, str := range strings.Split(string(commandOutput), "\n") { if str == "" { continue } + tmplData := map[string]string{} out := reg.FindAllStringSubmatch(str, -1) if len(out) > 0 { @@ -146,12 +162,28 @@ func (gui *Gui) GenerateMenuCandidates(commandOutput string, filter string, form } } } - err = temp.Execute(buff, tmplData) + + err = valueTemp.Execute(buff, tmplData) if err != nil { return candidates, gui.surfaceError(err) } + entry := commandMenuEntry{ + value: strings.TrimSpace(buff.String()), + } + + if labelFormat != "" { + buff.Reset() + err = descTemp.Execute(buff, tmplData) + if err != nil { + return candidates, gui.surfaceError(err) + } + entry.label = strings.TrimSpace(buff.String()) + } else { + entry.label = entry.value + } + + candidates = append(candidates, entry) - candidates = append(candidates, strings.TrimSpace(buff.String())) buff.Reset() } return candidates, err @@ -177,7 +209,7 @@ func (gui *Gui) menuPromptFromCommand(prompt config.CustomCommandPrompt, promptR } // Need to make a menu out of what the cmd has displayed - candidates, err := gui.GenerateMenuCandidates(message, filter, prompt.Format) + candidates, err := gui.GenerateMenuCandidates(message, filter, prompt.ValueFormat, prompt.LabelFormat) if err != nil { return gui.surfaceError(err) } @@ -185,9 +217,9 @@ func (gui *Gui) menuPromptFromCommand(prompt config.CustomCommandPrompt, promptR menuItems := make([]*menuItem, len(candidates)) for i := range candidates { menuItems[i] = &menuItem{ - displayStrings: []string{candidates[i]}, + displayStrings: []string{candidates[i].label}, onPress: func() error { - promptResponses[responseIdx] = candidates[i] + promptResponses[responseIdx] = candidates[i].value return wrappedF() }, } diff --git a/pkg/gui/custom_commands_test.go b/pkg/gui/custom_commands_test.go new file mode 100644 index 000000000..d51617c09 --- /dev/null +++ b/pkg/gui/custom_commands_test.go @@ -0,0 +1,63 @@ +package gui + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestGuiGenerateMenuCandidates(t *testing.T) { + type scenario struct { + testName string + cmdOut string + filter string + valueFormat string + labelFormat string + test func([]commandMenuEntry, error) + } + + scenarios := []scenario{ + { + "Extract remote branch name", + "upstream/pr-1", + "(?P[a-z_]+)/(?P.*)", + "{{ .branch }}", + "Remote: {{ .remote }}", + func(actualEntry []commandMenuEntry, err error) { + assert.NoError(t, err) + assert.EqualValues(t, "pr-1", actualEntry[0].value) + assert.EqualValues(t, "Remote: upstream", actualEntry[0].label) + }, + }, + { + "Multiple named groups with empty labelFormat", + "upstream/pr-1", + "(?P[a-z]*)/(?P.*)", + "{{ .branch }}|{{ .remote }}", + "", + func(actualEntry []commandMenuEntry, err error) { + assert.NoError(t, err) + assert.EqualValues(t, "pr-1|upstream", actualEntry[0].value) + assert.EqualValues(t, "pr-1|upstream", actualEntry[0].label) + }, + }, + { + "Multiple named groups with group ids", + "upstream/pr-1", + "(?P[a-z]*)/(?P.*)", + "{{ .group_2 }}|{{ .group_1 }}", + "Remote: {{ .group_1 }}", + func(actualEntry []commandMenuEntry, err error) { + assert.NoError(t, err) + assert.EqualValues(t, "pr-1|upstream", actualEntry[0].value) + assert.EqualValues(t, "Remote: upstream", actualEntry[0].label) + }, + }, + } + + for _, s := range scenarios { + t.Run(s.testName, func(t *testing.T) { + s.test(NewDummyGui().GenerateMenuCandidates(s.cmdOut, s.filter, s.valueFormat, s.labelFormat)) + }) + } +} diff --git a/pkg/gui/diffing.go b/pkg/gui/diffing.go index ef87b40da..e1f3afa88 100644 --- a/pkg/gui/diffing.go +++ b/pkg/gui/diffing.go @@ -125,7 +125,8 @@ func (gui *Gui) handleCreateDiffingMenuPanel() error { displayString: gui.Tr.LcEnterRefToDiff, onPress: func() error { return gui.prompt(promptOpts{ - title: gui.Tr.LcEnteRefName, + title: gui.Tr.LcEnteRefName, + findSuggestionsFunc: gui.getRefsSuggestionsFunc(), handleConfirm: func(response string) error { gui.State.Modes.Diffing.Ref = strings.TrimSpace(response) return gui.refreshSidePanels(refreshOptions{mode: ASYNC}) diff --git a/pkg/gui/dummies.go b/pkg/gui/dummies.go index d8a7cba29..0e37bbbc8 100644 --- a/pkg/gui/dummies.go +++ b/pkg/gui/dummies.go @@ -11,11 +11,13 @@ import ( // NewDummyGui creates a new dummy GUI for testing func NewDummyUpdater() *updates.Updater { - DummyUpdater, _ := updates.NewUpdater(utils.NewDummyLog(), config.NewDummyAppConfig(), oscommands.NewDummyOSCommand(), i18n.NewTranslationSet(utils.NewDummyLog())) + newAppConfig := config.NewDummyAppConfig() + DummyUpdater, _ := updates.NewUpdater(utils.NewDummyLog(), newAppConfig, oscommands.NewDummyOSCommand(), i18n.NewTranslationSet(utils.NewDummyLog(), newAppConfig.GetUserConfig().Gui.Language)) return DummyUpdater } func NewDummyGui() *Gui { - DummyGui, _ := NewGui(utils.NewDummyLog(), commands.NewDummyGitCommand(), oscommands.NewDummyOSCommand(), i18n.NewTranslationSet(utils.NewDummyLog()), config.NewDummyAppConfig(), NewDummyUpdater(), "", false) + newAppConfig := config.NewDummyAppConfig() + DummyGui, _ := NewGui(utils.NewDummyLog(), commands.NewDummyGitCommand(), oscommands.NewDummyOSCommand(), i18n.NewTranslationSet(utils.NewDummyLog(), newAppConfig.GetUserConfig().Gui.Language), newAppConfig, NewDummyUpdater(), "", false) return DummyGui } diff --git a/pkg/gui/editors.go b/pkg/gui/editors.go index 7d3054cd0..430dcfdfe 100644 --- a/pkg/gui/editors.go +++ b/pkg/gui/editors.go @@ -6,90 +6,81 @@ import ( "github.com/jesseduffield/gocui" ) -// we've just copy+pasted the editor from gocui to here so that we can also re- -// render the commit message length on each keypress -func (gui *Gui) commitMessageEditor(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier) bool { +func (gui *Gui) handleEditorKeypress(textArea *gocui.TextArea, key gocui.Key, ch rune, mod gocui.Modifier, allowMultiline bool) bool { newlineKey, ok := gui.getKey(gui.Config.GetUserConfig().Keybinding.Universal.AppendNewline).(gocui.Key) if !ok { newlineKey = gocui.KeyAltEnter } - matched := true switch { case key == gocui.KeyBackspace || key == gocui.KeyBackspace2: - v.EditDelete(true) + textArea.BackSpaceChar() case key == gocui.KeyCtrlD || key == gocui.KeyDelete: - v.EditDelete(false) + textArea.DeleteChar() case key == gocui.KeyArrowDown: - v.MoveCursor(0, 1, false) + textArea.MoveCursorDown() case key == gocui.KeyArrowUp: - v.MoveCursor(0, -1, false) + textArea.MoveCursorUp() case key == gocui.KeyArrowLeft: - v.MoveCursor(-1, 0, false) + textArea.MoveCursorLeft() case key == gocui.KeyArrowRight: - v.MoveCursor(1, 0, false) + textArea.MoveCursorRight() case key == newlineKey: - v.EditNewLine() + if allowMultiline { + textArea.TypeRune('\n') + } else { + return false + } case key == gocui.KeySpace: - v.EditWrite(' ') + textArea.TypeRune(' ') case key == gocui.KeyInsert: - v.Overwrite = !v.Overwrite + textArea.ToggleOverwrite() case key == gocui.KeyCtrlU: - v.EditDeleteToStartOfLine() - case key == gocui.KeyCtrlA: - v.EditGotoToStartOfLine() - case key == gocui.KeyCtrlE: - v.EditGotoToEndOfLine() + textArea.DeleteToStartOfLine() + case key == gocui.KeyCtrlA || key == gocui.KeyHome: + textArea.GoToStartOfLine() + case key == gocui.KeyCtrlE || key == gocui.KeyEnd: + textArea.GoToEndOfLine() // TODO: see if we need all three of these conditions: maybe the final one is sufficient case ch != 0 && mod == 0 && unicode.IsPrint(ch): - v.EditWrite(ch) + textArea.TypeRune(ch) default: - matched = false + return false } + return true +} + +// we've just copy+pasted the editor from gocui to here so that we can also re- +// render the commit message length on each keypress +func (gui *Gui) commitMessageEditor(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier) bool { + matched := gui.handleEditorKeypress(v.TextArea, key, ch, mod, true) + + // This function is called again on refresh as part of the general resize popup call, + // but we need to call it here so that when we go to render the text area it's not + // considered out of bounds to add a newline, meaning we can avoid unnecessary scrolling. + err := gui.resizePopupPanel(v, v.TextArea.GetContent()) + if err != nil { + gui.Log.Error(err) + } + v.RenderTextArea() gui.RenderCommitLength() return matched } func (gui *Gui) defaultEditor(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier) bool { - matched := true - switch { - case key == gocui.KeyBackspace || key == gocui.KeyBackspace2: - v.EditDelete(true) - case key == gocui.KeyCtrlD || key == gocui.KeyDelete: - v.EditDelete(false) - case key == gocui.KeyArrowDown: - v.MoveCursor(0, 1, false) - case key == gocui.KeyArrowUp: - v.MoveCursor(0, -1, false) - case key == gocui.KeyArrowLeft: - v.MoveCursor(-1, 0, false) - case key == gocui.KeyArrowRight: - v.MoveCursor(1, 0, false) - case key == gocui.KeySpace: - v.EditWrite(' ') - case key == gocui.KeyInsert: - v.Overwrite = !v.Overwrite - case key == gocui.KeyCtrlU: - v.EditDeleteToStartOfLine() - case key == gocui.KeyCtrlA: - v.EditGotoToStartOfLine() - case key == gocui.KeyCtrlE: - v.EditGotoToEndOfLine() + matched := gui.handleEditorKeypress(v.TextArea, key, ch, mod, false) - // TODO: see if we need all three of these conditions: maybe the final one is sufficient - case ch != 0 && mod == 0 && unicode.IsPrint(ch): - v.EditWrite(ch) - default: - matched = false - } + v.RenderTextArea() if gui.findSuggestions != nil { - input := v.Buffer() - suggestions := gui.findSuggestions(input) - gui.setSuggestions(suggestions) + input := v.TextArea.GetContent() + gui.suggestionsAsyncHandler.Do(func() func() { + suggestions := gui.findSuggestions(input) + return func() { gui.setSuggestions(suggestions) } + }) } return matched diff --git a/pkg/gui/extras_panel.go b/pkg/gui/extras_panel.go index 463da4c55..ee106223e 100644 --- a/pkg/gui/extras_panel.go +++ b/pkg/gui/extras_panel.go @@ -11,15 +11,16 @@ func (gui *Gui) handleCreateExtrasMenuPanel() error { return err } } - gui.ShowExtrasWindow = !gui.ShowExtrasWindow + show := !gui.ShowExtrasWindow + gui.ShowExtrasWindow = show + gui.Config.GetAppState().HideCommandLog = !show + _ = gui.Config.SaveAppState() return nil }, }, { displayString: gui.Tr.FocusCommandLog, - onPress: func() error { - return gui.handleFocusCommandLog() - }, + onPress: gui.handleFocusCommandLog, }, } diff --git a/pkg/gui/file_watching.go b/pkg/gui/file_watching.go index 607aa6eec..f5749a97d 100644 --- a/pkg/gui/file_watching.go +++ b/pkg/gui/file_watching.go @@ -11,7 +11,7 @@ import ( ) // macs for some bizarre reason cap the number of watchable files to 256. -// there's no obvious platform agonstic way to check the situation of the user's +// there's no obvious platform agnostic way to check the situation of the user's // computer so we're just arbitrarily capping at 200. This isn't so bad because // file watching is only really an added bonus for faster refreshing. const MAX_WATCHED_FILES = 50 diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index 48c0621cb..cce28353e 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -57,13 +57,6 @@ func (gui *Gui) selectFile(alreadySelected bool) error { } if !alreadySelected { - // TODO: pull into update task interface - if err := gui.resetOrigin(gui.Views.Main); err != nil { - return err - } - if err := gui.resetOrigin(gui.Views.Secondary); err != nil { - return err - } gui.takeOverMergeConflictScrolling() } @@ -347,9 +340,10 @@ func (gui *Gui) handleWIPCommitPress() error { return gui.createErrorPanel(gui.Tr.SkipHookPrefixNotConfigured) } - if err := gui.Views.CommitMessage.SetEditorContent(skipHookPrefix); err != nil { - return err - } + textArea := gui.Views.CommitMessage.TextArea + textArea.Clear() + textArea.TypeString(skipHookPrefix) + gui.Views.CommitMessage.RenderTextArea() return gui.handleCommitPress() } @@ -399,10 +393,11 @@ func (gui *Gui) handleCommitPress() error { return gui.createErrorPanel(fmt.Sprintf("%s: %s", gui.Tr.LcCommitPrefixPatternError, err.Error())) } prefix := rgx.ReplaceAllString(gui.getCheckedOutBranch().Name, prefixReplace) - gui.renderString(gui.Views.CommitMessage, prefix) - if err := gui.Views.CommitMessage.SetCursor(len(prefix), 0); err != nil { - return err - } + gui.Views.CommitMessage.ClearTextArea() + gui.Views.CommitMessage.TextArea.TypeString(prefix) + gui.g.Update(func(*gocui.Gui) error { + return nil + }) } gui.g.Update(func(g *gocui.Gui) error { @@ -473,14 +468,49 @@ func (gui *Gui) handleCommitEditorPress() error { ) } +func (gui *Gui) handleStatusFilterPressed() error { + menuItems := []*menuItem{ + { + displayString: gui.Tr.FilterStagedFiles, + onPress: func() error { + return gui.setStatusFiltering(filetree.DisplayStaged) + }, + }, + { + displayString: gui.Tr.FilterUnstagedFiles, + onPress: func() error { + return gui.setStatusFiltering(filetree.DisplayUnstaged) + }, + }, + { + displayString: gui.Tr.ResetCommitFilterState, + onPress: func() error { + return gui.setStatusFiltering(filetree.DisplayAll) + }, + }, + } + + return gui.createMenu(gui.Tr.FilteringMenuTitle, menuItems, createMenuOptions{showCancel: true}) +} + +func (gui *Gui) setStatusFiltering(filter filetree.FileManagerDisplayFilter) error { + state := gui.State + state.FileManager.SetDisplayFilter(filter) + return gui.handleRefreshFiles() +} + func (gui *Gui) editFile(filename string) error { - cmdStr, err := gui.GitCommand.EditFileCmdStr(filename) + return gui.editFileAtLine(filename, 1) +} + +func (gui *Gui) editFileAtLine(filename string, lineNumber int) error { + cmdStr, err := gui.GitCommand.EditFileCmdStr(filename, lineNumber) if err != nil { return gui.surfaceError(err) } return gui.runSubprocessWithSuspenseAndRefresh( - gui.OSCommand.WithSpan(gui.Tr.Spans.EditFile).PrepareShellSubProcess(cmdStr), + gui.OSCommand.WithSpan(gui.Tr.Spans.EditFile).ShellCommandFromString(cmdStr), ) } @@ -630,8 +660,9 @@ func (gui *Gui) handlePullFiles() error { } return gui.prompt(promptOpts{ - title: gui.Tr.EnterUpstream, - initialContent: "origin/" + currentBranch.Name, + title: gui.Tr.EnterUpstream, + initialContent: "origin/" + currentBranch.Name, + findSuggestionsFunc: gui.getRemoteBranchesSuggestionsFunc("/"), handleConfirm: func(upstream string) error { if err := gui.GitCommand.SetUpstreamBranch(upstream); err != nil { errorMessage := err.Error() @@ -649,9 +680,10 @@ func (gui *Gui) handlePullFiles() error { } type PullFilesOptions struct { - RemoteName string - BranchName string - span string + RemoteName string + BranchName string + FastForwardOnly bool + span string } func (gui *Gui) pullFiles(opts PullFilesOptions) error { @@ -659,56 +691,53 @@ func (gui *Gui) pullFiles(opts PullFilesOptions) error { return err } - mode := &gui.Config.GetUserConfig().Git.Pull.Mode - *mode = gui.GitCommand.GetPullMode(*mode) - // TODO: this doesn't look like a good idea. Why the goroutine? - go utils.Safe(func() { _ = gui.pullWithMode(*mode, opts) }) + go utils.Safe(func() { _ = gui.pullWithLock(opts) }) return nil } -func (gui *Gui) pullWithMode(mode string, opts PullFilesOptions) error { +func (gui *Gui) pullWithLock(opts PullFilesOptions) error { gui.Mutexes.FetchMutex.Lock() defer gui.Mutexes.FetchMutex.Unlock() gitCommand := gui.GitCommand.WithSpan(opts.span) - err := gitCommand.Fetch( - commands.FetchOptions{ + err := gitCommand.Pull( + commands.PullOptions{ PromptUserForCredential: gui.promptUserForCredential, RemoteName: opts.RemoteName, BranchName: opts.BranchName, + FastForwardOnly: opts.FastForwardOnly, }, ) - gui.handleCredentialsPopup(err) - if err != nil { - return gui.refreshSidePanels(refreshOptions{mode: ASYNC}) - } - - switch mode { - case "rebase": - err := gitCommand.RebaseBranch("FETCH_HEAD") - return gui.handleGenericMergeCommandResult(err) - case "merge": - err := gitCommand.Merge("FETCH_HEAD", commands.MergeOpts{}) - return gui.handleGenericMergeCommandResult(err) - case "ff-only": - err := gitCommand.Merge("FETCH_HEAD", commands.MergeOpts{FastForwardOnly: true}) - return gui.handleGenericMergeCommandResult(err) - default: - return gui.createErrorPanel(fmt.Sprintf("git pull mode '%s' unrecognised", mode)) + if err == nil { + _ = gui.closeConfirmationPrompt(false) } + return gui.handleGenericMergeCommandResult(err) } -func (gui *Gui) pushWithForceFlag(force bool, upstream string, args string) error { +type pushOpts struct { + force bool + upstreamRemote string + upstreamBranch string + setUpstream bool +} + +func (gui *Gui) push(opts pushOpts) error { if err := gui.createLoaderPanel(gui.Tr.PushWait); err != nil { return err } go utils.Safe(func() { - branchName := gui.getCheckedOutBranch().Name - err := gui.GitCommand.WithSpan(gui.Tr.Spans.Push).Push(branchName, force, upstream, args, gui.promptUserForCredential) - if err != nil && !force && strings.Contains(err.Error(), "Updates were rejected") { + err := gui.GitCommand.WithSpan(gui.Tr.Spans.Push).Push(commands.PushOpts{ + Force: opts.force, + UpstreamRemote: opts.upstreamRemote, + UpstreamBranch: opts.upstreamBranch, + SetUpstream: opts.setUpstream, + PromptUserForCredential: gui.promptUserForCredential, + }) + + if err != nil && !opts.force && strings.Contains(err.Error(), "Updates were rejected") { forcePushDisabled := gui.Config.GetUserConfig().Git.DisableForcePushing if forcePushDisabled { _ = gui.createErrorPanel(gui.Tr.UpdatesRejectedAndForcePushDisabled) @@ -718,7 +747,10 @@ func (gui *Gui) pushWithForceFlag(force bool, upstream string, args string) erro title: gui.Tr.ForcePush, prompt: gui.Tr.ForcePushPrompt, handleConfirm: func() error { - return gui.pushWithForceFlag(true, upstream, args) + newOpts := opts + newOpts.force = true + + return gui.push(newOpts) }, }) return @@ -745,27 +777,49 @@ func (gui *Gui) pushFiles() error { if currentBranch.HasCommitsToPull() { return gui.requestToForcePush() } else { - return gui.pushWithForceFlag(false, "", "") + return gui.push(pushOpts{}) } } else { // see if we have an upstream for this branch in our config - upstream, err := gui.upstreamForBranchInConfig(currentBranch.Name) + upstreamRemote, upstreamBranch, err := gui.upstreamForBranchInConfig(currentBranch.Name) if err != nil { return gui.surfaceError(err) } - if upstream != "" { - return gui.pushWithForceFlag(false, "", upstream) + if upstreamBranch != "" { + return gui.push( + pushOpts{ + force: false, + upstreamRemote: upstreamRemote, + upstreamBranch: upstreamBranch, + }, + ) } if gui.GitCommand.PushToCurrent { - return gui.pushWithForceFlag(false, "", "--set-upstream") + return gui.push(pushOpts{setUpstream: true}) } else { return gui.prompt(promptOpts{ - title: gui.Tr.EnterUpstream, - initialContent: "origin " + currentBranch.Name, + title: gui.Tr.EnterUpstream, + initialContent: "origin " + currentBranch.Name, + findSuggestionsFunc: gui.getRemoteBranchesSuggestionsFunc(" "), handleConfirm: func(upstream string) error { - return gui.pushWithForceFlag(false, upstream, "") + var upstreamBranch, upstreamRemote string + split := strings.Split(upstream, " ") + if len(split) == 2 { + upstreamRemote = split[0] + upstreamBranch = split[1] + } else { + upstreamRemote = upstream + upstreamBranch = "" + } + + return gui.push(pushOpts{ + force: false, + upstreamRemote: upstreamRemote, + upstreamBranch: upstreamBranch, + setUpstream: true, + }) }, }) } @@ -782,24 +836,24 @@ func (gui *Gui) requestToForcePush() error { title: gui.Tr.ForcePush, prompt: gui.Tr.ForcePushPrompt, handleConfirm: func() error { - return gui.pushWithForceFlag(true, "", "") + return gui.push(pushOpts{force: true}) }, }) } -func (gui *Gui) upstreamForBranchInConfig(branchName string) (string, error) { +func (gui *Gui) upstreamForBranchInConfig(branchName string) (string, string, error) { conf, err := gui.GitCommand.Repo.Config() if err != nil { - return "", err + return "", "", err } for configBranchName, configBranch := range conf.Branches { if configBranchName == branchName { - return fmt.Sprintf("%s %s", configBranch.Remote, configBranchName), nil + return configBranch.Remote, configBranchName, nil } } - return "", nil + return "", "", nil } func (gui *Gui) handleSwitchToMerge() error { @@ -833,8 +887,21 @@ func (gui *Gui) anyFilesWithMergeConflicts() bool { func (gui *Gui) handleCustomCommand() error { return gui.prompt(promptOpts{ - title: gui.Tr.CustomCommand, + title: gui.Tr.CustomCommand, + findSuggestionsFunc: gui.getCustomCommandsHistorySuggestionsFunc(), handleConfirm: func(command string) error { + gui.Config.GetAppState().CustomCommandsHistory = utils.Limit( + utils.Uniq( + append(gui.Config.GetAppState().CustomCommandsHistory, command), + ), + 1000, + ) + + err := gui.Config.SaveAppState() + if err != nil { + gui.Log.Error(err) + } + gui.OnRunCommand(oscommands.NewCmdLogEntry(command, gui.Tr.Spans.CustomCommand, true)) return gui.runSubprocessWithSuspenseAndRefresh( gui.OSCommand.PrepareShellSubProcess(command), diff --git a/pkg/gui/filetree/file_manager.go b/pkg/gui/filetree/file_manager.go index 825ee0b01..699e20332 100644 --- a/pkg/gui/filetree/file_manager.go +++ b/pkg/gui/filetree/file_manager.go @@ -8,11 +8,20 @@ import ( "github.com/sirupsen/logrus" ) +type FileManagerDisplayFilter int + +const ( + DisplayAll FileManagerDisplayFilter = iota + DisplayStaged + DisplayUnstaged +) + type FileManager struct { files []*models.File tree *FileNode showTree bool log *logrus.Entry + filter FileManagerDisplayFilter collapsedPaths CollapsedPaths sync.RWMutex } @@ -22,6 +31,7 @@ func NewFileManager(files []*models.File, log *logrus.Entry, showTree bool) *Fil files: files, log: log, showTree: showTree, + filter: DisplayAll, collapsedPaths: CollapsedPaths{}, RWMutex: sync.RWMutex{}, } @@ -35,6 +45,35 @@ func (m *FileManager) ExpandToPath(path string) { m.collapsedPaths.ExpandToPath(path) } +func (m *FileManager) GetFilesForDisplay() []*models.File { + files := m.files + if m.filter == DisplayAll { + return files + } + + result := make([]*models.File, 0) + if m.filter == DisplayStaged { + for _, file := range files { + if file.HasStagedChanges { + result = append(result, file) + } + } + } else { + for _, file := range files { + if !file.HasStagedChanges { + result = append(result, file) + } + } + } + + return result +} + +func (m *FileManager) SetDisplayFilter(filter FileManagerDisplayFilter) { + m.filter = filter + m.SetTree() +} + func (m *FileManager) ToggleShowTree() { m.showTree = !m.showTree m.SetTree() @@ -73,10 +112,11 @@ func (m *FileManager) SetFiles(files []*models.File) { } func (m *FileManager) SetTree() { + filesForDisplay := m.GetFilesForDisplay() if m.showTree { - m.tree = BuildTreeFromFiles(m.files) + m.tree = BuildTreeFromFiles(filesForDisplay) } else { - m.tree = BuildFlatTreeFromFiles(m.files) + m.tree = BuildFlatTreeFromFiles(filesForDisplay) } } diff --git a/pkg/gui/filetree/file_manager_test.go b/pkg/gui/filetree/file_manager_test.go index 038c03364..36343bc13 100644 --- a/pkg/gui/filetree/file_manager_test.go +++ b/pkg/gui/filetree/file_manager_test.go @@ -3,11 +3,15 @@ package filetree import ( "testing" + "github.com/gookit/color" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/stretchr/testify/assert" + "github.com/xo/terminfo" ) func TestRender(t *testing.T) { + color.ForceSetColorLevel(terminfo.ColorLevelNone) + scenarios := []struct { name string root *FileNode @@ -89,3 +93,62 @@ func TestRender(t *testing.T) { }) } } + +func TestFilterAction(t *testing.T) { + scenarios := []struct { + name string + filter FileManagerDisplayFilter + files []*models.File + expected []*models.File + }{ + { + name: "filter files with unstaged changes", + filter: DisplayUnstaged, + files: []*models.File{ + {Name: "dir2/dir2/file4", ShortStatus: "M ", HasUnstagedChanges: true}, + {Name: "dir2/file5", ShortStatus: "M ", HasStagedChanges: true}, + {Name: "file1", ShortStatus: "M ", HasUnstagedChanges: true}, + }, + expected: []*models.File{ + {Name: "dir2/dir2/file4", ShortStatus: "M ", HasUnstagedChanges: true}, + {Name: "file1", ShortStatus: "M ", HasUnstagedChanges: true}, + }, + }, + { + name: "filter files with staged changes", + filter: DisplayStaged, + files: []*models.File{ + {Name: "dir2/dir2/file4", ShortStatus: "M ", HasStagedChanges: true}, + {Name: "dir2/file5", ShortStatus: "M ", HasStagedChanges: false}, + {Name: "file1", ShortStatus: "M ", HasStagedChanges: true}, + }, + expected: []*models.File{ + {Name: "dir2/dir2/file4", ShortStatus: "M ", HasStagedChanges: true}, + {Name: "file1", ShortStatus: "M ", HasStagedChanges: true}, + }, + }, + { + name: "filter all files", + filter: DisplayAll, + files: []*models.File{ + {Name: "dir2/dir2/file4", ShortStatus: "M ", HasUnstagedChanges: true}, + {Name: "dir2/file5", ShortStatus: "M ", HasUnstagedChanges: true}, + {Name: "file1", ShortStatus: "M ", HasUnstagedChanges: true}, + }, + expected: []*models.File{ + {Name: "dir2/dir2/file4", ShortStatus: "M ", HasUnstagedChanges: true}, + {Name: "dir2/file5", ShortStatus: "M ", HasUnstagedChanges: true}, + {Name: "file1", ShortStatus: "M ", HasUnstagedChanges: true}, + }, + }, + } + + for _, s := range scenarios { + s := s + t.Run(s.name, func(t *testing.T) { + mngr := &FileManager{files: s.files, filter: s.filter} + result := mngr.GetFilesForDisplay() + assert.EqualValues(t, s.expected, result) + }) + } +} diff --git a/pkg/gui/filtering_menu_panel.go b/pkg/gui/filtering_menu_panel.go index 649172b45..2955f6e8d 100644 --- a/pkg/gui/filtering_menu_panel.go +++ b/pkg/gui/filtering_menu_panel.go @@ -35,7 +35,8 @@ func (gui *Gui) handleCreateFilteringMenuPanel() error { displayString: gui.Tr.LcFilterPathOption, onPress: func() error { return gui.prompt(promptOpts{ - title: gui.Tr.LcEnterFileName, + findSuggestionsFunc: gui.getFilePathSuggestionsFunc(), + title: gui.Tr.EnterFileName, handleConfirm: func(response string) error { return gui.setFiltering(strings.TrimSpace(response)) }, diff --git a/pkg/gui/find_suggestions.go b/pkg/gui/find_suggestions.go new file mode 100644 index 000000000..343e087e8 --- /dev/null +++ b/pkg/gui/find_suggestions.go @@ -0,0 +1,190 @@ +package gui + +import ( + "fmt" + "os" + + "github.com/jesseduffield/lazygit/pkg/gui/presentation" + "github.com/jesseduffield/lazygit/pkg/gui/types" + "github.com/jesseduffield/lazygit/pkg/utils" + "github.com/jesseduffield/minimal/gitignore" + "gopkg.in/ozeidan/fuzzy-patricia.v3/patricia" +) + +// Thinking out loud: I'm typically a staunch advocate of organising code by feature rather than type, +// because colocating code that relates to the same feature means far less effort +// to get all the context you need to work on any particular feature. But the one +// major benefit of grouping by type is that it makes it makes it less likely that +// somebody will re-implement the same logic twice, because they can quickly see +// if a certain method has been used for some use case, given that as a starting point +// they know about the type. In that vein, I'm including all our functions for +// finding suggestions in this file, so that it's easy to see if a function already +// exists for fetching a particular model. + +func (gui *Gui) getRemoteNames() []string { + result := make([]string, len(gui.State.Remotes)) + for i, remote := range gui.State.Remotes { + result[i] = remote.Name + } + return result +} + +func matchesToSuggestions(matches []string) []*types.Suggestion { + suggestions := make([]*types.Suggestion, len(matches)) + for i, match := range matches { + suggestions[i] = &types.Suggestion{ + Value: match, + Label: match, + } + } + return suggestions +} + +func (gui *Gui) getRemoteSuggestionsFunc() func(string) []*types.Suggestion { + remoteNames := gui.getRemoteNames() + + return fuzzySearchFunc(remoteNames) +} + +func (gui *Gui) getBranchNames() []string { + result := make([]string, len(gui.State.Branches)) + for i, branch := range gui.State.Branches { + result[i] = branch.Name + } + return result +} + +func (gui *Gui) getBranchNameSuggestionsFunc() func(string) []*types.Suggestion { + branchNames := gui.getBranchNames() + + return func(input string) []*types.Suggestion { + var matchingBranchNames []string + if input == "" { + matchingBranchNames = branchNames + } else { + matchingBranchNames = utils.FuzzySearch(input, branchNames) + } + + suggestions := make([]*types.Suggestion, len(matchingBranchNames)) + for i, branchName := range matchingBranchNames { + suggestions[i] = &types.Suggestion{ + Value: branchName, + Label: presentation.GetBranchTextStyle(branchName).Sprint(branchName), + } + } + + return suggestions + } +} + +// here we asynchronously fetch the latest set of paths in the repo and store in +// gui.State.FilesTrie. On the main thread we'll be doing a fuzzy search via +// gui.State.FilesTrie. So if we've looked for a file previously, we'll start with +// the old trie and eventually it'll be swapped out for the new one. +// Notably, unlike other suggestion functions we're not showing all the options +// if nothing has been typed because there'll be too much to display efficiently +func (gui *Gui) getFilePathSuggestionsFunc() func(string) []*types.Suggestion { + _ = gui.WithWaitingStatus(gui.Tr.LcLoadingFileSuggestions, func() error { + trie := patricia.NewTrie() + // load every non-gitignored file in the repo + ignore, err := gitignore.FromGit() + if err != nil { + return err + } + + err = ignore.Walk(".", + func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + trie.Insert(patricia.Prefix(path), path) + return nil + }) + // cache the trie for future use + gui.State.FilesTrie = trie + + // refresh the selections view + gui.suggestionsAsyncHandler.Do(func() func() { + // assuming here that the confirmation view is what we're typing into. + // This assumption may prove false over time + suggestions := gui.findSuggestions(gui.Views.Confirmation.TextArea.GetContent()) + return func() { gui.setSuggestions(suggestions) } + }) + + return err + }) + + return func(input string) []*types.Suggestion { + matchingNames := []string{} + _ = gui.State.FilesTrie.VisitFuzzy(patricia.Prefix(input), true, func(prefix patricia.Prefix, item patricia.Item, skipped int) error { + matchingNames = append(matchingNames, item.(string)) + return nil + }) + + // doing another fuzzy search for good measure + matchingNames = utils.FuzzySearch(input, matchingNames) + + suggestions := make([]*types.Suggestion, len(matchingNames)) + for i, name := range matchingNames { + suggestions[i] = &types.Suggestion{ + Value: name, + Label: name, + } + } + + return suggestions + } +} + +func (gui *Gui) getRemoteBranchNames(separator string) []string { + result := []string{} + for _, remote := range gui.State.Remotes { + for _, branch := range remote.Branches { + result = append(result, fmt.Sprintf("%s%s%s", remote.Name, separator, branch.Name)) + } + } + return result +} + +func (gui *Gui) getRemoteBranchesSuggestionsFunc(separator string) func(string) []*types.Suggestion { + return fuzzySearchFunc(gui.getRemoteBranchNames(separator)) +} + +func (gui *Gui) getTagNames() []string { + result := make([]string, len(gui.State.Tags)) + for i, tag := range gui.State.Tags { + result[i] = tag.Name + } + return result +} + +func (gui *Gui) getRefsSuggestionsFunc() func(string) []*types.Suggestion { + remoteBranchNames := gui.getRemoteBranchNames("/") + localBranchNames := gui.getBranchNames() + tagNames := gui.getTagNames() + additionalRefNames := []string{"HEAD", "FETCH_HEAD", "MERGE_HEAD", "ORIG_HEAD"} + + refNames := append(append(append(remoteBranchNames, localBranchNames...), tagNames...), additionalRefNames...) + + return fuzzySearchFunc(refNames) +} + +func (gui *Gui) getCustomCommandsHistorySuggestionsFunc() func(string) []*types.Suggestion { + // reversing so that we display the latest command first + history := utils.Reverse(gui.Config.GetAppState().CustomCommandsHistory) + + return fuzzySearchFunc(history) +} + +func fuzzySearchFunc(options []string) func(string) []*types.Suggestion { + return func(input string) []*types.Suggestion { + var matches []string + if input == "" { + matches = options + } else { + matches = utils.FuzzySearch(input, options) + } + + return matchesToSuggestions(matches) + } +} diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 89dc71374..492885385 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -5,14 +5,12 @@ import ( "io/ioutil" "log" "os" - "runtime" "sync" "os/exec" "strings" "time" - "github.com/fatih/color" "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/commands" "github.com/jesseduffield/lazygit/pkg/commands/models" @@ -24,14 +22,15 @@ import ( "github.com/jesseduffield/lazygit/pkg/gui/modes/cherrypicking" "github.com/jesseduffield/lazygit/pkg/gui/modes/diffing" "github.com/jesseduffield/lazygit/pkg/gui/modes/filtering" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/jesseduffield/lazygit/pkg/i18n" "github.com/jesseduffield/lazygit/pkg/tasks" "github.com/jesseduffield/lazygit/pkg/theme" "github.com/jesseduffield/lazygit/pkg/updates" "github.com/jesseduffield/lazygit/pkg/utils" - "github.com/mattn/go-runewidth" "github.com/sirupsen/logrus" + "gopkg.in/ozeidan/fuzzy-patricia.v3/patricia" ) // screen sizing determines how much space your selected window takes up (window @@ -51,10 +50,6 @@ const StartupPopupVersion = 5 // OverlappingEdges determines if panel edges overlap var OverlappingEdges = false -func init() { - runewidth.DefaultCondition.EastAsianWidth = false -} - type ContextManager struct { ContextStack []Context sync.RWMutex @@ -122,6 +117,8 @@ type Gui struct { // the extras window contains things like the command log ShowExtrasWindow bool + + suggestionsAsyncHandler *tasks.AsyncHandler } type listPanelState struct { @@ -343,6 +340,9 @@ type guiState struct { // flag as to whether or not the diff view should ignore whitespace IgnoreWhitespaceInDiffView bool + + // for displaying suggestions while typing in a file name + FilesTrie *patricia.Trie } // reuseState determines if we pull the repo state from our repo state map or @@ -419,6 +419,7 @@ func (gui *Gui) resetState(filterPath string, reuseState bool) { // TODO: put contexts in the context manager ContextManager: NewContextManager(initialContext), Contexts: contexts, + FilesTrie: patricia.NewTrie(), } gui.RepoStateMap[Repo(currentDir)] = gui.State @@ -428,19 +429,20 @@ func (gui *Gui) resetState(filterPath string, reuseState bool) { // NewGui builds a new gui handler func NewGui(log *logrus.Entry, gitCommand *commands.GitCommand, oSCommand *oscommands.OSCommand, tr *i18n.TranslationSet, config config.AppConfigurer, updater *updates.Updater, filterPath string, showRecentRepos bool) (*Gui, error) { gui := &Gui{ - Log: log, - GitCommand: gitCommand, - OSCommand: oSCommand, - Config: config, - Tr: tr, - Updater: updater, - statusManager: &statusManager{}, - viewBufferManagerMap: map[string]*tasks.ViewBufferManager{}, - showRecentRepos: showRecentRepos, - RepoPathStack: []string{}, - RepoStateMap: map[Repo]*guiState{}, - CmdLog: []string{}, - ShowExtrasWindow: config.GetUserConfig().Gui.ShowCommandLog, + Log: log, + GitCommand: gitCommand, + OSCommand: oSCommand, + Config: config, + Tr: tr, + Updater: updater, + statusManager: &statusManager{}, + viewBufferManagerMap: map[string]*tasks.ViewBufferManager{}, + showRecentRepos: showRecentRepos, + RepoPathStack: []string{}, + RepoStateMap: map[Repo]*guiState{}, + CmdLog: []string{}, + ShowExtrasWindow: config.ShowCommandLogOnStartup(), + suggestionsAsyncHandler: tasks.NewAsyncHandler(), } gui.resetState(filterPath, false) @@ -498,8 +500,6 @@ func (gui *Gui) Run() error { g.NextSearchMatchKey = gui.getKey(userConfig.Keybinding.Universal.NextMatch) g.PrevSearchMatchKey = gui.getKey(userConfig.Keybinding.Universal.PrevMatch) - g.ASCII = runtime.GOOS == "windows" && runewidth.IsEastAsian() - g.ShowListFooter = userConfig.Gui.ShowListFooter if userConfig.Gui.MouseEvents { @@ -612,7 +612,7 @@ func (gui *Gui) runSubprocess(subprocess *exec.Cmd) error { subprocess.Stderr = os.Stdout subprocess.Stdin = os.Stdin - fmt.Fprintf(os.Stdout, "\n%s\n\n", utils.ColoredString("+ "+strings.Join(subprocess.Args, " "), color.FgBlue)) + fmt.Fprintf(os.Stdout, "\n%s\n\n", style.FgBlue.Sprint("+ "+strings.Join(subprocess.Args, " "))) if err := subprocess.Run(); err != nil { // not handling the error explicitly because usually we're going to see it @@ -624,7 +624,7 @@ func (gui *Gui) runSubprocess(subprocess *exec.Cmd) error { subprocess.Stderr = ioutil.Discard subprocess.Stdin = nil - fmt.Fprintf(os.Stdout, "\n%s", utils.ColoredString(gui.Tr.PressEnterToReturn, color.FgGreen)) + fmt.Fprintf(os.Stdout, "\n%s", style.FgGreen.Sprint(gui.Tr.PressEnterToReturn)) fmt.Scanln() // wait for enter press return nil diff --git a/pkg/gui/gui_test.go b/pkg/gui/gui_test.go index ec1279608..6e7a26b79 100644 --- a/pkg/gui/gui_test.go +++ b/pkg/gui/gui_test.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package gui @@ -55,8 +56,8 @@ func Test(t *testing.T) { updateSnapshots, record, speedEnv, - func(t *testing.T, expected string, actual string) { - assert.Equal(t, expected, actual, fmt.Sprintf("expected:\n%s\nactual:\n%s\n", expected, actual)) + func(t *testing.T, expected string, actual string, prefix string) { + assert.Equal(t, expected, actual, fmt.Sprintf("Unexpected %s. Expected:\n%s\nActual:\n%s\n", prefix, expected, actual)) }, includeSkipped, ) @@ -80,52 +81,3 @@ func runCmdHeadless(cmd *exec.Cmd) error { return f.Close() } - -func TestGuiGenerateMenuCandidates(t *testing.T) { - type scenario struct { - testName string - cmdOut string - filter string - format string - test func([]string, error) - } - - scenarios := []scenario{ - { - "Extract remote branch name", - "upstream/pr-1", - "upstream/(?P.*)", - "{{ .branch }}", - func(actual []string, err error) { - assert.NoError(t, err) - assert.EqualValues(t, "pr-1", actual[0]) - }, - }, - { - "Multiple named groups", - "upstream/pr-1", - "(?P[a-z]*)/(?P.*)", - "{{ .branch }}|{{ .remote }}", - func(actual []string, err error) { - assert.NoError(t, err) - assert.EqualValues(t, "pr-1|upstream", actual[0]) - }, - }, - { - "Multiple named groups with group ids", - "upstream/pr-1", - "(?P[a-z]*)/(?P.*)", - "{{ .group_2 }}|{{ .group_1 }}", - func(actual []string, err error) { - assert.NoError(t, err) - assert.EqualValues(t, "pr-1|upstream", actual[0]) - }, - }, - } - - for _, s := range scenarios { - t.Run(s.testName, func(t *testing.T) { - s.test(NewDummyGui().GenerateMenuCandidates(s.cmdOut, s.filter, s.format)) - }) - } -} diff --git a/pkg/gui/information_panel.go b/pkg/gui/information_panel.go index ac46cdaf1..d09f495c5 100644 --- a/pkg/gui/information_panel.go +++ b/pkg/gui/information_panel.go @@ -3,8 +3,8 @@ package gui import ( "fmt" - "github.com/fatih/color" "github.com/jesseduffield/lazygit/pkg/constants" + "github.com/jesseduffield/lazygit/pkg/gui/style" ) func (gui *Gui) informationStr() string { @@ -15,8 +15,8 @@ func (gui *Gui) informationStr() string { } if gui.g.Mouse { - donate := color.New(color.FgMagenta, color.Underline).Sprint(gui.Tr.Donate) - askQuestion := color.New(color.FgYellow, color.Underline).Sprint(gui.Tr.AskQuestion) + donate := style.FgMagenta.SetUnderline().Sprint(gui.Tr.Donate) + askQuestion := style.FgYellow.SetUnderline().Sprint(gui.Tr.AskQuestion) return fmt.Sprintf("%s %s %s", donate, askQuestion, gui.Config.GetVersion()) } else { return gui.Config.GetVersion() diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 695f0b052..9097afed5 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -381,6 +381,12 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Handler: gui.handleShowAllBranchLogs, Description: gui.Tr.LcAllBranchesLogGraph, }, + { + ViewName: "files", + Key: gui.getKey(""), + Handler: gui.handleStatusFilterPressed, + Description: gui.Tr.LcCommitFileFilter, + }, { ViewName: "files", Contexts: []string{string(FILES_CONTEXT_KEY)}, @@ -1297,11 +1303,19 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Modifier: gocui.ModNone, Handler: gui.handleSelectNextHunk, }, + { + ViewName: "main", + Contexts: []string{string(MAIN_PATCH_BUILDING_CONTEXT_KEY), string(MAIN_STAGING_CONTEXT_KEY)}, + Key: gui.getKey(config.Universal.CopyToClipboard), + Modifier: gocui.ModNone, + Handler: gui.copySelectedToClipboard, + Description: gui.Tr.LcCopySelectedTexToClipboard, + }, { ViewName: "main", Contexts: []string{string(MAIN_STAGING_CONTEXT_KEY)}, Key: gui.getKey(config.Universal.Edit), - Handler: gui.handleFileEdit, + Handler: gui.handleLineByLineEdit, Description: gui.Tr.LcEditFile, }, { @@ -1458,8 +1472,8 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { ViewName: "main", Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)}, Key: gui.getKey(config.Main.PickBothHunks), - Handler: gui.handlePickBothHunks, - Description: gui.Tr.PickBothHunks, + Handler: gui.handlePickAllHunks, + Description: gui.Tr.PickAllHunks, }, { ViewName: "main", @@ -1479,29 +1493,29 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { ViewName: "main", Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)}, Key: gui.getKey(config.Universal.PrevItem), - Handler: gui.handleSelectTop, - Description: gui.Tr.SelectTop, + Handler: gui.handleSelectPrevConflictHunk, + Description: gui.Tr.SelectPrevHunk, }, { ViewName: "main", Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)}, Key: gui.getKey(config.Universal.NextItem), - Handler: gui.handleSelectBottom, - Description: gui.Tr.SelectBottom, + Handler: gui.handleSelectNextConflictHunk, + Description: gui.Tr.SelectNextHunk, }, { ViewName: "main", Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)}, Key: gocui.MouseWheelUp, Modifier: gocui.ModNone, - Handler: gui.handleSelectTop, + Handler: gui.handleSelectPrevConflictHunk, }, { ViewName: "main", Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)}, Key: gocui.MouseWheelDown, Modifier: gocui.ModNone, - Handler: gui.handleSelectBottom, + Handler: gui.handleSelectNextConflictHunk, }, { ViewName: "main", @@ -1522,14 +1536,14 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)}, Key: gui.getKey(config.Universal.PrevItemAlt), Modifier: gocui.ModNone, - Handler: gui.handleSelectTop, + Handler: gui.handleSelectPrevConflictHunk, }, { ViewName: "main", Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)}, Key: gui.getKey(config.Universal.NextItemAlt), Modifier: gocui.ModNone, - Handler: gui.handleSelectBottom, + Handler: gui.handleSelectNextConflictHunk, }, { ViewName: "main", @@ -1804,8 +1818,18 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { } // Appends keybindings to jump to a particular sideView using numbers - for i, window := range []string{"status", "files", "branches", "commits", "stash"} { - bindings = append(bindings, &Binding{ViewName: "", Key: rune(i+1) + '0', Modifier: gocui.ModNone, Handler: gui.goToSideWindow(window)}) + windows := []string{"status", "files", "branches", "commits", "stash"} + + if len(config.Universal.JumpToBlock) != len(windows) { + log.Fatal("Jump to block keybindings cannot be set. Exactly 5 keybindings must be supplied.") + } else { + for i, window := range windows { + bindings = append(bindings, &Binding{ + ViewName: "", + Key: gui.getKey(config.Universal.JumpToBlock[i]), + Modifier: gocui.ModNone, + Handler: gui.goToSideWindow(window)}) + } } for viewName := range gui.State.Contexts.initialViewTabContextMap() { diff --git a/pkg/gui/layout.go b/pkg/gui/layout.go index c15ba340e..a7f308b7b 100644 --- a/pkg/gui/layout.go +++ b/pkg/gui/layout.go @@ -111,6 +111,7 @@ func (gui *Gui) createAllViews() error { gui.Views.Credentials.Editable = true gui.Views.Suggestions.Visible = false + gui.Views.Suggestions.ContainsList = true gui.Views.Menu.Visible = false diff --git a/pkg/gui/lbl/state.go b/pkg/gui/lbl/state.go index 8ae828923..8ff7d7e88 100644 --- a/pkg/gui/lbl/state.go +++ b/pkg/gui/lbl/state.go @@ -180,6 +180,11 @@ func (s *State) RenderForLineIndices(includedLineIndices []int) string { return s.patchParser.Render(firstLineIdx, lastLineIdx, includedLineIndices) } +func (s *State) PlainRenderSelected() string { + firstLineIdx, lastLineIdx := s.SelectedRange() + return s.patchParser.PlainRenderLines(firstLineIdx, lastLineIdx) +} + func (s *State) SelectBottom() { s.SetLineSelectMode() s.SelectLine(len(s.patchParser.PatchLines) - 1) diff --git a/pkg/gui/line_by_line_panel.go b/pkg/gui/line_by_line_panel.go index d7a5380b2..8c793375b 100644 --- a/pkg/gui/line_by_line_panel.go +++ b/pkg/gui/line_by_line_panel.go @@ -86,6 +86,20 @@ func (gui *Gui) handleSelectNextHunk() error { }) } +func (gui *Gui) copySelectedToClipboard() error { + return gui.withLBLActiveCheck(func(state *LblPanelState) error { + selected := state.PlainRenderSelected() + + if err := gui.OSCommand.WithSpan( + gui.Tr.Spans.CopySelectedTextToClipboard, + ).CopyToClipboard(selected); err != nil { + return gui.surfaceError(err) + } + + return nil + }) +} + func (gui *Gui) refreshAndFocusLblPanel(state *LblPanelState) error { if err := gui.refreshMainViewForLineByLine(state); err != nil { return err @@ -272,3 +286,13 @@ func (gui *Gui) withLBLActiveCheck(f func(*LblPanelState) error) error { return f(state) } + +func (gui *Gui) handleLineByLineEdit() error { + file := gui.getSelectedFile() + if file == nil { + return nil + } + + lineNumber := gui.State.Panels.LineByLine.CurrentLineNumber() + return gui.editFileAtLine(file.Name, lineNumber) +} diff --git a/pkg/gui/list_context.go b/pkg/gui/list_context.go index dc9425d20..a8ed12372 100644 --- a/pkg/gui/list_context.go +++ b/pkg/gui/list_context.go @@ -11,8 +11,7 @@ type ListContext struct { SelectedItem func() (ListItem, bool) GetPanelState func() IListPanelState - Gui *Gui - ResetMainViewOriginOnFocus bool + Gui *Gui *BasicContext } @@ -79,15 +78,6 @@ func (lc *ListContext) HandleFocus() error { view.FocusPoint(0, lc.GetPanelState().GetSelectedLineIdx()) - if lc.ResetMainViewOriginOnFocus { - if err := lc.Gui.resetOrigin(lc.Gui.Views.Main); err != nil { - return err - } - if err := lc.Gui.resetOrigin(lc.Gui.Views.Secondary); err != nil { - return err - } - } - if lc.Gui.State.Modes.Diffing.Active() { return lc.Gui.renderDiff() } diff --git a/pkg/gui/list_context_config.go b/pkg/gui/list_context_config.go index 01fd1d117..8b8dd5d2b 100644 --- a/pkg/gui/list_context_config.go +++ b/pkg/gui/list_context_config.go @@ -1,10 +1,9 @@ package gui import ( - "github.com/fatih/color" "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/gui/presentation" - "github.com/jesseduffield/lazygit/pkg/utils" + "github.com/jesseduffield/lazygit/pkg/gui/style" ) func (gui *Gui) menuListContext() *ListContext { @@ -15,12 +14,11 @@ func (gui *Gui) menuListContext() *ListContext { Kind: PERSISTENT_POPUP, OnGetOptionsMap: gui.getMenuOptions, }, - GetItemsLength: func() int { return gui.Views.Menu.LinesHeight() }, - GetPanelState: func() IListPanelState { return gui.State.Panels.Menu }, - OnFocus: gui.handleMenuSelect, - OnClickSelectedItem: gui.onMenuPress, - Gui: gui, - ResetMainViewOriginOnFocus: false, + GetItemsLength: func() int { return gui.Views.Menu.LinesHeight() }, + GetPanelState: func() IListPanelState { return gui.State.Panels.Menu }, + OnFocus: gui.handleMenuSelect, + OnClickSelectedItem: gui.onMenuPress, + Gui: gui, // no GetDisplayStrings field because we do a custom render on menu creation } @@ -34,12 +32,11 @@ func (gui *Gui) filesListContext() *ListContext { Key: FILES_CONTEXT_KEY, Kind: SIDE_CONTEXT, }, - GetItemsLength: func() int { return gui.State.FileManager.GetItemsLength() }, - GetPanelState: func() IListPanelState { return gui.State.Panels.Files }, - OnFocus: gui.focusAndSelectFile, - OnClickSelectedItem: gui.handleFilePress, - Gui: gui, - ResetMainViewOriginOnFocus: false, + GetItemsLength: func() int { return gui.State.FileManager.GetItemsLength() }, + GetPanelState: func() IListPanelState { return gui.State.Panels.Files }, + OnFocus: gui.focusAndSelectFile, + OnClickSelectedItem: gui.handleFilePress, + Gui: gui, GetDisplayStrings: func() [][]string { lines := gui.State.FileManager.Render(gui.State.Modes.Diffing.Ref, gui.State.Submodules) mappedLines := make([][]string, len(lines)) @@ -64,11 +61,10 @@ func (gui *Gui) branchesListContext() *ListContext { Key: LOCAL_BRANCHES_CONTEXT_KEY, Kind: SIDE_CONTEXT, }, - GetItemsLength: func() int { return len(gui.State.Branches) }, - GetPanelState: func() IListPanelState { return gui.State.Panels.Branches }, - OnFocus: gui.handleBranchSelect, - Gui: gui, - ResetMainViewOriginOnFocus: true, + GetItemsLength: func() int { return len(gui.State.Branches) }, + GetPanelState: func() IListPanelState { return gui.State.Panels.Branches }, + OnFocus: gui.handleBranchSelect, + Gui: gui, GetDisplayStrings: func() [][]string { return presentation.GetBranchListDisplayStrings( gui.State.Branches, @@ -92,12 +88,11 @@ func (gui *Gui) remotesListContext() *ListContext { Key: REMOTES_CONTEXT_KEY, Kind: SIDE_CONTEXT, }, - GetItemsLength: func() int { return len(gui.State.Remotes) }, - GetPanelState: func() IListPanelState { return gui.State.Panels.Remotes }, - OnFocus: gui.handleRemoteSelect, - OnClickSelectedItem: gui.handleRemoteEnter, - Gui: gui, - ResetMainViewOriginOnFocus: true, + GetItemsLength: func() int { return len(gui.State.Remotes) }, + GetPanelState: func() IListPanelState { return gui.State.Panels.Remotes }, + OnFocus: gui.handleRemoteSelect, + OnClickSelectedItem: gui.handleRemoteEnter, + Gui: gui, GetDisplayStrings: func() [][]string { return presentation.GetRemoteListDisplayStrings(gui.State.Remotes, gui.State.Modes.Diffing.Ref) }, @@ -116,11 +111,10 @@ func (gui *Gui) remoteBranchesListContext() *ListContext { Key: REMOTE_BRANCHES_CONTEXT_KEY, Kind: SIDE_CONTEXT, }, - GetItemsLength: func() int { return len(gui.State.RemoteBranches) }, - GetPanelState: func() IListPanelState { return gui.State.Panels.RemoteBranches }, - OnFocus: gui.handleRemoteBranchSelect, - Gui: gui, - ResetMainViewOriginOnFocus: true, + GetItemsLength: func() int { return len(gui.State.RemoteBranches) }, + GetPanelState: func() IListPanelState { return gui.State.Panels.RemoteBranches }, + OnFocus: gui.handleRemoteBranchSelect, + Gui: gui, GetDisplayStrings: func() [][]string { return presentation.GetRemoteBranchListDisplayStrings(gui.State.RemoteBranches, gui.State.Modes.Diffing.Ref) }, @@ -139,11 +133,10 @@ func (gui *Gui) tagsListContext() *ListContext { Key: TAGS_CONTEXT_KEY, Kind: SIDE_CONTEXT, }, - GetItemsLength: func() int { return len(gui.State.Tags) }, - GetPanelState: func() IListPanelState { return gui.State.Panels.Tags }, - OnFocus: gui.handleTagSelect, - Gui: gui, - ResetMainViewOriginOnFocus: true, + GetItemsLength: func() int { return len(gui.State.Tags) }, + GetPanelState: func() IListPanelState { return gui.State.Panels.Tags }, + OnFocus: gui.handleTagSelect, + Gui: gui, GetDisplayStrings: func() [][]string { return presentation.GetTagListDisplayStrings(gui.State.Tags, gui.State.Modes.Diffing.Ref) }, @@ -163,12 +156,11 @@ func (gui *Gui) branchCommitsListContext() *ListContext { Key: BRANCH_COMMITS_CONTEXT_KEY, Kind: SIDE_CONTEXT, }, - GetItemsLength: func() int { return len(gui.State.Commits) }, - GetPanelState: func() IListPanelState { return gui.State.Panels.Commits }, - OnFocus: gui.handleCommitSelect, - OnClickSelectedItem: gui.handleViewCommitFiles, - Gui: gui, - ResetMainViewOriginOnFocus: true, + GetItemsLength: func() int { return len(gui.State.Commits) }, + GetPanelState: func() IListPanelState { return gui.State.Panels.Commits }, + OnFocus: gui.handleCommitSelect, + OnClickSelectedItem: gui.handleViewCommitFiles, + Gui: gui, GetDisplayStrings: func() [][]string { return presentation.GetCommitListDisplayStrings( gui.State.Commits, @@ -194,11 +186,10 @@ func (gui *Gui) reflogCommitsListContext() *ListContext { Key: REFLOG_COMMITS_CONTEXT_KEY, Kind: SIDE_CONTEXT, }, - GetItemsLength: func() int { return len(gui.State.FilteredReflogCommits) }, - GetPanelState: func() IListPanelState { return gui.State.Panels.ReflogCommits }, - OnFocus: gui.handleReflogCommitSelect, - Gui: gui, - ResetMainViewOriginOnFocus: true, + GetItemsLength: func() int { return len(gui.State.FilteredReflogCommits) }, + GetPanelState: func() IListPanelState { return gui.State.Panels.ReflogCommits }, + OnFocus: gui.handleReflogCommitSelect, + Gui: gui, GetDisplayStrings: func() [][]string { return presentation.GetReflogCommitListDisplayStrings( gui.State.FilteredReflogCommits, @@ -224,11 +215,10 @@ func (gui *Gui) subCommitsListContext() *ListContext { Key: SUB_COMMITS_CONTEXT_KEY, Kind: SIDE_CONTEXT, }, - GetItemsLength: func() int { return len(gui.State.SubCommits) }, - GetPanelState: func() IListPanelState { return gui.State.Panels.SubCommits }, - OnFocus: gui.handleSubCommitSelect, - Gui: gui, - ResetMainViewOriginOnFocus: true, + GetItemsLength: func() int { return len(gui.State.SubCommits) }, + GetPanelState: func() IListPanelState { return gui.State.Panels.SubCommits }, + OnFocus: gui.handleSubCommitSelect, + Gui: gui, GetDisplayStrings: func() [][]string { return presentation.GetCommitListDisplayStrings( gui.State.SubCommits, @@ -253,11 +243,10 @@ func (gui *Gui) stashListContext() *ListContext { Key: STASH_CONTEXT_KEY, Kind: SIDE_CONTEXT, }, - GetItemsLength: func() int { return len(gui.State.StashEntries) }, - GetPanelState: func() IListPanelState { return gui.State.Panels.Stash }, - OnFocus: gui.handleStashEntrySelect, - Gui: gui, - ResetMainViewOriginOnFocus: true, + GetItemsLength: func() int { return len(gui.State.StashEntries) }, + GetPanelState: func() IListPanelState { return gui.State.Panels.Stash }, + OnFocus: gui.handleStashEntrySelect, + Gui: gui, GetDisplayStrings: func() [][]string { return presentation.GetStashEntryListDisplayStrings(gui.State.StashEntries, gui.State.Modes.Diffing.Ref) }, @@ -276,14 +265,13 @@ func (gui *Gui) commitFilesListContext() *ListContext { Key: COMMIT_FILES_CONTEXT_KEY, Kind: SIDE_CONTEXT, }, - GetItemsLength: func() int { return gui.State.CommitFileManager.GetItemsLength() }, - GetPanelState: func() IListPanelState { return gui.State.Panels.CommitFiles }, - OnFocus: gui.handleCommitFileSelect, - Gui: gui, - ResetMainViewOriginOnFocus: true, + GetItemsLength: func() int { return gui.State.CommitFileManager.GetItemsLength() }, + GetPanelState: func() IListPanelState { return gui.State.Panels.CommitFiles }, + OnFocus: gui.handleCommitFileSelect, + Gui: gui, GetDisplayStrings: func() [][]string { if gui.State.CommitFileManager.GetItemsLength() == 0 { - return [][]string{{utils.ColoredString("(none)", color.FgRed)}} + return [][]string{{style.FgRed.Sprint("(none)")}} } lines := gui.State.CommitFileManager.Render(gui.State.Modes.Diffing.Ref, gui.GitCommand.PatchManager) @@ -309,11 +297,10 @@ func (gui *Gui) submodulesListContext() *ListContext { Key: SUBMODULES_CONTEXT_KEY, Kind: SIDE_CONTEXT, }, - GetItemsLength: func() int { return len(gui.State.Submodules) }, - GetPanelState: func() IListPanelState { return gui.State.Panels.Submodules }, - OnFocus: gui.handleSubmoduleSelect, - Gui: gui, - ResetMainViewOriginOnFocus: true, + GetItemsLength: func() int { return len(gui.State.Submodules) }, + GetPanelState: func() IListPanelState { return gui.State.Panels.Submodules }, + OnFocus: gui.handleSubmoduleSelect, + Gui: gui, GetDisplayStrings: func() [][]string { return presentation.GetSubmoduleListDisplayStrings(gui.State.Submodules) }, @@ -332,11 +319,10 @@ func (gui *Gui) suggestionsListContext() *ListContext { Key: SUGGESTIONS_CONTEXT_KEY, Kind: PERSISTENT_POPUP, }, - GetItemsLength: func() int { return len(gui.State.Suggestions) }, - GetPanelState: func() IListPanelState { return gui.State.Panels.Suggestions }, - OnFocus: func() error { return nil }, - Gui: gui, - ResetMainViewOriginOnFocus: false, + GetItemsLength: func() int { return len(gui.State.Suggestions) }, + GetPanelState: func() IListPanelState { return gui.State.Panels.Suggestions }, + OnFocus: func() error { return nil }, + Gui: gui, GetDisplayStrings: func() [][]string { return presentation.GetSuggestionListDisplayStrings(gui.State.Suggestions) }, diff --git a/pkg/gui/main_panels.go b/pkg/gui/main_panels.go index 389a9d783..72af94b1d 100644 --- a/pkg/gui/main_panels.go +++ b/pkg/gui/main_panels.go @@ -29,7 +29,6 @@ type TaskKind int const ( RENDER_STRING TaskKind = iota RENDER_STRING_WITHOUT_SCROLL - RUN_FUNCTION RUN_COMMAND RUN_PTY ) @@ -97,19 +96,6 @@ func NewRunPtyTask(cmd *exec.Cmd) *runPtyTask { // return &runPtyTask{cmd: cmd, prefix: prefix} // } -type runFunctionTask struct { - f func(chan struct{}) error -} - -func (t *runFunctionTask) GetKind() TaskKind { - return RUN_FUNCTION -} - -// currently unused -// func (gui *Gui) createRunFunctionTask(f func(chan struct{}) error) *runFunctionTask { -// return &runFunctionTask{f: f} -// } - func (gui *Gui) runTaskForView(view *gocui.View, task updateTask) error { switch task.GetKind() { case RENDER_STRING: @@ -120,10 +106,6 @@ func (gui *Gui) runTaskForView(view *gocui.View, task updateTask) error { specificTask := task.(*renderStringWithoutScrollTask) return gui.newStringTaskWithoutScroll(view, specificTask.str) - case RUN_FUNCTION: - specificTask := task.(*runFunctionTask) - return gui.newTask(view, specificTask.f) - case RUN_COMMAND: specificTask := task.(*runCommandTask) return gui.newCmdTask(view, specificTask.cmd, specificTask.prefix) diff --git a/pkg/gui/menu_panel.go b/pkg/gui/menu_panel.go index fcb1f7a7b..af56e29b9 100644 --- a/pkg/gui/menu_panel.go +++ b/pkg/gui/menu_panel.go @@ -43,7 +43,7 @@ func (gui *Gui) getMenuOptions() map[string]string { } func (gui *Gui) handleMenuClose() error { - return gui.returnFromContext() + return gui.returnFromContextSync() } type createMenuOptions struct { diff --git a/pkg/gui/merge_panel.go b/pkg/gui/merge_panel.go index 51376ccf8..9fcd475c8 100644 --- a/pkg/gui/merge_panel.go +++ b/pkg/gui/merge_panel.go @@ -14,18 +14,18 @@ import ( "github.com/jesseduffield/lazygit/pkg/gui/mergeconflicts" ) -func (gui *Gui) handleSelectTop() error { +func (gui *Gui) handleSelectPrevConflictHunk() error { return gui.withMergeConflictLock(func() error { gui.takeOverMergeConflictScrolling() - gui.State.Panels.Merging.SelectTopOption() + gui.State.Panels.Merging.SelectPrevConflictHunk() return gui.refreshMergePanel() }) } -func (gui *Gui) handleSelectBottom() error { +func (gui *Gui) handleSelectNextConflictHunk() error { return gui.withMergeConflictLock(func() error { gui.takeOverMergeConflictScrolling() - gui.State.Panels.Merging.SelectBottomOption() + gui.State.Panels.Merging.SelectNextConflictHunk() return gui.refreshMergePanel() }) } @@ -95,11 +95,11 @@ func (gui *Gui) handlePickHunk() error { }) } -func (gui *Gui) handlePickBothHunks() error { +func (gui *Gui) handlePickAllHunks() error { return gui.withMergeConflictLock(func() error { gui.takeOverMergeConflictScrolling() - ok, err := gui.resolveConflict(mergeconflicts.BOTH) + ok, err := gui.resolveConflict(mergeconflicts.ALL) if err != nil { return err } @@ -135,10 +135,12 @@ func (gui *Gui) resolveConflict(selection mergeconflicts.Selection) (bool, error switch selection { case mergeconflicts.TOP: logStr = "Picking top hunk" + case mergeconflicts.MIDDLE: + logStr = "Picking middle hunk" case mergeconflicts.BOTTOM: logStr = "Picking bottom hunk" - case mergeconflicts.BOTH: - logStr = "Picking both hunks" + case mergeconflicts.ALL: + logStr = "Picking all hunks" } gui.OnRunCommand(oscommands.NewCmdLogEntry(logStr, "Resolve merge conflict", false)) return true, ioutil.WriteFile(gitFile.Name, []byte(output), 0644) @@ -231,7 +233,7 @@ func (gui *Gui) getMergingOptions() map[string]string { fmt.Sprintf("%s %s", gui.getKeyDisplay(keybindingConfig.Universal.PrevItem), gui.getKeyDisplay(keybindingConfig.Universal.NextItem)): gui.Tr.LcSelectHunk, fmt.Sprintf("%s %s", gui.getKeyDisplay(keybindingConfig.Universal.PrevBlock), gui.getKeyDisplay(keybindingConfig.Universal.NextBlock)): gui.Tr.LcNavigateConflicts, gui.getKeyDisplay(keybindingConfig.Universal.Select): gui.Tr.LcPickHunk, - gui.getKeyDisplay(keybindingConfig.Main.PickBothHunks): gui.Tr.LcPickBothHunks, + gui.getKeyDisplay(keybindingConfig.Main.PickBothHunks): gui.Tr.LcPickAllHunks, gui.getKeyDisplay(keybindingConfig.Universal.Undo): gui.Tr.LcUndo, } } diff --git a/pkg/gui/mergeconflicts/find_conflicts.go b/pkg/gui/mergeconflicts/find_conflicts.go index e88415959..80e487f85 100644 --- a/pkg/gui/mergeconflicts/find_conflicts.go +++ b/pkg/gui/mergeconflicts/find_conflicts.go @@ -12,7 +12,8 @@ type LineType int const ( START LineType = iota - MIDDLE + ANCESTOR + TARGET END NOT_A_MARKER ) @@ -28,12 +29,20 @@ func findConflicts(content string) []*mergeConflict { for i, line := range utils.SplitLines(content) { switch determineLineType(line) { case START: - newConflict = &mergeConflict{start: i} - case MIDDLE: - newConflict.middle = i + newConflict = &mergeConflict{start: i, ancestor: -1} + case ANCESTOR: + if newConflict != nil { + newConflict.ancestor = i + } + case TARGET: + if newConflict != nil { + newConflict.target = i + } case END: - newConflict.end = i - conflicts = append(conflicts, newConflict) + if newConflict != nil { + newConflict.end = i + conflicts = append(conflicts, newConflict) + } // reset value to avoid any possible silent mutations in further iterations newConflict = nil default: @@ -50,8 +59,10 @@ func determineLineType(line string) LineType { switch { case strings.HasPrefix(trimmedLine, "<<<<<<< "): return START + case strings.HasPrefix(trimmedLine, "||||||| "): + return ANCESTOR case trimmedLine == "=======": - return MIDDLE + return TARGET case strings.HasPrefix(trimmedLine, ">>>>>>> "): return END default: diff --git a/pkg/gui/mergeconflicts/find_conflicts_test.go b/pkg/gui/mergeconflicts/find_conflicts_test.go index c0a8e3e5b..bcc70ce73 100644 --- a/pkg/gui/mergeconflicts/find_conflicts_test.go +++ b/pkg/gui/mergeconflicts/find_conflicts_test.go @@ -43,12 +43,16 @@ func TestDetermineLineType(t *testing.T) { }, { line: "=======", - expected: MIDDLE, + expected: TARGET, }, { line: ">>>>>>> blah", expected: END, }, + { + line: "||||||| adf33b9", + expected: ANCESTOR, + }, } for _, s := range scenarios { diff --git a/pkg/gui/mergeconflicts/merge_conflict.go b/pkg/gui/mergeconflicts/merge_conflict.go new file mode 100644 index 000000000..e6b617f57 --- /dev/null +++ b/pkg/gui/mergeconflicts/merge_conflict.go @@ -0,0 +1,78 @@ +package mergeconflicts + +// mergeConflict : A git conflict with a start, ancestor (if exists), target, and end corresponding to line +// numbers in the file where the conflict markers appear. +// If no ancestor is present (i.e. we're not using the diff3 algorithm), then +// the `ancestor` field's value will be -1 +type mergeConflict struct { + start int + ancestor int + target int + end int +} + +func (c *mergeConflict) hasAncestor() bool { + return c.ancestor >= 0 +} + +func (c *mergeConflict) isMarkerLine(i int) bool { + return i == c.start || + i == c.ancestor || + i == c.target || + i == c.end +} + +type Selection int + +const ( + TOP Selection = iota + MIDDLE + BOTTOM + ALL +) + +func (s Selection) isIndexToKeep(conflict *mergeConflict, i int) bool { + // we're only handling one conflict at a time so any lines outside this + // conflict we'll keep + if i < conflict.start || conflict.end < i { + return true + } + + if conflict.isMarkerLine(i) { + return false + } + + return s.selected(conflict, i) +} + +func (s Selection) bounds(c *mergeConflict) (int, int) { + switch s { + case TOP: + if c.hasAncestor() { + return c.start, c.ancestor + } else { + return c.start, c.target + } + case MIDDLE: + return c.ancestor, c.target + case BOTTOM: + return c.target, c.end + case ALL: + return c.start, c.end + } + + panic("unexpected selection for merge conflict") +} + +func (s Selection) selected(c *mergeConflict, idx int) bool { + start, end := s.bounds(c) + return start < idx && idx < end +} + +func availableSelections(c *mergeConflict) []Selection { + if c.hasAncestor() { + return []Selection{TOP, MIDDLE, BOTTOM} + } else { + return []Selection{TOP, BOTTOM} + } +} diff --git a/pkg/gui/mergeconflicts/rendering.go b/pkg/gui/mergeconflicts/rendering.go index 5de6eda93..5b44f2a14 100644 --- a/pkg/gui/mergeconflicts/rendering.go +++ b/pkg/gui/mergeconflicts/rendering.go @@ -3,7 +3,7 @@ package mergeconflicts import ( "bytes" - "github.com/fatih/color" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/theme" "github.com/jesseduffield/lazygit/pkg/utils" ) @@ -15,19 +15,18 @@ func ColoredConflictFile(content string, state *State, hasFocus bool) string { conflict, remainingConflicts := shiftConflict(state.conflicts) var outputBuffer bytes.Buffer for i, line := range utils.SplitLines(content) { - colourAttr := theme.DefaultTextColor - if i == conflict.start || i == conflict.middle || i == conflict.end { - colourAttr = color.FgRed + textStyle := theme.DefaultTextColor + if conflict.isMarkerLine(i) { + textStyle = style.FgRed } - colour := color.New(colourAttr) - if hasFocus && state.conflictIndex < len(state.conflicts) && *state.conflicts[state.conflictIndex] == *conflict && shouldHighlightLine(i, conflict, state.conflictTop) { - colour.Add(color.Bold) - colour.Add(theme.SelectedRangeBgColor) + + if hasFocus && state.conflictIndex < len(state.conflicts) && *state.conflicts[state.conflictIndex] == *conflict && shouldHighlightLine(i, conflict, state.Selection()) { + textStyle = textStyle.MergeStyle(theme.SelectedRangeBgColor).SetBold() } if i == conflict.end && len(remainingConflicts) > 0 { conflict, remainingConflicts = shiftConflict(remainingConflicts) } - outputBuffer.WriteString(utils.ColoredStringDirect(line, colour) + "\n") + outputBuffer.WriteString(textStyle.Sprint(line) + "\n") } return outputBuffer.String() } @@ -36,6 +35,7 @@ func shiftConflict(conflicts []*mergeConflict) (*mergeConflict, []*mergeConflict return conflicts[0], conflicts[1:] } -func shouldHighlightLine(index int, conflict *mergeConflict, top bool) bool { - return (index >= conflict.start && index <= conflict.middle && top) || (index >= conflict.middle && index <= conflict.end && !top) +func shouldHighlightLine(index int, conflict *mergeConflict, selection Selection) bool { + selectionStart, selectionEnd := selection.bounds(conflict) + return index >= selectionStart && index <= selectionEnd } diff --git a/pkg/gui/mergeconflicts/state.go b/pkg/gui/mergeconflicts/state.go index 9d8320ffb..f202cf772 100644 --- a/pkg/gui/mergeconflicts/state.go +++ b/pkg/gui/mergeconflicts/state.go @@ -7,58 +7,60 @@ import ( "github.com/jesseduffield/lazygit/pkg/utils" ) -type Selection int - -const ( - TOP Selection = iota - BOTTOM - BOTH -) - -// mergeConflict : A git conflict with a start middle and end corresponding to line -// numbers in the file where the conflict markers appear -type mergeConflict struct { - start int - middle int - end int -} - type State struct { sync.Mutex + + conflicts []*mergeConflict + // this is the index of the above `conflicts` field which is currently selected conflictIndex int - conflictTop bool - conflicts []*mergeConflict - EditHistory *stack.Stack + + // this is the index of the selected conflict's available selections slice e.g. [TOP, MIDDLE, BOTTOM] + // We use this to know which hunk of the conflict is selected. + selectionIndex int + + // this allows us to undo actions + EditHistory *stack.Stack } func NewState() *State { return &State{ - Mutex: sync.Mutex{}, - conflictIndex: 0, - conflictTop: true, - conflicts: []*mergeConflict{}, - EditHistory: stack.New(), + Mutex: sync.Mutex{}, + conflictIndex: 0, + selectionIndex: 0, + conflicts: []*mergeConflict{}, + EditHistory: stack.New(), } } -func (s *State) SelectTopOption() { - s.conflictTop = true +func (s *State) setConflictIndex(index int) { + if len(s.conflicts) == 0 { + s.conflictIndex = 0 + } else { + s.conflictIndex = clamp(index, 0, len(s.conflicts)-1) + } + s.setSelectionIndex(s.selectionIndex) } -func (s *State) SelectBottomOption() { - s.conflictTop = false +func (s *State) setSelectionIndex(index int) { + if selections := s.availableSelections(); len(selections) != 0 { + s.selectionIndex = clamp(index, 0, len(selections)-1) + } +} + +func (s *State) SelectNextConflictHunk() { + s.setSelectionIndex(s.selectionIndex + 1) +} + +func (s *State) SelectPrevConflictHunk() { + s.setSelectionIndex(s.selectionIndex - 1) } func (s *State) SelectNextConflict() { - if s.conflictIndex < len(s.conflicts)-1 { - s.conflictIndex++ - } + s.setConflictIndex(s.conflictIndex + 1) } func (s *State) SelectPrevConflict() { - if s.conflictIndex > 0 { - s.conflictIndex-- - } + s.setConflictIndex(s.conflictIndex - 1) } func (s *State) PushFileSnapshot(content string) { @@ -87,12 +89,7 @@ func (s *State) SetConflictsFromCat(cat string) { func (s *State) setConflicts(conflicts []*mergeConflict) { s.conflicts = conflicts - - if s.conflictIndex > len(s.conflicts)-1 { - s.conflictIndex = len(s.conflicts) - 1 - } else if s.conflictIndex < 0 { - s.conflictIndex = 0 - } + s.setConflictIndex(s.conflictIndex) } func (s *State) NoConflicts() bool { @@ -100,11 +97,17 @@ func (s *State) NoConflicts() bool { } func (s *State) Selection() Selection { - if s.conflictTop { - return TOP - } else { - return BOTTOM + if selections := s.availableSelections(); len(selections) > 0 { + return selections[s.selectionIndex] } + return TOP +} + +func (s *State) availableSelections() []Selection { + if conflict := s.currentConflict(); conflict != nil { + return availableSelections(conflict) + } + return nil } func (s *State) IsFinalConflict() bool { @@ -116,10 +119,13 @@ func (s *State) Reset() { } func (s *State) GetConflictMiddle() int { - return s.currentConflict().middle + return s.currentConflict().target } -func (s *State) ContentAfterConflictResolve(path string, selection Selection) (bool, string, error) { +func (s *State) ContentAfterConflictResolve( + path string, + selection Selection, +) (bool, string, error) { conflict := s.currentConflict() if conflict == nil { return false, "", nil @@ -127,7 +133,7 @@ func (s *State) ContentAfterConflictResolve(path string, selection Selection) (b content := "" err := utils.ForEachLineInFile(path, func(line string, i int) { - if !isIndexToDelete(i, conflict, selection) { + if selection.isIndexToKeep(conflict, i) { content += line } }) @@ -139,15 +145,11 @@ func (s *State) ContentAfterConflictResolve(path string, selection Selection) (b return true, content, nil } -func isIndexToDelete(i int, conflict *mergeConflict, selection Selection) bool { - isMarkerLine := - i == conflict.middle || - i == conflict.start || - i == conflict.end - - isUnwantedContent := - (selection == BOTTOM && conflict.start < i && i < conflict.middle) || - (selection == TOP && conflict.middle < i && i < conflict.end) - - return isMarkerLine || isUnwantedContent +func clamp(x int, min int, max int) int { + if x < min { + return min + } else if x > max { + return max + } + return x } diff --git a/pkg/gui/mergeconflicts/state_test.go b/pkg/gui/mergeconflicts/state_test.go index a71d05a7a..861833d32 100644 --- a/pkg/gui/mergeconflicts/state_test.go +++ b/pkg/gui/mergeconflicts/state_test.go @@ -58,37 +58,57 @@ bar ======= baz >>>>>>> branch + +<<<<<<< HEAD +foo +||||||| fffffff +bar +======= +baz +>>>>>>> branch `, expected: []*mergeConflict{ { - start: 0, - middle: 2, - end: 4, + start: 0, + ancestor: -1, + target: 2, + end: 4, }, { - start: 6, - middle: 9, - end: 11, + start: 6, + ancestor: -1, + target: 9, + end: 11, }, { - start: 13, - middle: 15, - end: 17, + start: 13, + ancestor: -1, + target: 15, + end: 17, }, { - start: 19, - middle: 21, - end: 23, + start: 19, + ancestor: -1, + target: 21, + end: 23, }, { - start: 25, - middle: 27, - end: 29, + start: 25, + ancestor: -1, + target: 27, + end: 29, }, { - start: 31, - middle: 34, - end: 36, + start: 31, + ancestor: -1, + target: 34, + end: 36, + }, + { + start: 38, + ancestor: 40, + target: 42, + end: 44, }, }, }, diff --git a/pkg/gui/modes.go b/pkg/gui/modes.go index f97e050cf..af8977989 100644 --- a/pkg/gui/modes.go +++ b/pkg/gui/modes.go @@ -1,10 +1,7 @@ package gui import ( - "fmt" - - "github.com/fatih/color" - "github.com/jesseduffield/lazygit/pkg/utils" + "github.com/jesseduffield/lazygit/pkg/gui/style" ) type modeStatus struct { @@ -18,9 +15,11 @@ func (gui *Gui) modeStatuses() []modeStatus { { isActive: gui.State.Modes.Diffing.Active, description: func() string { - return utils.ColoredString( - fmt.Sprintf("%s %s %s", gui.Tr.LcShowingGitDiff, "git diff "+gui.diffStr(), utils.ColoredString(gui.Tr.ResetInParentheses, color.Underline)), - color.FgMagenta, + return style.FgMagenta.Sprintf( + "%s %s %s", + gui.Tr.LcShowingGitDiff, + "git diff "+gui.diffStr(), + style.AttrUnderline.Sprint(gui.Tr.ResetInParentheses), ) }, reset: gui.exitDiffMode, @@ -28,10 +27,10 @@ func (gui *Gui) modeStatuses() []modeStatus { { isActive: gui.GitCommand.PatchManager.Active, description: func() string { - return utils.ColoredString( - fmt.Sprintf("%s %s", gui.Tr.LcBuildingPatch, utils.ColoredString(gui.Tr.ResetInParentheses, color.Underline)), - color.FgYellow, - color.Bold, + return style.FgYellow.SetBold().Sprintf( + "%s %s", + gui.Tr.LcBuildingPatch, + style.AttrUnderline.Sprint(gui.Tr.ResetInParentheses), ) }, reset: gui.handleResetPatch, @@ -39,10 +38,11 @@ func (gui *Gui) modeStatuses() []modeStatus { { isActive: gui.State.Modes.Filtering.Active, description: func() string { - return utils.ColoredString( - fmt.Sprintf("%s '%s' %s", gui.Tr.LcFilteringBy, gui.State.Modes.Filtering.GetPath(), utils.ColoredString(gui.Tr.ResetInParentheses, color.Underline)), - color.FgRed, - color.Bold, + return style.FgRed.SetBold().Sprintf( + "%s '%s' %s", + gui.Tr.LcFilteringBy, + gui.State.Modes.Filtering.GetPath(), + style.AttrUnderline.Sprint(gui.Tr.ResetInParentheses), ) }, reset: gui.exitFilterMode, @@ -50,9 +50,10 @@ func (gui *Gui) modeStatuses() []modeStatus { { isActive: gui.State.Modes.CherryPicking.Active, description: func() string { - return utils.ColoredString( - fmt.Sprintf("%d commits copied %s", len(gui.State.Modes.CherryPicking.CherryPickedCommits), utils.ColoredString(gui.Tr.ResetInParentheses, color.Underline)), - color.FgCyan, + return style.FgCyan.Sprintf( + "%d commits copied %s", + len(gui.State.Modes.CherryPicking.CherryPickedCommits), + style.AttrUnderline.Sprint(gui.Tr.ResetInParentheses), ) }, reset: gui.exitCherryPickingMode, diff --git a/pkg/gui/options_menu_panel.go b/pkg/gui/options_menu_panel.go index 71e0e6685..172dd83c3 100644 --- a/pkg/gui/options_menu_panel.go +++ b/pkg/gui/options_menu_panel.go @@ -3,8 +3,8 @@ package gui import ( "strings" - "github.com/fatih/color" "github.com/jesseduffield/gocui" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/utils" ) @@ -35,14 +35,11 @@ func (gui *Gui) getBindings(v *gocui.View) []*Binding { } func (gui *Gui) displayDescription(binding *Binding) string { - commandColor := color.New(color.FgCyan) - menuColor := color.New(color.FgMagenta) - if binding.OpensMenu { - return menuColor.Sprintf("%s...", binding.Description) + return style.FgMagenta.Sprintf("%s...", binding.Description) } - return commandColor.Sprint(binding.Description) + return style.FgCyan.Sprint(binding.Description) } func (gui *Gui) handleCreateOptionsMenu() error { diff --git a/pkg/gui/presentation/branches.go b/pkg/gui/presentation/branches.go index 083f26e43..bb8beee1e 100644 --- a/pkg/gui/presentation/branches.go +++ b/pkg/gui/presentation/branches.go @@ -2,13 +2,11 @@ package presentation import ( "fmt" - "strconv" "strings" - "github.com/fatih/color" "github.com/jesseduffield/lazygit/pkg/commands/models" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/theme" - "github.com/jesseduffield/lazygit/pkg/utils" ) func GetBranchListDisplayStrings(branches []*models.Branch, fullDescription bool, diffName string, showGithub bool) [][]string { @@ -29,67 +27,52 @@ func getBranchDisplayStrings(b *models.Branch, fullDescription bool, diffed, sho displayName = b.DisplayName } - nameColorAttr := GetBranchColor(b.Name) + nameTextStyle := GetBranchTextStyle(b.Name) if diffed { - nameColorAttr = theme.DiffTerminalColor + nameTextStyle = theme.DiffTerminalColor } - coloredName := utils.ColoredString(displayName, nameColorAttr) + coloredName := nameTextStyle.Sprint(displayName) if b.IsTrackingRemote() { coloredName = fmt.Sprintf("%s %s", coloredName, ColoredBranchStatus(b)) } - recencyColor := color.FgCyan + recencyColor := style.FgCyan if b.Recency == " *" { - recencyColor = color.FgGreen - } - - res := []string{utils.ColoredString(b.Recency, recencyColor)} - if showGithub { - if b.PR != nil { - colour := color.FgMagenta // = state MERGED - switch b.PR.State { - case "OPEN": - colour = color.FgGreen - case "CLOSED": - colour = color.FgRed - } - res = append(res, utils.ColoredString("#"+strconv.Itoa(b.PR.Number), colour)) - } else { - res = append(res, "") - } + recencyColor = style.FgGreen } + res := []string{recencyColor.Sprint(b.Recency), coloredName} if fullDescription { - return append(res, coloredName, utils.ColoredString(b.UpstreamName, color.FgYellow)) + return append(res, style.FgYellow.Sprint(b.UpstreamName)) } - return append(res, coloredName) + return res } -// GetBranchColor branch color -func GetBranchColor(name string) color.Attribute { +// GetBranchTextStyle branch color +func GetBranchTextStyle(name string) style.TextStyle { branchType := strings.Split(name, "/")[0] switch branchType { case "feature": - return color.FgGreen + return style.FgGreen case "bugfix": - return color.FgYellow + return style.FgYellow case "hotfix": - return color.FgRed + return style.FgRed default: return theme.DefaultTextColor } } func ColoredBranchStatus(branch *models.Branch) string { - colour := color.FgYellow + colour := style.FgYellow if branch.MatchesUpstream() { - colour = color.FgGreen + colour = style.FgGreen } else if !branch.IsTrackingRemote() { - colour = color.FgRed + colour = style.FgRed } - return utils.ColoredString(BranchStatus(branch), colour) + return colour.Sprint(BranchStatus(branch)) } func BranchStatus(branch *models.Branch) string { diff --git a/pkg/gui/presentation/commit_files.go b/pkg/gui/presentation/commit_files.go index 7e9d4bdfa..3b68b9eeb 100644 --- a/pkg/gui/presentation/commit_files.go +++ b/pkg/gui/presentation/commit_files.go @@ -1,30 +1,23 @@ package presentation import ( - "github.com/fatih/color" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/patch" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/theme" "github.com/jesseduffield/lazygit/pkg/utils" ) func GetCommitFileLine(name string, diffName string, commitFile *models.CommitFile, status patch.PatchStatus) string { - yellow := color.New(color.FgYellow) - green := color.New(color.FgGreen) - defaultColor := color.New(theme.DefaultTextColor) - diffTerminalColor := color.New(theme.DiffTerminalColor) - - colour := defaultColor + colour := theme.DefaultTextColor if diffName == name { - colour = diffTerminalColor + colour = theme.DiffTerminalColor } else { switch status { - case patch.UNSELECTED: - colour = defaultColor case patch.WHOLE: - colour = green + colour = style.FgGreen case patch.PART: - colour = yellow + colour = style.FgYellow } } @@ -33,21 +26,21 @@ func GetCommitFileLine(name string, diffName string, commitFile *models.CommitFi return colour.Sprint(name) } - return utils.ColoredString(commitFile.ChangeStatus, getColorForChangeStatus(commitFile.ChangeStatus)) + " " + colour.Sprint(name) + return getColorForChangeStatus(commitFile.ChangeStatus).Sprint(commitFile.ChangeStatus) + " " + colour.Sprint(name) } -func getColorForChangeStatus(changeStatus string) color.Attribute { +func getColorForChangeStatus(changeStatus string) style.TextStyle { switch changeStatus { case "A": - return color.FgGreen + return style.FgGreen case "M", "R": - return color.FgYellow + return style.FgYellow case "D": - return color.FgRed + return style.FgRed case "C": - return color.FgCyan + return style.FgCyan case "T": - return color.FgMagenta + return style.FgMagenta default: return theme.DefaultTextColor } diff --git a/pkg/gui/presentation/commits.go b/pkg/gui/presentation/commits.go index a3fcdb834..de1d168dc 100644 --- a/pkg/gui/presentation/commits.go +++ b/pkg/gui/presentation/commits.go @@ -3,8 +3,8 @@ package presentation import ( "strings" - "github.com/fatih/color" "github.com/jesseduffield/lazygit/pkg/commands/models" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/theme" "github.com/jesseduffield/lazygit/pkg/utils" "github.com/kyokomi/emoji/v2" @@ -29,47 +29,35 @@ func GetCommitListDisplayStrings(commits []*models.Commit, fullDescription bool, } func getFullDescriptionDisplayStringsForCommit(c *models.Commit, cherryPickedCommitShaMap map[string]bool, diffed, parseEmoji bool) []string { - red := color.New(color.FgRed) - yellow := color.New(color.FgYellow) - green := color.New(color.FgGreen) - blue := color.New(color.FgBlue) - defaultColor := color.New(theme.DefaultTextColor) - diffedColor := color.New(theme.DiffTerminalColor) - - // for some reason, setting the background to blue pads out the other commits - // horizontally. For the sake of accessibility I'm considering this a feature, - // not a bug - copied := color.New(color.FgCyan, color.BgBlue) - - var shaColor *color.Color + shaColor := theme.DefaultTextColor switch c.Status { case "unpushed": - shaColor = red + shaColor = style.FgRed case "pushed": - shaColor = yellow + shaColor = style.FgYellow case "merged": - shaColor = green + shaColor = style.FgGreen case "rebasing": - shaColor = blue + shaColor = style.FgBlue case "reflog": - shaColor = blue - default: - shaColor = defaultColor + shaColor = style.FgBlue } if diffed { - shaColor = diffedColor + shaColor = theme.DiffTerminalColor } else if cherryPickedCommitShaMap[c.Sha] { - shaColor = copied + // for some reason, setting the background to blue pads out the other commits + // horizontally. For the sake of accessibility I'm considering this a feature, + // not a bug + shaColor = theme.CherryPickedCommitTextStyle } tagString := "" - secondColumnString := blue.Sprint(utils.UnixToDate(c.UnixTimestamp)) + secondColumnString := style.FgBlue.Sprint(utils.UnixToDate(c.UnixTimestamp)) if c.Action != "" { - secondColumnString = color.New(actionColorMap(c.Action)).Sprint(c.Action) + secondColumnString = actionColorMap(c.Action).Sprint(c.Action) } else if c.ExtraInfo != "" { - tagColor := color.New(color.FgMagenta, color.Bold) - tagString = utils.ColoredStringDirect(c.ExtraInfo, tagColor) + " " + tagString = style.FgMagenta.SetBold().Sprint(c.ExtraInfo) + " " } truncatedAuthor := utils.TruncateWithEllipsis(c.Author, 17) @@ -79,51 +67,44 @@ func getFullDescriptionDisplayStringsForCommit(c *models.Commit, cherryPickedCom name = emoji.Sprint(name) } - return []string{shaColor.Sprint(c.ShortSha()), secondColumnString, yellow.Sprint(truncatedAuthor), tagString + defaultColor.Sprint(name)} + return []string{ + shaColor.Sprint(c.ShortSha()), + secondColumnString, + style.FgYellow.Sprint(truncatedAuthor), + tagString + theme.DefaultTextColor.Sprint(name), + } } func getDisplayStringsForCommit(c *models.Commit, cherryPickedCommitShaMap map[string]bool, diffed, parseEmoji bool) []string { - red := color.New(color.FgRed) - yellow := color.New(color.FgYellow) - green := color.New(color.FgGreen) - blue := color.New(color.FgBlue) - defaultColor := color.New(theme.DefaultTextColor) - diffedColor := color.New(theme.DiffTerminalColor) - - // for some reason, setting the background to blue pads out the other commits - // horizontally. For the sake of accessibility I'm considering this a feature, - // not a bug - copied := color.New(color.FgCyan, color.BgBlue) - - var shaColor *color.Color + shaColor := theme.DefaultTextColor switch c.Status { case "unpushed": - shaColor = red + shaColor = style.FgRed case "pushed": - shaColor = yellow + shaColor = style.FgYellow case "merged": - shaColor = green + shaColor = style.FgGreen case "rebasing": - shaColor = blue + shaColor = style.FgBlue case "reflog": - shaColor = blue - default: - shaColor = defaultColor + shaColor = style.FgBlue } if diffed { - shaColor = diffedColor + shaColor = theme.DiffTerminalColor } else if cherryPickedCommitShaMap[c.Sha] { - shaColor = copied + // for some reason, setting the background to blue pads out the other commits + // horizontally. For the sake of accessibility I'm considering this a feature, + // not a bug + shaColor = theme.CherryPickedCommitTextStyle } actionString := "" tagString := "" if c.Action != "" { - actionString = color.New(actionColorMap(c.Action)).Sprint(utils.WithPadding(c.Action, 7)) + " " + actionString = actionColorMap(c.Action).Sprint(utils.WithPadding(c.Action, 7)) + " " } else if len(c.Tags) > 0 { - tagColor := color.New(color.FgMagenta, color.Bold) - tagString = utils.ColoredStringDirect(strings.Join(c.Tags, " "), tagColor) + " " + tagString = theme.DiffTerminalColor.SetBold().Sprint(strings.Join(c.Tags, " ")) + " " } name := c.Name @@ -131,20 +112,23 @@ func getDisplayStringsForCommit(c *models.Commit, cherryPickedCommitShaMap map[s name = emoji.Sprint(name) } - return []string{shaColor.Sprint(c.ShortSha()), actionString + tagString + defaultColor.Sprint(name)} -} - -func actionColorMap(str string) color.Attribute { - switch str { - case "pick": - return color.FgCyan - case "drop": - return color.FgRed - case "edit": - return color.FgGreen - case "fixup": - return color.FgMagenta - default: - return color.FgYellow + return []string{ + shaColor.Sprint(c.ShortSha()), + actionString + tagString + theme.DefaultTextColor.Sprint(name), + } +} + +func actionColorMap(str string) style.TextStyle { + switch str { + case "pick": + return style.FgCyan + case "drop": + return style.FgRed + case "edit": + return style.FgGreen + case "fixup": + return style.FgMagenta + default: + return style.FgYellow } } diff --git a/pkg/gui/presentation/files.go b/pkg/gui/presentation/files.go index 8b3aacf56..4d00b7e84 100644 --- a/pkg/gui/presentation/files.go +++ b/pkg/gui/presentation/files.go @@ -1,8 +1,8 @@ package presentation import ( - "github.com/fatih/color" "github.com/jesseduffield/lazygit/pkg/commands/models" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/theme" "github.com/jesseduffield/lazygit/pkg/utils" ) @@ -10,35 +10,30 @@ import ( func GetFileLine(hasUnstagedChanges bool, hasStagedChanges bool, name string, diffName string, submoduleConfigs []*models.SubmoduleConfig, file *models.File) string { // potentially inefficient to be instantiating these color // objects with each render - red := color.New(color.FgRed) - green := color.New(color.FgGreen) - diffColor := color.New(theme.DiffTerminalColor) - partiallyModifiedColor := color.New(color.FgYellow) + partiallyModifiedColor := style.FgYellow - var restColor *color.Color + restColor := style.FgGreen if name == diffName { - restColor = diffColor + restColor = theme.DiffTerminalColor } else if file == nil && hasStagedChanges && hasUnstagedChanges { restColor = partiallyModifiedColor } else if hasUnstagedChanges { - restColor = red - } else { - restColor = green + restColor = style.FgRed } output := "" if file != nil { // this is just making things look nice when the background attribute is 'reverse' firstChar := file.ShortStatus[0:1] - firstCharCl := green + firstCharCl := style.FgGreen if firstChar == "?" { - firstCharCl = red + firstCharCl = style.FgRed } else if firstChar == " " { firstCharCl = restColor } secondChar := file.ShortStatus[1:2] - secondCharCl := red + secondCharCl := style.FgRed if secondChar == " " { secondCharCl = restColor } @@ -51,7 +46,7 @@ func GetFileLine(hasUnstagedChanges bool, hasStagedChanges bool, name string, di output += restColor.Sprint(utils.EscapeSpecialChars(name)) if file != nil && file.IsSubmodule(submoduleConfigs) { - output += utils.ColoredString(" (submodule)", theme.DefaultTextColor) + output += theme.DefaultTextColor.Sprint(" (submodule)") } return output diff --git a/pkg/gui/presentation/reflog_commits.go b/pkg/gui/presentation/reflog_commits.go index 31a125e32..fd843d884 100644 --- a/pkg/gui/presentation/reflog_commits.go +++ b/pkg/gui/presentation/reflog_commits.go @@ -1,8 +1,8 @@ package presentation import ( - "github.com/fatih/color" "github.com/jesseduffield/lazygit/pkg/commands/models" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/theme" "github.com/jesseduffield/lazygit/pkg/utils" "github.com/kyokomi/emoji/v2" @@ -27,11 +27,9 @@ func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription } func coloredReflogSha(c *models.Commit, cherryPickedCommitShaMap map[string]bool) string { - var shaColor *color.Color + shaColor := style.FgBlue if cherryPickedCommitShaMap[c.Sha] { - shaColor = color.New(color.FgCyan, color.BgBlue) - } else { - shaColor = color.New(color.FgBlue) + shaColor = theme.CherryPickedCommitTextStyle } return shaColor.Sprint(c.ShortSha()) @@ -50,14 +48,12 @@ func getFullDescriptionDisplayStringsForReflogCommit(c *models.Commit, cherryPic return []string{ coloredReflogSha(c, cherryPickedCommitShaMap), - utils.ColoredString(utils.UnixToDate(c.UnixTimestamp), color.FgMagenta), - utils.ColoredString(name, colorAttr), + style.FgMagenta.Sprint(utils.UnixToDate(c.UnixTimestamp)), + colorAttr.Sprint(name), } } func getDisplayStringsForReflogCommit(c *models.Commit, cherryPickedCommitShaMap map[string]bool, diffed, parseEmoji bool) []string { - defaultColor := color.New(theme.DefaultTextColor) - name := c.Name if parseEmoji { name = emoji.Sprint(name) @@ -65,6 +61,6 @@ func getDisplayStringsForReflogCommit(c *models.Commit, cherryPickedCommitShaMap return []string{ coloredReflogSha(c, cherryPickedCommitShaMap), - defaultColor.Sprint(name), + theme.DefaultTextColor.Sprint(name), } } diff --git a/pkg/gui/presentation/remote_branches.go b/pkg/gui/presentation/remote_branches.go index 94eaaf20b..d8439acfe 100644 --- a/pkg/gui/presentation/remote_branches.go +++ b/pkg/gui/presentation/remote_branches.go @@ -3,7 +3,6 @@ package presentation import ( "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/theme" - "github.com/jesseduffield/lazygit/pkg/utils" ) func GetRemoteBranchListDisplayStrings(branches []*models.RemoteBranch, diffName string) [][]string { @@ -19,12 +18,10 @@ func GetRemoteBranchListDisplayStrings(branches []*models.RemoteBranch, diffName // getRemoteBranchDisplayStrings returns the display string of branch func getRemoteBranchDisplayStrings(b *models.RemoteBranch, diffed bool) []string { - nameColorAttr := GetBranchColor(b.Name) + textStyle := GetBranchTextStyle(b.Name) if diffed { - nameColorAttr = theme.DiffTerminalColor + textStyle = theme.DiffTerminalColor } - displayName := utils.ColoredString(b.Name, nameColorAttr) - - return []string{displayName} + return []string{textStyle.Sprint(b.Name)} } diff --git a/pkg/gui/presentation/remotes.go b/pkg/gui/presentation/remotes.go index 15a450891..a1e50fe2f 100644 --- a/pkg/gui/presentation/remotes.go +++ b/pkg/gui/presentation/remotes.go @@ -1,12 +1,9 @@ package presentation import ( - "fmt" - - "github.com/fatih/color" "github.com/jesseduffield/lazygit/pkg/commands/models" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/theme" - "github.com/jesseduffield/lazygit/pkg/utils" ) func GetRemoteListDisplayStrings(remotes []*models.Remote, diffName string) [][]string { @@ -24,10 +21,10 @@ func GetRemoteListDisplayStrings(remotes []*models.Remote, diffName string) [][] func getRemoteDisplayStrings(r *models.Remote, diffed bool) []string { branchCount := len(r.Branches) - nameColorAttr := theme.DefaultTextColor + textStyle := theme.DefaultTextColor if diffed { - nameColorAttr = theme.DiffTerminalColor + textStyle = theme.DiffTerminalColor } - return []string{utils.ColoredString(r.Name, nameColorAttr), utils.ColoredString(fmt.Sprintf("%d branches", branchCount), color.FgBlue)} + return []string{textStyle.Sprint(r.Name), style.FgBlue.Sprintf("%d branches", branchCount)} } diff --git a/pkg/gui/presentation/stash_entries.go b/pkg/gui/presentation/stash_entries.go index fbd153919..f15b35a9c 100644 --- a/pkg/gui/presentation/stash_entries.go +++ b/pkg/gui/presentation/stash_entries.go @@ -3,7 +3,6 @@ package presentation import ( "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/theme" - "github.com/jesseduffield/lazygit/pkg/utils" ) func GetStashEntryListDisplayStrings(stashEntries []*models.StashEntry, diffName string) [][]string { @@ -19,9 +18,9 @@ func GetStashEntryListDisplayStrings(stashEntries []*models.StashEntry, diffName // getStashEntryDisplayStrings returns the display string of branch func getStashEntryDisplayStrings(s *models.StashEntry, diffed bool) []string { - attr := theme.DefaultTextColor + textStyle := theme.DefaultTextColor if diffed { - attr = theme.DiffTerminalColor + textStyle = theme.DiffTerminalColor } - return []string{utils.ColoredString(s.Name, attr)} + return []string{textStyle.Sprint(s.Name)} } diff --git a/pkg/gui/presentation/submodules.go b/pkg/gui/presentation/submodules.go index 6b42d76f0..2d131ed8f 100644 --- a/pkg/gui/presentation/submodules.go +++ b/pkg/gui/presentation/submodules.go @@ -3,7 +3,6 @@ package presentation import ( "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/theme" - "github.com/jesseduffield/lazygit/pkg/utils" ) func GetSubmoduleListDisplayStrings(submodules []*models.SubmoduleConfig) [][]string { @@ -17,5 +16,5 @@ func GetSubmoduleListDisplayStrings(submodules []*models.SubmoduleConfig) [][]st } func getSubmoduleDisplayStrings(s *models.SubmoduleConfig) []string { - return []string{utils.ColoredString(s.Name, theme.DefaultTextColor)} + return []string{theme.DefaultTextColor.Sprint(s.Name)} } diff --git a/pkg/gui/presentation/tags.go b/pkg/gui/presentation/tags.go index 04deb6423..4754c4bef 100644 --- a/pkg/gui/presentation/tags.go +++ b/pkg/gui/presentation/tags.go @@ -3,7 +3,6 @@ package presentation import ( "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/theme" - "github.com/jesseduffield/lazygit/pkg/utils" ) func GetTagListDisplayStrings(tags []*models.Tag, diffName string) [][]string { @@ -19,9 +18,9 @@ func GetTagListDisplayStrings(tags []*models.Tag, diffName string) [][]string { // getTagDisplayStrings returns the display string of branch func getTagDisplayStrings(t *models.Tag, diffed bool) []string { - attr := theme.DefaultTextColor + textStyle := theme.DefaultTextColor if diffed { - attr = theme.DiffTerminalColor + textStyle = theme.DiffTerminalColor } - return []string{utils.ColoredString(t.Name, attr)} + return []string{textStyle.Sprint(t.Name)} } diff --git a/pkg/gui/pty.go b/pkg/gui/pty.go index 67182d9bc..ff6892d73 100644 --- a/pkg/gui/pty.go +++ b/pkg/gui/pty.go @@ -1,9 +1,11 @@ +//go:build !windows // +build !windows package gui import ( "os/exec" + "strings" "github.com/creack/pty" "github.com/jesseduffield/gocui" @@ -39,6 +41,8 @@ func (gui *Gui) newPtyTask(view *gocui.View, cmd *exec.Cmd, prefix string) error return gui.newCmdTask(view, cmd, prefix) } + cmdStr := strings.Join(cmd.Args, " ") + cmd.Env = append(cmd.Env, "GIT_PAGER="+pager) _, height := view.Size() @@ -61,7 +65,7 @@ func (gui *Gui) newPtyTask(view *gocui.View, cmd *exec.Cmd, prefix string) error return err } - if err := manager.NewTask(manager.NewCmdTask(ptmx, cmd, prefix, height+oy+10, onClose)); err != nil { + if err := manager.NewTask(manager.NewCmdTask(ptmx, cmd, prefix, height+oy+10, onClose), cmdStr); err != nil { return err } diff --git a/pkg/gui/pty_windows.go b/pkg/gui/pty_windows.go index a8c554e04..dfb2fb307 100644 --- a/pkg/gui/pty_windows.go +++ b/pkg/gui/pty_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package gui diff --git a/pkg/gui/pull_request_menu_panel.go b/pkg/gui/pull_request_menu_panel.go index 83665e197..85888a58e 100644 --- a/pkg/gui/pull_request_menu_panel.go +++ b/pkg/gui/pull_request_menu_panel.go @@ -29,7 +29,7 @@ func (gui *Gui) createOrOpenPullRequestMenu(selectedBranch *models.Branch, check onPress: func() error { return gui.prompt(promptOpts{ title: branch.Name + " →", - findSuggestionsFunc: gui.findBranchNameSuggestions, + findSuggestionsFunc: gui.getBranchNameSuggestionsFunc(), handleConfirm: func(targetBranchName string) error { return gui.createPullRequest(branch.Name, targetBranchName) }}, diff --git a/pkg/gui/rebase_options_panel.go b/pkg/gui/rebase_options_panel.go index a50608b67..d554bc746 100644 --- a/pkg/gui/rebase_options_panel.go +++ b/pkg/gui/rebase_options_panel.go @@ -63,6 +63,23 @@ func (gui *Gui) genericMergeCommand(command string) error { return nil } +var conflictStrings = []string{ + "Failed to merge in the changes", + "When you have resolved this problem", + "fix conflicts", + "Resolve all conflicts manually", +} + +func isMergeConflictErr(errStr string) bool { + for _, str := range conflictStrings { + if strings.Contains(errStr, str) { + return true + } + } + + return false +} + func (gui *Gui) handleGenericMergeCommandResult(result error) error { if err := gui.refreshSidePanels(refreshOptions{mode: ASYNC}); err != nil { return err @@ -76,7 +93,7 @@ func (gui *Gui) handleGenericMergeCommandResult(result error) error { } else if strings.Contains(result.Error(), "No rebase in progress?") { // assume in this case that we're already done return nil - } else if strings.Contains(result.Error(), "When you have resolved this problem") || strings.Contains(result.Error(), "fix conflicts") || strings.Contains(result.Error(), "Resolve all conflicts manually") { + } else if isMergeConflictErr(result.Error()) { return gui.ask(askOpts{ title: gui.Tr.FoundConflictsTitle, prompt: gui.Tr.FoundConflicts, diff --git a/pkg/gui/recent_repos_panel.go b/pkg/gui/recent_repos_panel.go index eb646a752..5460a2155 100644 --- a/pkg/gui/recent_repos_panel.go +++ b/pkg/gui/recent_repos_panel.go @@ -4,17 +4,18 @@ import ( "os" "path/filepath" - "github.com/fatih/color" "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/commands" + "github.com/jesseduffield/lazygit/pkg/commands/git_config" "github.com/jesseduffield/lazygit/pkg/env" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/utils" ) func (gui *Gui) handleCreateRecentReposMenu() error { recentRepoPaths := gui.Config.GetAppState().RecentRepos reposCount := utils.Min(len(recentRepoPaths), 20) - yellow := color.New(color.FgMagenta) + // we won't show the current repo hence the -1 menuItems := make([]*menuItem, reposCount-1) for i, path := range recentRepoPaths[1:reposCount] { @@ -22,7 +23,7 @@ func (gui *Gui) handleCreateRecentReposMenu() error { menuItems[i] = &menuItem{ displayStrings: []string{ filepath.Base(path), - yellow.Sprint(path), + style.FgMagenta.Sprint(path), }, onPress: func() error { // if we were in a submodule, we want to forget about that stack of repos @@ -72,7 +73,7 @@ func (gui *Gui) dispatchSwitchToRepo(path string, reuse bool) error { return err } - newGitCommand, err := commands.NewGitCommand(gui.Log, gui.OSCommand, gui.Tr, gui.Config) + newGitCommand, err := commands.NewGitCommand(gui.Log, gui.OSCommand, gui.Tr, gui.Config, git_config.NewStdCachedGitConfig(gui.Log)) if err != nil { return err } diff --git a/pkg/gui/remote_branches_panel.go b/pkg/gui/remote_branches_panel.go index 23fcc32f6..a53a7470c 100644 --- a/pkg/gui/remote_branches_panel.go +++ b/pkg/gui/remote_branches_panel.go @@ -90,7 +90,7 @@ func (gui *Gui) handleSetBranchUpstream() error { prompt: message, handleConfirm: func() error { if err := gui.GitCommand.WithSpan(gui.Tr.Spans.SetBranchUpstream).SetBranchUpstream(selectedBranch.RemoteName, selectedBranch.Name, checkedOutBranch.Name); err != nil { - return err + return gui.surfaceError(err) } return gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{BRANCHES, REMOTES}}) diff --git a/pkg/gui/remotes_panel.go b/pkg/gui/remotes_panel.go index 740a58da3..29e723e38 100644 --- a/pkg/gui/remotes_panel.go +++ b/pkg/gui/remotes_panel.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - "github.com/fatih/color" "github.com/jesseduffield/lazygit/pkg/commands/models" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/utils" ) @@ -26,7 +26,7 @@ func (gui *Gui) handleRemoteSelect() error { if remote == nil { task = NewRenderStringTask("No remotes") } else { - task = NewRenderStringTask(fmt.Sprintf("%s\nUrls:\n%s", utils.ColoredString(remote.Name, color.FgGreen), strings.Join(remote.Urls, "\n"))) + task = NewRenderStringTask(fmt.Sprintf("%s\nUrls:\n%s", style.FgGreen.Sprint(remote.Name), strings.Join(remote.Urls, "\n"))) } return gui.refreshMainViews(refreshMainOpts{ diff --git a/pkg/gui/reset_menu_panel.go b/pkg/gui/reset_menu_panel.go index f1736e2c2..fc15d36de 100644 --- a/pkg/gui/reset_menu_panel.go +++ b/pkg/gui/reset_menu_panel.go @@ -3,8 +3,8 @@ package gui import ( "fmt" - "github.com/fatih/color" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" + "github.com/jesseduffield/lazygit/pkg/gui/style" ) func (gui *Gui) resetToRef(ref string, strength string, span string, options oscommands.RunCommandOptions) error { @@ -36,9 +36,7 @@ func (gui *Gui) createResetMenu(ref string) error { menuItems[i] = &menuItem{ displayStrings: []string{ fmt.Sprintf("%s reset", strength), - color.New(color.FgRed).Sprint( - fmt.Sprintf("reset --%s %s", strength, ref), - ), + style.FgRed.Sprintf("reset --%s %s", strength, ref), }, onPress: func() error { return gui.resetToRef(ref, strength, "Reset", oscommands.RunCommandOptions{}) diff --git a/pkg/gui/searching.go b/pkg/gui/searching.go index 3c6f1b154..9d7c1ec84 100644 --- a/pkg/gui/searching.go +++ b/pkg/gui/searching.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/jesseduffield/lazygit/pkg/theme" - "github.com/jesseduffield/lazygit/pkg/utils" ) func (gui *Gui) handleOpenSearch(viewName string) error { @@ -16,7 +15,7 @@ func (gui *Gui) handleOpenSearch(viewName string) error { gui.State.Searching.isSearching = true gui.State.Searching.view = view - gui.renderString(gui.Views.Search, "") + gui.Views.Search.ClearTextArea() if err := gui.pushContext(gui.State.Contexts.Search); err != nil { return err @@ -26,7 +25,7 @@ func (gui *Gui) handleOpenSearch(viewName string) error { } func (gui *Gui) handleSearch() error { - gui.State.Searching.searchString = gui.Views.Search.Buffer() + gui.State.Searching.searchString = gui.Views.Search.TextArea.GetContent() if err := gui.returnFromContext(); err != nil { return err } @@ -53,10 +52,7 @@ func (gui *Gui) onSelectItemWrapper(innerFunc func(int) error) func(int, int, in fmt.Sprintf( "no matches for '%s' %s", gui.State.Searching.searchString, - utils.ColoredString( - fmt.Sprintf("%s: exit search mode", gui.getKeyDisplay(keybindingConfig.Universal.Return)), - theme.OptionsFgColor, - ), + theme.OptionsFgColor.Sprintf("%s: exit search mode", gui.getKeyDisplay(keybindingConfig.Universal.Return)), ), ) return nil @@ -68,14 +64,11 @@ func (gui *Gui) onSelectItemWrapper(innerFunc func(int) error) func(int, int, in gui.State.Searching.searchString, index+1, total, - utils.ColoredString( - fmt.Sprintf( - "%s: next match, %s: previous match, %s: exit search mode", - gui.getKeyDisplay(keybindingConfig.Universal.NextMatch), - gui.getKeyDisplay(keybindingConfig.Universal.PrevMatch), - gui.getKeyDisplay(keybindingConfig.Universal.Return), - ), - theme.OptionsFgColor, + theme.OptionsFgColor.Sprintf( + "%s: next match, %s: previous match, %s: exit search mode", + gui.getKeyDisplay(keybindingConfig.Universal.NextMatch), + gui.getKeyDisplay(keybindingConfig.Universal.PrevMatch), + gui.getKeyDisplay(keybindingConfig.Universal.Return), ), ), ) diff --git a/pkg/gui/status_panel.go b/pkg/gui/status_panel.go index adf1651ea..0adc4d383 100644 --- a/pkg/gui/status_panel.go +++ b/pkg/gui/status_panel.go @@ -1,13 +1,14 @@ package gui import ( + "errors" "fmt" "strings" - "github.com/fatih/color" "github.com/jesseduffield/lazygit/pkg/commands" "github.com/jesseduffield/lazygit/pkg/constants" "github.com/jesseduffield/lazygit/pkg/gui/presentation" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/utils" ) @@ -28,10 +29,10 @@ func (gui *Gui) refreshStatus() { } if gui.GitCommand.WorkingTreeState() != commands.REBASE_MODE_NORMAL { - status += utils.ColoredString(fmt.Sprintf("(%s) ", gui.GitCommand.WorkingTreeState()), color.FgYellow) + status += style.FgYellow.Sprintf("(%s) ", gui.GitCommand.WorkingTreeState()) } - name := utils.ColoredString(currentBranch.Name, presentation.GetBranchColor(currentBranch.Name)) + name := presentation.GetBranchTextStyle(currentBranch.Name).Sprint(currentBranch.Name) repoName := utils.GetCurrentRepoName() status += fmt.Sprintf("%s → %s ", repoName, name) @@ -94,8 +95,6 @@ func (gui *Gui) handleStatusSelect() error { return nil } - magenta := color.New(color.FgMagenta) - dashboardString := strings.Join( []string{ lazygitTitle(), @@ -105,7 +104,7 @@ func (gui *Gui) handleStatusSelect() error { fmt.Sprintf("Tutorial: %s", constants.Links.Docs.Tutorial), fmt.Sprintf("Raise an Issue: %s", constants.Links.Issues), fmt.Sprintf("Release Notes: %s", constants.Links.Releases), - magenta.Sprintf("Become a sponsor (github is matching all donations for 12 months): %s", constants.Links.Donate), // caffeine ain't free + style.FgMagenta.Sprintf("Become a sponsor (github is matching all donations for 12 months): %s", constants.Links.Donate), // caffeine ain't free }, "\n\n") return gui.refreshMainViews(refreshMainOpts{ @@ -116,13 +115,34 @@ func (gui *Gui) handleStatusSelect() error { }) } +func (gui *Gui) askForConfigFile(action func(file string) error) error { + confPaths := gui.Config.GetUserConfigPaths() + switch len(confPaths) { + case 0: + return errors.New(gui.Tr.NoConfigFileFoundErr) + case 1: + return action(confPaths[0]) + default: + menuItems := make([]*menuItem, len(confPaths)) + for i, file := range confPaths { + i := i + menuItems[i] = &menuItem{ + displayString: file, + onPress: func() error { + return action(confPaths[i]) + }, + } + } + return gui.createMenu(gui.Tr.SelectConfigFile, menuItems, createMenuOptions{}) + } +} + func (gui *Gui) handleOpenConfig() error { - return gui.openFile(gui.Config.GetUserConfigPath()) + return gui.askForConfigFile(gui.openFile) } func (gui *Gui) handleEditConfig() error { - filename := gui.Config.GetUserConfigPath() - return gui.editFile(filename) + return gui.askForConfigFile(gui.editFile) } func lazygitTitle() string { diff --git a/pkg/gui/style/basic_styles.go b/pkg/gui/style/basic_styles.go new file mode 100644 index 000000000..92b034f06 --- /dev/null +++ b/pkg/gui/style/basic_styles.go @@ -0,0 +1,63 @@ +package style + +import ( + "github.com/gookit/color" + "text/template" +) + +var ( + FgWhite = FromBasicFg(color.FgWhite) + FgLightWhite = FromBasicFg(color.FgLightWhite) + FgBlack = FromBasicFg(color.FgBlack) + FgBlackLighter = FromBasicFg(color.FgBlack.Light()) + FgCyan = FromBasicFg(color.FgCyan) + FgRed = FromBasicFg(color.FgRed) + FgGreen = FromBasicFg(color.FgGreen) + FgBlue = FromBasicFg(color.FgBlue) + FgYellow = FromBasicFg(color.FgYellow) + FgMagenta = FromBasicFg(color.FgMagenta) + + BgWhite = FromBasicBg(color.BgWhite) + BgBlack = FromBasicBg(color.BgBlack) + BgRed = FromBasicBg(color.BgRed) + BgGreen = FromBasicBg(color.BgGreen) + BgYellow = FromBasicBg(color.BgYellow) + BgBlue = FromBasicBg(color.BgBlue) + BgMagenta = FromBasicBg(color.BgMagenta) + BgCyan = FromBasicBg(color.BgCyan) + + AttrUnderline = New().SetUnderline() + AttrBold = New().SetBold() + + ColorMap = map[string]struct { + Foreground TextStyle + Background TextStyle + }{ + "default": {FgWhite, BgBlack}, + "black": {FgBlack, BgBlack}, + "red": {FgRed, BgRed}, + "green": {FgGreen, BgGreen}, + "yellow": {FgYellow, BgYellow}, + "blue": {FgBlue, BgBlue}, + "magenta": {FgMagenta, BgMagenta}, + "cyan": {FgCyan, BgCyan}, + "white": {FgWhite, BgWhite}, + } +) + +func FromBasicFg(fg color.Color) TextStyle { + return New().SetFg(NewBasicColor(fg)) +} + +func FromBasicBg(bg color.Color) TextStyle { + return New().SetBg(NewBasicColor(bg)) +} + +func TemplateFuncMapAddColors(m template.FuncMap) template.FuncMap { + for k, v := range ColorMap { + m[k] = v.Foreground.Sprint + } + m["underline"] = color.OpUnderscore.Sprint + m["bold"] = color.OpBold.Sprint + return m +} diff --git a/pkg/gui/style/color.go b/pkg/gui/style/color.go new file mode 100644 index 000000000..2b13c9236 --- /dev/null +++ b/pkg/gui/style/color.go @@ -0,0 +1,39 @@ +package style + +import "github.com/gookit/color" + +type Color struct { + rgb *color.RGBColor + basic *color.Color +} + +func NewRGBColor(cl color.RGBColor) Color { + c := Color{} + c.rgb = &cl + return c +} + +func NewBasicColor(cl color.Color) Color { + c := Color{} + c.basic = &cl + return c +} + +func (c Color) IsRGB() bool { + return c.rgb != nil +} + +func (c Color) ToRGB(isBg bool) Color { + if c.IsRGB() { + return c + } + + if isBg { + // We need to convert bg color to fg color + // This is a gookit/color bug, + // https://github.com/gookit/color/issues/39 + return NewRGBColor((*c.basic - 10).RGB()) + } + + return NewRGBColor(c.basic.RGB()) +} diff --git a/pkg/gui/style/decoration.go b/pkg/gui/style/decoration.go new file mode 100644 index 000000000..f6fedb879 --- /dev/null +++ b/pkg/gui/style/decoration.go @@ -0,0 +1,55 @@ +package style + +import "github.com/gookit/color" + +type Decoration struct { + bold bool + underline bool + reverse bool +} + +func (d *Decoration) SetBold() { + d.bold = true +} + +func (d *Decoration) SetUnderline() { + d.underline = true +} + +func (d *Decoration) SetReverse() { + d.reverse = true +} + +func (d Decoration) ToOpts() color.Opts { + opts := make([]color.Color, 0, 3) + + if d.bold { + opts = append(opts, color.OpBold) + } + + if d.underline { + opts = append(opts, color.OpUnderscore) + } + + if d.reverse { + opts = append(opts, color.OpReverse) + } + + return opts +} + +func (d Decoration) Merge(other Decoration) Decoration { + if other.bold { + d.bold = true + } + + if other.underline { + d.underline = true + } + + if other.reverse { + d.reverse = true + } + + return d +} diff --git a/pkg/gui/style/style_test.go b/pkg/gui/style/style_test.go new file mode 100644 index 000000000..cadd3c397 --- /dev/null +++ b/pkg/gui/style/style_test.go @@ -0,0 +1,211 @@ +package style + +import ( + "bytes" + "testing" + "text/template" + + "github.com/gookit/color" + "github.com/stretchr/testify/assert" + "github.com/xo/terminfo" +) + +func TestMerge(t *testing.T) { + type scenario struct { + name string + toMerge []TextStyle + expectedStyle TextStyle + expectedStr string + } + + // on CI we've got no color capability so we're forcing it here + color.ForceSetColorLevel(terminfo.ColorLevelMillions) + + fgRed := color.FgRed + bgRed := color.BgRed + fgBlue := color.FgBlue + + rgbPinkLib := color.Rgb(0xFF, 0x00, 0xFF) + rgbPink := NewRGBColor(rgbPinkLib) + + rgbYellowLib := color.Rgb(0xFF, 0xFF, 0x00) + rgbYellow := NewRGBColor(rgbYellowLib) + + strToPrint := "foo" + + scenarios := []scenario{ + { + "no color", + nil, + TextStyle{style: color.Style{}}, + "foo", + }, + { + "only fg color", + []TextStyle{FgRed}, + TextStyle{fg: &Color{basic: &fgRed}, style: color.Style{fgRed}}, + "\x1b[31mfoo\x1b[0m", + }, + { + "only bg color", + []TextStyle{BgRed}, + TextStyle{bg: &Color{basic: &bgRed}, style: color.Style{bgRed}}, + "\x1b[41mfoo\x1b[0m", + }, + { + "fg and bg color", + []TextStyle{FgBlue, BgRed}, + TextStyle{ + fg: &Color{basic: &fgBlue}, + bg: &Color{basic: &bgRed}, + style: color.Style{fgBlue, bgRed}, + }, + "\x1b[34;41mfoo\x1b[0m", + }, + { + "single attribute", + []TextStyle{AttrBold}, + TextStyle{ + decoration: Decoration{bold: true}, + style: color.Style{color.OpBold}, + }, + "\x1b[1mfoo\x1b[0m", + }, + { + "multiple attributes", + []TextStyle{AttrBold, AttrUnderline}, + TextStyle{ + decoration: Decoration{ + bold: true, + underline: true, + }, + style: color.Style{color.OpBold, color.OpUnderscore}, + }, + "\x1b[1;4mfoo\x1b[0m", + }, + { + "multiple attributes and colors", + []TextStyle{AttrBold, FgBlue, AttrUnderline, BgRed}, + TextStyle{ + fg: &Color{basic: &fgBlue}, + bg: &Color{basic: &bgRed}, + decoration: Decoration{ + bold: true, + underline: true, + }, + style: color.Style{fgBlue, bgRed, color.OpBold, color.OpUnderscore}, + }, + "\x1b[34;41;1;4mfoo\x1b[0m", + }, + { + "rgb fg color", + []TextStyle{New().SetFg(rgbPink)}, + TextStyle{ + fg: &rgbPink, + style: color.NewRGBStyle(rgbPinkLib).SetOpts(color.Opts{}), + }, + // '38;2' qualifies an RGB foreground color + "\x1b[38;2;255;0;255mfoo\x1b[0m", + }, + { + "rgb fg and bg color", + []TextStyle{New().SetFg(rgbPink).SetBg(rgbYellow)}, + TextStyle{ + fg: &rgbPink, + bg: &rgbYellow, + style: color.NewRGBStyle(rgbPinkLib, rgbYellowLib).SetOpts(color.Opts{}), + }, + // '48;2' qualifies an RGB background color + "\x1b[38;2;255;0;255;48;2;255;255;0mfoo\x1b[0m", + }, + { + "rgb fg and bg color with opts", + []TextStyle{AttrBold, New().SetFg(rgbPink).SetBg(rgbYellow), AttrUnderline}, + TextStyle{ + fg: &rgbPink, + bg: &rgbYellow, + decoration: Decoration{ + bold: true, + underline: true, + }, + style: color.NewRGBStyle(rgbPinkLib, rgbYellowLib).SetOpts(color.Opts{color.OpBold, color.OpUnderscore}), + }, + "\x1b[38;2;255;0;255;48;2;255;255;0;1;4mfoo\x1b[0m", + }, + { + "mix color-16 with rgb colors", + []TextStyle{New().SetFg(rgbYellow), BgRed}, + TextStyle{ + fg: &rgbYellow, + bg: &Color{basic: &bgRed}, + style: color.NewRGBStyle( + rgbYellowLib, + fgRed.RGB(), // We need to use FG here, https://github.com/gookit/color/issues/39 + ).SetOpts(color.Opts{}), + }, + "\x1b[38;2;255;255;0;48;2;197;30;20mfoo\x1b[0m", + }, + } + + for _, s := range scenarios { + s := s + t.Run(s.name, func(t *testing.T) { + style := New() + for _, other := range s.toMerge { + style = style.MergeStyle(other) + } + assert.Equal(t, s.expectedStyle, style) + assert.Equal(t, s.expectedStr, style.Sprint(strToPrint)) + }) + } +} + +func TestTemplateFuncMapAddColors(t *testing.T) { + type scenario struct { + name string + tmpl string + expect string + } + + scenarios := []scenario{ + { + "normal template", + "{{ .Foo }}", + "bar", + }, + { + "colored string", + "{{ .Foo | red }}", + "\x1b[31mbar\x1b[0m", + }, + { + "string with decorator", + "{{ .Foo | bold }}", + "\x1b[1mbar\x1b[0m", + }, + { + "string with color and decorator", + "{{ .Foo | bold | red }}", + "\x1b[31m\x1b[1mbar\x1b[0m\x1b[0m", + }, + { + "multiple string with different colors", + "{{ .Foo | red }} - {{ .Foo | blue }}", + "\x1b[31mbar\x1b[0m - \x1b[34mbar\x1b[0m", + }, + } + + for _, s := range scenarios { + s := s + t.Run(s.name, func(t *testing.T) { + tmpl, err := template.New("test template").Funcs(TemplateFuncMapAddColors(template.FuncMap{})).Parse(s.tmpl) + assert.NoError(t, err) + + buff := bytes.NewBuffer(nil) + err = tmpl.Execute(buff, struct{ Foo string }{"bar"}) + assert.NoError(t, err) + + assert.Equal(t, s.expect, buff.String()) + }) + } +} diff --git a/pkg/gui/style/text_style.go b/pkg/gui/style/text_style.go new file mode 100644 index 000000000..4fbb7f1f4 --- /dev/null +++ b/pkg/gui/style/text_style.go @@ -0,0 +1,149 @@ +package style + +import ( + "github.com/gookit/color" +) + +// A TextStyle contains a foreground color, background color, and +// decorations (bold/underline/reverse). +// +// Colors may each be either 16-bit or 24-bit RGB colors. When +// we need to produce a string with a TextStyle, if either foreground or +// background color is RGB, we'll promote the other color component to RGB as well. +// We could simplify this code by forcing everything to be RGB, but we're not +// sure how compatible or efficient that would be with various terminals. +// Lazygit will typically stick to 16-bit colors, but users may configure RGB colors. +// +// TextStyles are value objects, not entities, so for example if you want to +// add the bold decoration to a TextStyle, we'll create a new TextStyle with +// that decoration applied. +// +// Decorations are additive, so when we merge two TextStyles, if either is bold +// then the resulting style will also be bold. +// +// So that we aren't rederiving the underlying style each time we want to print +// a string, we derive it when a new TextStyle is created and store it in the +// `style` field. + +type TextStyle struct { + fg *Color + bg *Color + decoration Decoration + + style Sprinter +} + +type Sprinter interface { + Sprint(a ...interface{}) string + Sprintf(format string, a ...interface{}) string +} + +func New() TextStyle { + s := TextStyle{} + s.style = s.deriveStyle() + return s +} + +func (b TextStyle) Sprint(a ...interface{}) string { + return b.style.Sprint(a...) +} + +func (b TextStyle) Sprintf(format string, a ...interface{}) string { + return b.style.Sprintf(format, a...) +} + +// note that our receiver here is not a pointer which means we're receiving a +// copy of the original TextStyle. This allows us to mutate and return that +// TextStyle receiver without actually modifying the original. +func (b TextStyle) SetBold() TextStyle { + b.decoration.SetBold() + b.style = b.deriveStyle() + return b +} + +func (b TextStyle) SetUnderline() TextStyle { + b.decoration.SetUnderline() + b.style = b.deriveStyle() + return b +} + +func (b TextStyle) SetReverse() TextStyle { + b.decoration.SetReverse() + b.style = b.deriveStyle() + return b +} + +func (b TextStyle) SetBg(color Color) TextStyle { + b.bg = &color + b.style = b.deriveStyle() + return b +} + +func (b TextStyle) SetFg(color Color) TextStyle { + b.fg = &color + b.style = b.deriveStyle() + return b +} + +func (b TextStyle) MergeStyle(other TextStyle) TextStyle { + b.decoration = b.decoration.Merge(other.decoration) + + if other.fg != nil { + b.fg = other.fg + } + + if other.bg != nil { + b.bg = other.bg + } + + b.style = b.deriveStyle() + + return b +} + +func (b TextStyle) deriveStyle() Sprinter { + if b.fg == nil && b.bg == nil { + return color.Style(b.decoration.ToOpts()) + } + + isRgb := (b.fg != nil && b.fg.IsRGB()) || (b.bg != nil && b.bg.IsRGB()) + if isRgb { + return b.deriveRGBStyle() + } + + return b.deriveBasicStyle() +} + +func (b TextStyle) deriveBasicStyle() color.Style { + style := make([]color.Color, 0, 5) + + if b.fg != nil { + style = append(style, *b.fg.basic) + } + + if b.bg != nil { + style = append(style, *b.bg.basic) + } + + style = append(style, b.decoration.ToOpts()...) + + return color.Style(style) +} + +func (b TextStyle) deriveRGBStyle() *color.RGBStyle { + style := &color.RGBStyle{} + + if b.fg != nil { + style.SetFg(*b.fg.ToRGB(false).rgb) + } + + if b.bg != nil { + // We need to convert the bg firstly to a foreground color, + // For more info see + style.SetBg(*b.bg.ToRGB(true).rgb) + } + + style.SetOpts(b.decoration.ToOpts()) + + return style +} diff --git a/pkg/gui/submodules_panel.go b/pkg/gui/submodules_panel.go index cec3d3397..ff1cb0aeb 100644 --- a/pkg/gui/submodules_panel.go +++ b/pkg/gui/submodules_panel.go @@ -6,9 +6,8 @@ import ( "path/filepath" "strings" - "github.com/fatih/color" "github.com/jesseduffield/lazygit/pkg/commands/models" - "github.com/jesseduffield/lazygit/pkg/utils" + "github.com/jesseduffield/lazygit/pkg/gui/style" ) func (gui *Gui) getSelectedSubmodule() *models.SubmoduleConfig { @@ -28,9 +27,9 @@ func (gui *Gui) handleSubmoduleSelect() error { } else { prefix := fmt.Sprintf( "Name: %s\nPath: %s\nUrl: %s\n\n", - utils.ColoredString(submodule.Name, color.FgGreen), - utils.ColoredString(submodule.Path, color.FgYellow), - utils.ColoredString(submodule.Url, color.FgCyan), + style.FgGreen.Sprint(submodule.Name), + style.FgYellow.Sprint(submodule.Path), + style.FgCyan.Sprint(submodule.Url), ) file := gui.fileForSubmodule(submodule) @@ -213,7 +212,7 @@ func (gui *Gui) handleResetRemoveSubmodule(submodule *models.SubmoduleConfig) er func (gui *Gui) handleBulkSubmoduleActionsMenu() error { menuItems := []*menuItem{ { - displayStrings: []string{gui.Tr.LcBulkInitSubmodules, utils.ColoredString(gui.GitCommand.SubmoduleBulkInitCmdStr(), color.FgGreen)}, + displayStrings: []string{gui.Tr.LcBulkInitSubmodules, style.FgGreen.Sprint(gui.GitCommand.SubmoduleBulkInitCmdStr())}, onPress: func() error { return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error { if err := gui.OSCommand.WithSpan(gui.Tr.Spans.BulkInitialiseSubmodules).RunCommand(gui.GitCommand.SubmoduleBulkInitCmdStr()); err != nil { @@ -225,7 +224,7 @@ func (gui *Gui) handleBulkSubmoduleActionsMenu() error { }, }, { - displayStrings: []string{gui.Tr.LcBulkUpdateSubmodules, utils.ColoredString(gui.GitCommand.SubmoduleBulkUpdateCmdStr(), color.FgYellow)}, + displayStrings: []string{gui.Tr.LcBulkUpdateSubmodules, style.FgYellow.Sprint(gui.GitCommand.SubmoduleBulkUpdateCmdStr())}, onPress: func() error { return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error { if err := gui.OSCommand.WithSpan(gui.Tr.Spans.BulkUpdateSubmodules).RunCommand(gui.GitCommand.SubmoduleBulkUpdateCmdStr()); err != nil { @@ -237,7 +236,7 @@ func (gui *Gui) handleBulkSubmoduleActionsMenu() error { }, }, { - displayStrings: []string{gui.Tr.LcSubmoduleStashAndReset, utils.ColoredString(fmt.Sprintf("git stash in each submodule && %s", gui.GitCommand.SubmoduleForceBulkUpdateCmdStr()), color.FgRed)}, + displayStrings: []string{gui.Tr.LcSubmoduleStashAndReset, style.FgRed.Sprintf("git stash in each submodule && %s", gui.GitCommand.SubmoduleForceBulkUpdateCmdStr())}, onPress: func() error { return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error { if err := gui.GitCommand.WithSpan(gui.Tr.Spans.BulkStashAndResetSubmodules).ResetSubmodules(gui.State.Submodules); err != nil { @@ -249,7 +248,7 @@ func (gui *Gui) handleBulkSubmoduleActionsMenu() error { }, }, { - displayStrings: []string{gui.Tr.LcBulkDeinitSubmodules, utils.ColoredString(gui.GitCommand.SubmoduleBulkDeinitCmdStr(), color.FgRed)}, + displayStrings: []string{gui.Tr.LcBulkDeinitSubmodules, style.FgRed.Sprint(gui.GitCommand.SubmoduleBulkDeinitCmdStr())}, onPress: func() error { return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error { if err := gui.OSCommand.WithSpan(gui.Tr.Spans.BulkDeinitialiseSubmodules).RunCommand(gui.GitCommand.SubmoduleBulkDeinitCmdStr()); err != nil { diff --git a/pkg/gui/tags_panel.go b/pkg/gui/tags_panel.go index 500b41af1..2ce52d54a 100644 --- a/pkg/gui/tags_panel.go +++ b/pkg/gui/tags_panel.go @@ -121,8 +121,9 @@ func (gui *Gui) handlePushTag(tag *models.Tag) error { ) return gui.prompt(promptOpts{ - title: title, - initialContent: "origin", + title: title, + initialContent: "origin", + findSuggestionsFunc: gui.getRemoteSuggestionsFunc(), handleConfirm: func(response string) error { return gui.WithWaitingStatus(gui.Tr.PushingTagStatus, func() error { err := gui.GitCommand.WithSpan(gui.Tr.Spans.PushTag).PushTag(response, tag.Name, gui.promptUserForCredential) diff --git a/pkg/gui/tasks_adapter.go b/pkg/gui/tasks_adapter.go index 71cde5b00..61c3de083 100644 --- a/pkg/gui/tasks_adapter.go +++ b/pkg/gui/tasks_adapter.go @@ -9,9 +9,10 @@ import ( ) func (gui *Gui) newCmdTask(view *gocui.View, cmd *exec.Cmd, prefix string) error { + cmdStr := strings.Join(cmd.Args, " ") gui.Log.WithField( "command", - strings.Join(cmd.Args, " "), + cmdStr, ).Debug("RunCommand") _, height := view.Size() @@ -29,17 +30,7 @@ func (gui *Gui) newCmdTask(view *gocui.View, cmd *exec.Cmd, prefix string) error return err } - if err := manager.NewTask(manager.NewCmdTask(r, cmd, prefix, height+oy+10, nil)); err != nil { - return err - } - - return nil -} - -func (gui *Gui) newTask(view *gocui.View, f func(chan struct{}) error) error { - manager := gui.getManager(view) - - if err := manager.NewTask(f); err != nil { + if err := manager.NewTask(manager.NewCmdTask(r, cmd, prefix, height+oy+10, nil), cmdStr); err != nil { return err } @@ -47,18 +38,8 @@ func (gui *Gui) newTask(view *gocui.View, f func(chan struct{}) error) error { } func (gui *Gui) newStringTask(view *gocui.View, str string) error { - manager := gui.getManager(view) - - f := func(stop chan struct{}) error { - gui.renderString(view, str) - return nil - } - - if err := manager.NewTask(f); err != nil { - return err - } - - return nil + // using str so that if rendering the exact same thing we don't reset the origin + return gui.newStringTaskWithKey(view, str, str) } func (gui *Gui) newStringTaskWithoutScroll(view *gocui.View, str string) error { @@ -69,7 +50,24 @@ func (gui *Gui) newStringTaskWithoutScroll(view *gocui.View, str string) error { return nil } - if err := manager.NewTask(f); err != nil { + // Using empty key so that on subsequent calls we won't reset the view's origin. + // Note this means that we will be scrolling back to the top if we're switching from a different key + if err := manager.NewTask(f, ""); err != nil { + return err + } + + return nil +} + +func (gui *Gui) newStringTaskWithKey(view *gocui.View, str string, key string) error { + manager := gui.getManager(view) + + f := func(stop chan struct{}) error { + gui.renderString(view, str) + return nil + } + + if err := manager.NewTask(f, key); err != nil { return err } @@ -97,8 +95,29 @@ func (gui *Gui) getManager(view *gocui.View) *tasks.ViewBufferManager { }) }, func() { + // Need to check if the content of the view is well past the origin. + // It would be better to use .ViewLinesHeight here (given it considers + // wrapping) but when this function is called they haven't been written to yet. + linesHeight := view.LinesHeight() + _, height := view.Size() + _, originY := view.Origin() + if linesHeight < originY { + newOriginY := linesHeight - height + if newOriginY < 0 { + newOriginY = 0 + } + err := view.SetOrigin(0, newOriginY) + if err != nil { + panic(err) + } + + } + view.FlushStaleCells() }, + func() { + _ = view.SetOrigin(0, 0) + }, ) gui.viewBufferManagerMap[view.Name()] = manager } diff --git a/pkg/gui/view_helpers.go b/pkg/gui/view_helpers.go index 429f47a11..930d98a0c 100644 --- a/pkg/gui/view_helpers.go +++ b/pkg/gui/view_helpers.go @@ -244,10 +244,6 @@ func (gui *Gui) renderOptionsMap(optionsMap map[string]string) { gui.renderString(gui.Views.Options, gui.optionsMapToString(optionsMap)) } -func (gui *Gui) trimmedContent(v *gocui.View) string { - return strings.TrimSpace(v.Buffer()) -} - func (gui *Gui) currentViewName() string { currentView := gui.g.CurrentView() if currentView == nil { @@ -262,15 +258,14 @@ func (gui *Gui) resizeCurrentPopupPanel() error { return nil } if gui.isPopupPanel(v.Name()) { - return gui.resizePopupPanel(v) + return gui.resizePopupPanel(v, v.Buffer()) } return nil } -func (gui *Gui) resizePopupPanel(v *gocui.View) error { +func (gui *Gui) resizePopupPanel(v *gocui.View, content string) error { // If the confirmation panel is already displayed, just resize the width, // otherwise continue - content := v.Buffer() x0, y0, x1, y1 := gui.getConfirmationPanelDimensions(v.Wrap, content) vx0, vy0, vx1, vy1 := v.Dimensions() if vx0 == x0 && vy0 == y0 && vx1 == x1 && vy1 == y1 { @@ -327,7 +322,7 @@ func (gui *Gui) globalOptionsMap() map[string]string { gui.getKeyDisplay(keybindingConfig.Universal.Return): gui.Tr.LcCancel, gui.getKeyDisplay(keybindingConfig.Universal.Quit): gui.Tr.LcQuit, gui.getKeyDisplay(keybindingConfig.Universal.OptionMenu): gui.Tr.LcMenu, - "1-5": gui.Tr.LcJump, + fmt.Sprintf("%s-%s", gui.getKeyDisplay(keybindingConfig.Universal.JumpToBlock[0]), gui.getKeyDisplay(keybindingConfig.Universal.JumpToBlock[len(keybindingConfig.Universal.JumpToBlock)-1])): gui.Tr.LcJump, } } @@ -345,12 +340,6 @@ func (gui *Gui) secondaryViewFocused() bool { return state != nil && state.SecondaryFocused } -func (gui *Gui) clearEditorView(v *gocui.View) { - v.Clear() - _ = v.SetCursor(0, 0) - _ = v.SetOrigin(0, 0) -} - func (gui *Gui) onViewTabClick(viewName string, tabIndex int) error { context := gui.State.ViewTabContextMap[viewName][tabIndex].contexts[0] diff --git a/pkg/gui/workspace_reset_options_panel.go b/pkg/gui/workspace_reset_options_panel.go index 872cc4508..de5440d8d 100644 --- a/pkg/gui/workspace_reset_options_panel.go +++ b/pkg/gui/workspace_reset_options_panel.go @@ -3,11 +3,11 @@ package gui import ( "fmt" - "github.com/fatih/color" + "github.com/jesseduffield/lazygit/pkg/gui/style" ) func (gui *Gui) handleCreateResetMenu() error { - red := color.New(color.FgRed) + red := style.FgRed nukeStr := "reset --hard HEAD && git clean -fd" if len(gui.State.Submodules) > 0 { diff --git a/pkg/i18n/chinese.go b/pkg/i18n/chinese.go index 30d322c42..f54f8d657 100644 --- a/pkg/i18n/chinese.go +++ b/pkg/i18n/chinese.go @@ -1,35 +1,43 @@ package i18n -const chineseIntroPopupMessage = ` -感谢您使用lazygit!与您分享的三件事: +// 本翻译文件中的词语的翻译参考了 https://github.com/progit/progit2-zh/blob/master/TRANSLATION_NOTES.asc。 +// 下方的术语对照表是对其的补充 - 1) 如果您想了解lazygit的功能,请观看此视频: +// Translation in this file refer to https://github.com/progit/progit2-zh/blob/master/TRANSLATION_NOTES.asc. +// Glossary below is a supplement of that documentation. + +// Glossary 术语对照表 + +// change 更改 +// fixup 修正 +// reset 重置 + +const chineseIntroPopupMessage = ` +感谢您使用 lazygit!与您分享三件事: + + 1) 如果您想了解 lazygit 的功能,请观看此视频: https://youtu.be/CPLdltN7wgE - 2) 请务必阅读最新的发行说明,网址为:: + 2) 请务必阅读最新的发行说明, 网址为: https://github.com/jesseduffield/lazygit/releases - 3) 如果您使用的是git,那将使您成为一名程序员! 在您的帮助下,我们可以使 - lazygit更好, 因此,请考虑成为一名贡献者并加入 + 3) 如果您使用 git,这将使您成为一名程序员!在您的帮助下,我们可以使 + lazygit 更好,因此请考虑成为一名贡献者: https://github.com/jesseduffield/lazygit - 您也可以赞助我,并通过单击捐赠告诉我要做什么。 - 右下角的按钮. - 甚至只是给回购交易代码加注星标,我们离20k星就不远了! + 您也可以赞助我,并通过单击右下角的捐赠按钮,告诉我要做什么改进。 + 只是给仓库加个星星也很棒! ` func chineseTranslationSet() TranslationSet { return TranslationSet{ NotEnoughSpace: "没有足够的空间来渲染面板", DiffTitle: "差异", - LogTitle: "日志", FilesTitle: "文件", BranchesTitle: "分支", CommitsTitle: "提交", - StashTitle: "封存隐藏(Stash)", - UnstagedChanges: `未暂存(Unstaged)更改`, - StagedChanges: `已暂存(Staged)更改`, - PatchBuildingMainTitle: `将 行/块 添加到补丁`, - MergingMainTitle: "解决合并冲突", + StashTitle: "贮藏", + UnstagedChanges: `未暂存更改`, + StagedChanges: `已暂存更改`, MainTitle: "主要", StagingTitle: "正在暂存", MergingTitle: "合并中", @@ -37,367 +45,333 @@ func chineseTranslationSet() TranslationSet { CommitMessage: "提交信息", CredentialsUsername: "用户名", CredentialsPassword: "密码", - CredentialsPassphrase: "输入SSH密钥的密码", - PassUnameWrong: "密码, 密码 和/或 用户名错误", + CredentialsPassphrase: "输入 SSH 密钥的密码", + PassUnameWrong: "密码 和/或 用户名错误", CommitChanges: "提交更改", - AmendLastCommit: "修改最后一次提交", - SureToAmend: "您确定要修改上一次提交吗?之后,您可以从提交面板更改提交消息.", - NoCommitToAmend: "没有提交的修改.", - CommitChangesWithEditor: "使用git编辑器提交更改", + AmendLastCommit: "修补最后一次提交", + SureToAmend: "您确定要修补上一次提交吗?之后您可以从提交面板更改提交消息。", + NoCommitToAmend: "没有需要提交的修补。", + CommitChangesWithEditor: "提交更改(使用编辑器编辑提交信息)", StatusTitle: "状态", LcNavigate: "导航", LcMenu: "菜单", LcExecute: "执行", - LcOpen: "打开", - LcIgnore: "忽略", - LcDelete: "删除", - LcToggleStaged: "切换已暂存(staged)", - LcToggleStagedAll: "暂存(stage)/未暂存(unstage)全部", + LcToggleStaged: "切换暂存状态", + LcToggleStagedAll: "切换所有文件的暂存状态", LcToggleTreeView: "切换文件树视图", - LcOpenMergeTool: "打开外部合并工具 (git mergetool)", + LcOpenMergeTool: "打开合并工具", LcRefresh: "刷新", - LcPush: "推送(push)", - LcPull: "拉取(pull)", - LcEdit: "编辑", + LcPush: "推送", + LcPull: "拉取", LcScroll: "滚动", - LcAbortMerge: "中止合并", - LcResolveMergeConflicts: "解决合并冲突", MergeConflictsTitle: "合并冲突", - LcCheckout: "签出(checkout)", - NoChangedFiles: "没有更改的文件", - FileHasNoUnstagedChanges: "文件没有要添加的未暂存更改", - CannotGitAdd: "无法 git add --patch 未跟踪的文件", + LcCheckout: "检出", + LcCommitFileFilter: "过滤提交文件", + NoChangedFiles: "没有更改过文件", NoFilesDisplay: "没有文件可显示", NotAFile: "不是文件", - PullWait: "拉取中...", - PushWait: "推送中...", - FetchWait: "正在取得...", - FileNoMergeCons: "该文件没有内联合并冲突", - LcSoftReset: "软复位", - SureTo: "你确定要 {{.deleteVerb}} {{.fileName}} (你会丢失你的更改)?", - AlreadyCheckedOutBranch: "您已经签出了这个分支", - SureForceCheckout: "您确定要强制签出吗? 您将丢失所有本地更改", - ForceCheckoutBranch: "强制签出分支", + PullWait: "拉取中……", + PushWait: "推送中……", + FetchWait: "正在抓取……", + FileNoMergeCons: "该文件没有合并冲突", + LcSoftReset: "软重置", + AlreadyCheckedOutBranch: "您已经检出了这个分支", + SureForceCheckout: "您确定要强制检出吗?您将丢失所有本地更改", + ForceCheckoutBranch: "强制检出分支", BranchName: "分支名称", - NewBranchNameBranchOff: "新分支名称 (分支不属于 {{.branchName}})", - CantDeleteCheckOutBranch: "您不能删除已签出的分支!", + NewBranchNameBranchOff: "新分支名称(基于 {{.branchName}})", + CantDeleteCheckOutBranch: "您不能删除已检出的分支!", DeleteBranch: "删除分支", - DeleteBranchMessage: "您确定要删除分支 {{.selectedBranchName}}?", - ForceDeleteBranchMessage: "{{.selectedBranchName}} 没有完全合并. 你确定你要删除它?", - LcRebaseBranch: "将已签出的分支重新部署到该分支", - CantRebaseOntoSelf: "您不能将分支建立在其自身之上", - CantMergeBranchIntoItself: "您不能将分支合并到自身中", - LcForceCheckout: "强制签出", - LcMerge: "合并", - LcCheckoutByName: "按名称签出", + DeleteBranchMessage: "您确定要删除分支 {{.selectedBranchName}} 吗?", + ForceDeleteBranchMessage: "{{.selectedBranchName}} 还没有被完全合并。您确定要删除它吗?", + LcRebaseBranch: "将已检出的分支变基到该分支", + CantRebaseOntoSelf: "您不能将分支变基到其自身", + CantMergeBranchIntoItself: "您不能将分支合并到其自身", + LcForceCheckout: "强制检出", + LcCheckoutByName: "按名称检出", LcNewBranch: "新分支", LcDeleteBranch: "删除分支", - LcForceDeleteBranch: "删除分支 (强制)", - NoBranchesThisRepo: "此仓库没有分支", - NoTrackingThisBranch: "该分支没有跟踪", - CommitMessageConfirm: "{{.keyBindClose}}: 关闭, {{.keyBindNewLine}}: 新行, {{.keyBindConfirm}}: 确认", - CommitWithoutMessageErr: "没有提交消息就无法提交", - CloseConfirm: "{{.keyBindClose}}: 关闭, {{.keyBindConfirm}}: 确认", + NoBranchesThisRepo: "此仓库中没有分支", + CommitMessageConfirm: "{{.keyBindClose}}:关闭,{{.keyBindNewLine}}:新行,{{.keyBindConfirm}}:确认", + CommitWithoutMessageErr: "您必须编写提交消息才能进行提交", + CloseConfirm: "{{.keyBindClose}}:关闭,{{.keyBindConfirm}}:确认", LcClose: "关闭", LcQuit: "退出", - SureResetThisCommit: "您确定要重置为此提交吗?", - ResetToCommit: "重置以提交", - LcSquashDown: "向下聚合(squash down)", - LcRename: "重命名", + LcSquashDown: "向下压缩", LcResetToThisCommit: "重置为此提交", - LcFixupCommit: "修正提交", + LcFixupCommit: "修正提交(fixup)", NoCommitsThisBranch: "该分支没有提交", - OnlySquashTopmostCommit: "只能压缩最高提交", - YouNoCommitsToSquash: "您没有提交来压缩", - CantFixupWhileUnstagedChanges: "当有未暂存的更改时无法修正", - Fixup: "修正", - SureFixupThisCommit: "您确定要'修复'此提交吗?? 它将合并到下面的提交中", - SureSquashThisCommit: "您确定要将这个提交压缩到下面的提交中吗?", + OnlySquashTopmostCommit: "只能压缩最顶层的提交", + YouNoCommitsToSquash: "您没有提交可以压缩", + Fixup: "修正(fixup)", + SureFixupThisCommit: "您确定要“修正”此提交吗?它将合并到下面的提交中", + SureSquashThisCommit: "您确定要将这个提交压缩到下面的提交中吗?", Squash: "压缩", - LcPickCommit: "选择提交 (mid-rebase时)", + LcPickCommit: "选择提交(变基过程中)", LcRevertCommit: "还原提交", - OnlyRenameTopCommit: "只能从lazygit内部重写最高的提交。请使用shift-R", + OnlyRenameTopCommit: "只能从 lazygit 内部重写最高的提交。请使用 shift-R", LcRenameCommit: "改写提交", LcDeleteCommit: "删除提交", LcMoveDownCommit: "下移提交", LcMoveUpCommit: "上移提交", LcEditCommit: "编辑提交", - LcAmendToCommit: "用staged的修改来修改提交", + LcAmendToCommit: "用已暂存的更改来修补提交", LcRenameCommitEditor: "使用编辑器重命名提交", - PotentialErrInGetselectedCommit: "获取选定提交中的潜在错误 (ui和状态不匹配)", Error: "错误", - RunningSubprocess: "正在运行的子进程", - LcSelectHunk: "选择块", - LcNavigateConflicts: "解决冲突", - LcPickHunk: "选择块", - LcPickBothHunks: "pick both hunks", + LcSelectHunk: "切换区块", + LcNavigateConflicts: "浏览冲突", + LcPickHunk: "选中区块", + LcPickAllHunks: "选中所有区块", LcUndo: "撤销", - LcUndoReflog: "撤销 (via reflog) (实验性)", - LcRedoReflog: "重做 (via reflog) (实验性)", - LcPop: "pop", + LcUndoReflog: "(通过 reflog)撤销「实验功能」", + LcRedoReflog: "(通过 reflog)重做「实验功能」", + LcPop: "应用并删除", LcDrop: "删除", - LcApply: "恢复", - NoStashEntries: "没有封存隐藏(stach)的条目", - StashDrop: "Stash删除", - SureDropStashEntry: "您确定要删除此隐藏(stach)条目?", - StashPop: "Stash pop(恢复)", - SurePopStashEntry: "您确定要弹出此隐藏条stash目吗?", - StashApply: "Stash apply(恢复)", - SureApplyStashEntry: "您确定要应用此隐藏stash条目?", - NoStashTo: "没有stash到 {{.method}}", - NoTrackedStagedFilesStash: "您没有要存储的跟踪/暂存文件到stash", - StashChanges: "Stash更改", - IssntListOfViews: "{{.name}} 不在视图列表中", - LcNewFocusedViewIs: "新的焦点视图是 {{.newFocusedView}}", + LcApply: "应用", + NoStashEntries: "没有贮藏条目", + StashDrop: "删除贮藏", + SureDropStashEntry: "您确定要删除此贮藏条目吗?", + StashPop: "应用并删除贮藏", + SurePopStashEntry: "您确定要应用并删除此贮藏条目吗?", + StashApply: "应用贮藏", + SureApplyStashEntry: "您确定要应用此贮藏条目?", + NoStashTo: "没有贮藏条目可以 {{.method}}", + NoTrackedStagedFilesStash: "没有可以贮藏的已跟踪/暂存文件", + StashChanges: "贮藏更改", MergeAborted: "合并中止", OpenConfig: "打开配置文件", EditConfig: "编辑配置文件", ForcePush: "强制推送", - ForcePushPrompt: "您的分支已与远程分支不同. 按 'esc' 取消, 或 'enter' 强制推送.", - ForcePushDisabled: "您的分支已与远程分支不同并且你已经禁用了强行推送", + ForcePushPrompt: "您的分支已与远程分支不同。按‘esc’取消,或‘enter’强制推送.", + ForcePushDisabled: "您的分支已与远程分支不同, 并且您已经禁用了强行推送", UpdatesRejectedAndForcePushDisabled: "更新被拒绝,您已禁用强制推送", LcCheckForUpdate: "检查更新", - CheckingForUpdates: "检查更新...", - OnLatestVersionErr: "您已经有最新版本", + CheckingForUpdates: "检查更新中……", + OnLatestVersionErr: "您的软件已经是最新版本", MajorVersionErr: "新版本 ({{.newVersion}}) 与当前版本相比,具有向后兼容的更改 ({{.currentVersion}})", - CouldNotFindBinaryErr: "在{{.url}处找不到任何二进制文件}", - AnonymousReportingTitle: "帮助改善lazygit", - AnonymousReportingPrompt: "您是否想启用匿名报告数据以帮助改善lazygit? (enter/esc)", + CouldNotFindBinaryErr: "在 {{.url}} 处找不到任何二进制文件", MergeToolTitle: "合并工具", MergeToolPrompt: "确定要打开 `git mergetool` 吗?", IntroPopupMessage: chineseIntroPopupMessage, - GitconfigParseErr: `由于存在未加引号的'\'字符,因此Gogit无法解析您的gitconfig文件。删除这些应该可以解决问题.`, + GitconfigParseErr: `由于存在未加引号的'\'字符,因此 Gogit 无法解析您的 gitconfig 文件。删除它们应该可以解决问题。`, LcEditFile: `编辑文件`, LcOpenFile: `打开文件`, LcIgnoreFile: `添加到 .gitignore`, LcRefreshFiles: `刷新文件`, - LcMergeIntoCurrentBranch: `合并到当前签出的分支`, - ConfirmQuit: `你确定你要退出吗?`, + LcMergeIntoCurrentBranch: `合并到当前检出的分支`, + ConfirmQuit: `您确定要退出吗?`, SwitchRepo: `切换到最近的仓库`, - LcAllBranchesLogGraph: `显示所有分支日志`, - UnsupportedGitService: `不支持的git服务`, - LcCreateOrShowPullRequest: `创建pull请求`, - LcCopyPullRequestURL: `将拉取请求URL复制到剪贴板`, - NoBranchOnRemote: `该分支在远程上不存在。您需要先将其推送到远程.`, - LcFetch: `fetch`, - NoAutomaticGitFetchTitle: `没有自动git fetch`, - NoAutomaticGitFetchBody: `Lazygit不能在私人仓库中使用"git fetch"; 在文件面板中使用'f'手动运行"git fetch"`, + LcAllBranchesLogGraph: `显示所有分支的日志`, + UnsupportedGitService: `不支持的 git 服务`, + LcCreatePullRequest: `创建抓取请求`, + LcCopyPullRequestURL: `将抓取请求 URL 复制到剪贴板`, + NoBranchOnRemote: `该分支在远程上不存在. 您需要先将其推送到远程.`, + LcFetch: `抓取`, + NoAutomaticGitFetchTitle: `无法自动进行 "git fetch"`, + NoAutomaticGitFetchBody: `Lazygit 不能在私人仓库中使用 "git fetch"; 请在文件面板中使用 'f' 手动运行 "git fetch"`, FileEnter: `暂存单个 块/行 用于文件, 或 折叠/展开 目录`, FileStagingRequirements: `只能暂存跟踪文件的单独行`, - SelectHunk: `选择块`, - StageSelection: `切换行 已暂存/未暂存`, - ResetSelection: `删除变更 (git reset)`, + StageSelection: `切换行暂存状态`, + ResetSelection: `取消变更 (git reset)`, ToggleDragSelect: `切换拖动选择`, - ToggleSelectHunk: `切换选择块`, - ToggleSelectionForPatch: `添加/移除 行到patch`, + ToggleSelectHunk: `切换选择区块`, + ToggleSelectionForPatch: `添加/移除 行到补丁`, TogglePanel: `切换到其他面板`, - CantStageStaged: `您无法上演已经上演的变更!`, ReturnToFilesPanel: `返回文件面板`, - CantFindHunks: `在此补丁中找不到任何块`, - CantFindHunk: `找不到块`, - FastForward: `从上游快速前进此分支`, - Fetching: "抓取和快进{{.from}} -> {{.to}} ...", - FoundConflicts: "冲突!要中止,请按 'esc', 否则按'enter'", + FastForward: `从上游快进此分支`, + Fetching: "抓取并快进 {{.from}} -> {{.to}} ...", + FoundConflicts: "冲突!需要中止操作请按‘esc’, 否则按‘enter’", FoundConflictsTitle: "自动合并失败", - Undo: "撤销", - PickHunk: "pick hunk", - PickBothHunks: "pick both hunks", + PickHunk: "选中区块", + PickAllHunks: "选中所有区块", ViewMergeRebaseOptions: "查看 合并/变基 选项", - NotMergingOrRebasing: "您目前既不进行基础调整也不进行合并", + NotMergingOrRebasing: "您目前既不进行变基也不进行合并", RecentRepos: "最近的仓库", MergeOptionsTitle: "合并选项", RebaseOptionsTitle: "变基选项", CommitMessageTitle: "提交讯息", LocalBranchesTitle: "分支标签", SearchTitle: "搜索", - TagsTitle: "Tags Tab", - BranchCommitsTitle: "提交标签", + TagsTitle: "标签页面", MenuTitle: "菜单", - RemotesTitle: "远程标签", + RemotesTitle: "远程页面", CredentialsTitle: "证书", - RemoteBranchesTitle: "远程分支 (在远程选项卡中)", - PatchBuildingTitle: "补丁构建中", + RemoteBranchesTitle: "远程分支(在远程页面中)", + PatchBuildingTitle: "构建补丁中", InformationTitle: "信息", SecondaryTitle: "次要", - ReflogCommitsTitle: "Reflog标签", - Title: "标题", + ReflogCommitsTitle: "Reflog", GlobalTitle: "全局键绑定", - ConflictsResolved: "解决所有合并冲突。继续?", + ConflictsResolved: "已解决所有冲突。是否继续?", RebasingTitle: "变基", - ConfirmRebase: "您确定要重新设定基准 {{.checkedOutBranch}} onto {{.selectedBranch}} 吗?", - ConfirmMerge: "您确定要合并 {{.selectedBranch}} into {{.checkedOutBranch}} 吗?", + ConfirmRebase: "您确定要将分支 {{.checkedOutBranch}} 变基到 {{.selectedBranch}} 吗?", + ConfirmMerge: "您确定要将分支 {{.selectedBranch}} 合并到 {{.checkedOutBranch}} 吗?", FwdNoUpstream: "无法快进没有上游的分支", FwdCommitsToPush: "无法快进并提交推送的分支", - ErrorOccurred: "发生错误! 请在以下位置创建问题", + ErrorOccurred: "发生错误!请在以下位置创建 issue", NoRoom: "没有足够的空间", - YouAreHere: "你在这里", + YouAreHere: "您在这里", LcRewordNotSupported: "当前不支持交互式重新基准化时的重新措词提交", - LcCherryPickCopy: "复制提交 (cherry-pick)", - LcCherryPickCopyRange: "复制提交范围 (cherry-pick)", - LcPasteCommits: "粘贴提交 (cherry-pick)", - SureCherryPick: "您确定要对复制的提交进行cherry-pick吗?", - CherryPick: "Cherry-Pick", + LcCherryPickCopy: "复制提交(拣选)", + LcCherryPickCopyRange: "复制提交范围(拣选)", + LcPasteCommits: "粘贴提交(拣选)", + SureCherryPick: "您确定要将选中的提交进行拣选到这个分支吗?", + CherryPick: "拣选", CannotRebaseOntoFirstCommit: "您不能以交互方式基于第一次提交", - CannotSquashOntoSecondCommit: "您不能 聚合(squash)/修正(fixup)第二个提交", + CannotSquashOntoSecondCommit: "您不能 压缩/修正(fixup)第二个提交", Donate: "捐助", AskQuestion: "问题咨询", PrevLine: "选择上一行", NextLine: "选择下一行", - PrevHunk: "选择上一个块", - NextHunk: "选择下一个块", + PrevHunk: "选择上一个区块", + NextHunk: "选择下一个区块", PrevConflict: "选择上一个冲突", NextConflict: "选择下一个冲突", - SelectTop: "选择顶部块", - SelectBottom: "选择底部块", + SelectPrevHunk: "选择顶部块", + SelectNextHunk: "选择底部块", ScrollDown: "向下滚动", ScrollUp: "向上滚动", LcScrollUpMainPanel: "向上滚动主面板", LcScrollDownMainPanel: "向下滚动主面板", AmendCommitTitle: "修改提交", - AmendCommitPrompt: "您确定要使用暂存文件来修改此提交吗?", + AmendCommitPrompt: "您确定要使用暂存文件来修改此提交吗?", DeleteCommitTitle: "删除提交", - DeleteCommitPrompt: "您确定要删除此提交吗?", - SquashingStatus: "正在聚合(squashing)", - FixingStatus: "fixing up", + DeleteCommitPrompt: "您确定要删除此提交吗?", + SquashingStatus: "正在压缩", + FixingStatus: "正在修正", DeletingStatus: "正在删除", MovingStatus: "正在移动", RebasingStatus: "变基", AmendingStatus: "修改", - CherryPickingStatus: "cherry-picking", + CherryPickingStatus: "拣选中", UndoingStatus: "正在撤销", RedoingStatus: "正在重做", - CheckingOutStatus: "签出", + CheckingOutStatus: "检出", CommittingStatus: "正在提交", CommitFiles: "提交文件", LcViewCommitFiles: "查看提交的文件", CommitFilesTitle: "提交文件", - LcGoBack: "返回", - NoCommiteFiles: "没有用于该提交的文件", - LcCheckoutCommitFile: "签出文件", + LcCheckoutCommitFile: "检出文件", LcDiscardOldFileChange: "放弃对此文件的提交更改", DiscardFileChangesTitle: "放弃文件更改", - DiscardFileChangesPrompt: "您确定要舍弃此提交对该文件的更改吗?? 如果此文件是在此提交中创建的,它将被删除", - DisabledForGPG: "该功能不适用于使用GPG的用户", - CreateRepo: "不在git仓库中. 创建一个新的git仓库吗? (y/n): ", - AutoStashTitle: "自动存储?", - AutoStashPrompt: "您必须隐藏并弹出更改以使更改生效。自动执行? (enter/esc)", + DiscardFileChangesPrompt: "您确定要舍弃此提交对该文件的更改吗?如果此文件是在此提交中创建的,它将被删除", + DisabledForGPG: "该功能不适用于使用 GPG 的用户", + CreateRepo: "不在 git 仓库中。创建一个新的 git 仓库吗?(y/n): ", + AutoStashTitle: "自动存储?", + AutoStashPrompt: "您必须隐藏并弹出更改以使更改生效。自动执行?(enter/esc)", StashPrefix: "自动隐藏更改 ", LcViewDiscardOptions: "查看'放弃更改‘选项", LcCancel: "取消", LcDiscardAllChanges: "放弃所有更改", LcDiscardUnstagedChanges: "放弃未进行的变更", - LcDiscardAllChangesToAllFiles: "nuke 工作树", - LcDiscardAnyUnstagedChanges: "放弃未进行的变更", + LcDiscardAllChangesToAllFiles: "清空工作区", + LcDiscardAnyUnstagedChanges: "丢弃未暂存的变更", LcDiscardUntrackedFiles: "丢弃未跟踪的文件", LcHardReset: "硬重置", - LcHardResetUpstream: "硬重置到上游分支", LcViewResetOptions: `查看重置选项`, - LcCreateFixupCommit: `为此提交创建fixup提交`, - LcSquashAboveCommits: `聚合所有的'fixup!'高于所选提交的提交 (自动聚合)`, - SquashAboveCommits: `聚合所有的'fixup!'高于所选提交的提交 (自动聚合)`, - SureSquashAboveCommits: `您确定要聚合所有修正程序吗! 在{{.commit}}上面提交吗?`, + LcCreateFixupCommit: `为此提交创建修正`, + LcSquashAboveCommits: `压缩在所选提交之上的所有“fixup!”提交(自动压缩)`, + SquashAboveCommits: `压缩在所选提交之上的所有“fixup!”提交(自动压缩)`, + SureSquashAboveCommits: `您确定要压缩在 {{.commit}} 之上的所有“fixup!”提交吗?`, CreateFixupCommit: `创建修正提交`, - SureCreateFixupCommit: `您确定要创建修正程序吗! 提交{{.commit}}?`, + SureCreateFixupCommit: `您确定要对 {{.commit}} 创建修正提交吗?`, LcExecuteCustomCommand: "执行自定义命令", - CustomCommand: "自定义命令:", + CustomCommand: "自定义命令:", LcCommitChangesWithoutHook: "提交更改而无需预先提交钩子", - SkipHookPrefixNotConfigured: "您尚未配置用于跳过钩子的提交消息前缀. 在您的配置中设置`git.skipHookPrefix ='WIP'`", + SkipHookPrefixNotConfigured: "您尚未配置用于跳过钩子的提交消息前缀。请在您的配置中设置 `git.skipHookPrefix ='WIP'`", LcResetTo: `重置为`, - PressEnterToReturn: "按Enter键返回lazygit", + PressEnterToReturn: "按下 Enter 键返回 lazygit", LcViewStashOptions: "查看隐藏选项", - LcStashAllChanges: "stash更改", - LcStashStagedChanges: "stash的staged更改", - LcStashOptions: "Stash选项", - NotARepository: "错误: 必须在git仓库中运行", + LcStashAllChanges: "将所有更改加入贮藏", + LcStashStagedChanges: "将已暂存的更改加入贮藏", + LcStashOptions: "贮藏选项", + NotARepository: "错误:必须在 git 仓库中运行", LcJump: "跳到面板", DiscardPatch: "丢弃补丁", - DiscardPatchConfirm: "您一次只能通过一个commit/stash-entry构建补丁. 放弃当前补丁吗?", + DiscardPatchConfirm: "您一次只能通过一个提交或贮藏条目构建补丁。需要放弃当前补丁吗?", CantPatchWhileRebasingError: "处于合并或变基状态时,您无法构建修补程序或运行修补程序命令", LcToggleAddToPatch: "补丁中包含的切换文件", ViewPatchOptions: "查看自定义补丁选项", PatchOptionsTitle: "补丁选项", - NoPatchError: "尚未创建补丁. 开始构建补丁, 在提交文件上使用'空格‘或输入以添加特定行", - LcEnterFile: "输入文件以将所选行添加到补丁中(或切换目录折叠)", + NoPatchError: "尚未创建补丁。你可以在提交中的文件上按下“空格”或使用“回车”添加其中的特定行以开始构建补丁", + LcEnterFile: "输入文件以将所选行添加到补丁中(或切换目录折叠)", ExitLineByLineMode: `退出逐行模式`, - EnterUpstream: `输入上游作为 ' '`, - EnterUpstreamWithSlash: `输入上游作为 '/'`, - LcNotTrackingRemote: "(不跟踪任何远程)", - ReturnToRemotesList: `返回远程列表`, - LcAddNewRemote: `添加新的远程`, - LcNewRemoteName: `新的远程名称:`, - LcNewRemoteUrl: `新的远程URL:`, - LcEditRemoteName: `输入{{.remoteName}}更新远程名称:`, - LcEditRemoteUrl: `输入{{.remoteName}}更新远程URL:`, + EnterUpstream: `以这种形式输入上游:“<远程仓库> <分支名称>”`, + ReturnToRemotesList: `返回远程仓库列表`, + LcAddNewRemote: `添加新的远程仓库`, + LcNewRemoteName: `新的远程仓库名称:`, + LcNewRemoteUrl: `新的远程仓库 URL:`, + LcEditRemoteName: `输入远程仓库 {{.remoteName}} 的新名称:`, + LcEditRemoteUrl: `输入远程仓库 {{.remoteName}} 的新 URL:`, LcRemoveRemote: `删除远程`, - LcRemoveRemotePrompt: "您确定要删除远程", + LcRemoveRemotePrompt: "您确定要删除远程仓库吗?", DeleteRemoteBranch: "删除远程分支", - DeleteRemoteBranchMessage: "确定要删除远程分支", + DeleteRemoteBranchMessage: "您确定要删除远程分支吗?", LcSetUpstream: "设置为检出分支的上游", SetUpstreamTitle: "设置上游分支", - SetUpstreamMessage: "您确定要将'{{.checkedOut}}‘的上游分支设置为'{{.selected}}'吗?", - LcEditRemote: "编辑远程", + SetUpstreamMessage: "您确定要将 {{.checkedOut}} 的上游分支设置为 {{.selected}} 吗?", + LcEditRemote: "编辑远程仓库", LcTagCommit: "标签提交", - TagNameTitle: "标签名:", + TagNameTitle: "标签名:", LcDeleteTag: "删除标签", DeleteTagTitle: "删除标签", - DeleteTagPrompt: "您确定要删除标签'{{.tagName}}'吗?", - PushTagTitle: "远程将标签'{{.tagName}}'推送到:", + DeleteTagPrompt: "您确定要删除标签 {{.tagName}} 吗?", + PushTagTitle: "将 {{.tagName}} 推送到远程仓库:", LcPushTag: "推送标签", LcCreateTag: "创建标签", - CreateTagTitle: "标签名:", - LcFetchRemote: "获取远程", - FetchingRemoteStatus: "获取远程", - LcCheckoutCommit: "签出提交", - SureCheckoutThisCommit: "您确定要签出此提交吗??", - LcGitFlowOptions: "显示git-flow选项", - NotAGitFlowBranch: "这似乎不是git flow分支", - NewGitFlowBranchPrompt: "新的{{.branchType}}名称:", + CreateTagTitle: "标签名:", + LcFetchRemote: "抓取远程仓库", + FetchingRemoteStatus: "抓取远程仓库中", + LcCheckoutCommit: "检出提交", + SureCheckoutThisCommit: "您确定要检出此提交吗?", + LcGitFlowOptions: "显示 git-flow 选项", + NotAGitFlowBranch: "这似乎不是 git flow 分支", + NewGitFlowBranchPrompt: "新的 {{.branchType}} 名称:", IgnoreTracked: "忽略跟踪文件", - IgnoreTrackedPrompt: "您确定要忽略跟踪的文件吗?", + IgnoreTrackedPrompt: "您确定要忽略已跟踪的文件吗?", LcViewResetToUpstreamOptions: "查看上游重置选项", LcNextScreenMode: "下一屏模式(正常/半屏/全屏)", LcPrevScreenMode: "上一屏模式", LcStartSearch: "开始搜索", Panel: "面板", - Keybindings: "键绑定", + Keybindings: "按键绑定", LcRenameBranch: "重命名分支", - NewBranchNamePrompt: "输入分支的新分支名称", - RenameBranchWarning: "该分支正在跟踪远程服务器。此操作将仅重命名本地分支名称,而不重命名远程分支的名称。继续?", + NewBranchNamePrompt: "输入分支的新名称", + RenameBranchWarning: "该分支正在跟踪远程仓库。此操作将仅会重命名本地分支名称,而不会重命名远程分支的名称。确定继续?", LcOpenMenu: "打开菜单", LcCloseMenu: "关闭菜单", - LcResetCherryPick: "重置 cherry-picked(复制)提交选择", + LcResetCherryPick: "重置已拣选(复制)的提交", LcNextTab: "下一个标签", LcPrevTab: "上一个标签", LcCantUndoWhileRebasing: "进行基础调整时无法撤消", LcCantRedoWhileRebasing: "变基时无法重做", MustStashWarning: "将补丁拉出到索引中需要存储和取消存储所做的更改。如果出现问题,您将可以从存储中访问文件。继续?", - MustStashTitle: "必须stash", + MustStashTitle: "必须保存进度", ConfirmationTitle: "确认面板", LcPrevPage: "上一页", LcNextPage: "下一页", LcGotoTop: "滚动到顶部", LcGotoBottom: "滚动到底部", LcFilteringBy: "过滤依据", - ResetInParentheses: "(重置)", + ResetInParentheses: "(重置)", LcOpenFilteringMenu: "查看按路径过滤选项", LcFilterBy: "过滤", LcExitFilterMode: "停止按路径过滤", LcFilterPathOption: "输入要过滤的路径", - LcEnterFileName: "输入路径:", + EnterFileName: "输入路径:", FilteringMenuTitle: "正在过滤", MustExitFilterModeTitle: "命令不可用", MustExitFilterModePrompt: "命令在过滤模式下不可用。退出过滤模式?", - LcDiff: "差异(diff)", - LcEnterRefToDiff: "输入ref到diff", - LcEnteRefName: "输入ref:", + LcDiff: "差异", + LcEnterRefToDiff: "输入 ref 以 diff", // TODO + LcEnteRefName: "输入 ref:", LcExitDiffMode: "退出差异模式", - DiffingMenuTitle: "差异化", - LcSwapDiff: "反向差异方向", - LcOpenDiffingMenu: "打开差异菜单", - // the actual view is the extras view which I intend to give more tabs in future but for now we'll only mention the command log part + DiffingMenuTitle: "diff 中", // TODO + LcSwapDiff: "反向 diff", + LcOpenDiffingMenu: "打开 diff 菜单", LcOpenExtrasMenu: "打开命令日志菜单", - LcShowingGitDiff: "显示输出:", - LcCopyCommitShaToClipboard: "将提交SHA复制到剪贴板", + LcShowingGitDiff: "显示输出:", // TODO + LcCopyCommitShaToClipboard: "将提交的 SHA 复制到剪贴板", LcCopyCommitMessageToClipboard: "将提交消息复制到剪贴板", LcCopyBranchNameToClipboard: "将分支名称复制到剪贴板", LcCopyFileNameToClipboard: "将文件名复制到剪贴板", @@ -406,58 +380,68 @@ func chineseTranslationSet() TranslationSet { NoFilesStagedTitle: "没有暂存文件", NoFilesStagedPrompt: "您尚未暂存任何文件。提交所有文件?", BranchNotFoundTitle: "找不到分支", - BranchNotFoundPrompt: "找不到分支。创建一个新分支命名为", - UnstageLinesTitle: "Unstage行", - UnstageLinesPrompt: "您确定要删除所选的行(git reset)吗?这是不可逆的。\n要禁用此对话框,请将'gui.skipUnstageLineWarning'的配置键设置为true", + BranchNotFoundPrompt: "找不到分支。创建一个新分支命名为:", + UnstageLinesTitle: "未暂存的行", + UnstageLinesPrompt: "您确定要删除所选的行(git reset)吗?这是不可逆的。\n要禁用此对话框,请将 'gui.skipUnstageLineWarning' 的配置键设置为 true", LcCreateNewBranchFromCommit: "从提交创建新分支", - LcViewStashFiles: "查看stash条目的文件", - LcBuildingPatch: "构建补丁", + LcViewStashFiles: "查看贮藏条目中的文件", + LcBuildingPatch: "正在构建补丁", LcViewCommits: "查看提交", - MinGitVersionError: "Git版本必须至少为2.0(即从2014年开始)。请升级您的git版本。或者在https://github.com/jesseduffield/lazygit/issues上提出一个问题,以使lazygit更加向后兼容。", - LcRunningCustomCommandStatus: "运行自定义命令", + MinGitVersionError: "Git 版本必须至少为 2.0(即从 2014 年开始)。请升级您的 git 版本。或者在 https://github.com/jesseduffield/lazygit/issues 上提出一个问题,以使 lazygit 更加向后兼容。", + LcRunningCustomCommandStatus: "正在运行自定义命令", LcSubmoduleStashAndReset: "存放未提交的子模块更改和更新", LcAndResetSubmodules: "和重置子模块", LcEnterSubmodule: "输入子模块", LcCopySubmoduleNameToClipboard: "将子模块名称复制到剪贴板", RemoveSubmodule: "删除子模块", LcRemoveSubmodule: "删除子模块", - RemoveSubmodulePrompt: "您确定要删除子模块'%s'及其对应的目录吗?这是不可逆的。", - LcResettingSubmoduleStatus: "重置子模块", - LcNewSubmoduleName: "新的子模块名称:", - LcNewSubmoduleUrl: "新的子模块网址:", - LcNewSubmodulePath: "新的子模块路径:", + RemoveSubmodulePrompt: "您确定要删除子模块 %s 及其对应的目录吗?这是不可逆的。", + LcResettingSubmoduleStatus: "正在重置子模块", + LcNewSubmoduleName: "新的子模块名称:", + LcNewSubmoduleUrl: "新的子模块 URL:", + LcNewSubmodulePath: "新的子模块路径:", LcAddSubmodule: "添加新的子模块", LcAddingSubmoduleStatus: "添加子模块", - LcUpdateSubmoduleUrl: "更新子模块'%s'的URL", - LcUpdatingSubmoduleUrlStatus: "更新URL", - LcEditSubmoduleUrl: "更新子模块URL", - LcInitializingSubmoduleStatus: "初始化子模块", + LcUpdateSubmoduleUrl: "更新子模块 %s 的 URL", + LcUpdatingSubmoduleUrlStatus: "更新 URL 中", + LcEditSubmoduleUrl: "更新子模块 URL", + LcInitializingSubmoduleStatus: "正在初始化子模块", LcInitSubmodule: "初始化子模块", LcViewResetAndRemoveOptions: "查看重置和删除子模块选项", LcSubmoduleUpdate: "更新子模块", - LcUpdatingSubmoduleStatus: "更新子模块", + LcUpdatingSubmoduleStatus: "正在更新子模块", LcBulkInitSubmodules: "批量初始化子模块", LcBulkUpdateSubmodules: "批量更新子模块", - LcBulkDeinitSubmodules: "批量deinit子模块", + LcBulkDeinitSubmodules: "批量反初始化子模块", LcViewBulkSubmoduleOptions: "查看批量子模块选项", LcBulkSubmoduleOptions: "批量子模块选项", LcRunningCommand: "运行命令", SubCommitsTitle: "子提交", SubmodulesTitle: "子模块", NavigationTitle: "列表面板导航", - SuggestionsTitle: "意见建议", + SuggestionsCheatsheetTitle: "意见建议", PushingTagStatus: "推送标签", - PullRequestURLCopiedToClipboard: "拉取请求网址已复制到剪贴板", + PullRequestURLCopiedToClipboard: "抓取请求网址已复制到剪贴板", CommitMessageCopiedToClipboard: "提交消息复制到剪贴板", LcCopiedToClipboard: "复制到剪贴板", - ErrCannotEditDirectory: "无法编辑目录:您只能编辑单个文件", + ErrCannotEditDirectory: "无法编辑目录:您只能编辑单个文件", ErrStageDirWithInlineMergeConflicts: "无法 暂存/取消暂存 包含具有内联合并冲突的文件的目录。请先解决合并冲突", - ErrRepositoryMovedOrDeleted: "找不到仓库。它可能已被移动或删除¯\\ _(ツ)_ /¯ ¯\\_(ツ)_/¯", + ErrRepositoryMovedOrDeleted: "找不到仓库。它可能已被移动或删除 ¯\\_(ツ)_/¯", CommandLog: "命令日志", ToggleShowCommandLog: "切换 显示/隐藏 命令日志", FocusCommandLog: "焦点命令日志", - CommandLogHeader: "您可以通过按'%s'隐藏或集中显示该面板,或使用 `gui.showCommandLog: false`\n将其永久隐藏在您的配置中", + CommandLogHeader: "您可以通过按 '%s' 隐藏或集中显示该面板,或使用 `gui.showCommandLog: false`\n将其永久隐藏在您的配置中", RandomTip: "随机提示", + SelectParentCommitForMerge: "选择父提交进行合并", + ToggleWhitespaceInDiffView: "切换是否在差异视图中显示空白更改", + IgnoringWhitespaceInDiffView: "差异视图中的空格将被忽略", + ShowingWhitespaceInDiffView: "空白将显示在差异视图中", + CreatePullRequest: "创建抓取请求", + CreatePullRequestOptions: "创建抓取请求选项", + LcCreatePullRequestOptions: "创建抓取请求选项", + LcDefaultBranch: "默认分支", + LcSelectBranch: "选择分支", + CreatingPullRequestAtUrl: "在 URL 创建抓取请求: %s", Spans: Spans{ // TODO: combine this with the original keybinding descriptions (those are all in lowercase atm) CheckoutCommit: "检出提交", @@ -470,10 +454,10 @@ func chineseTranslationSet() TranslationSet { RebaseBranch: "变基分支", RenameBranch: "重命名分支", CreateBranch: "建立分支", - CherryPick: "(Cherry-pick) 粘贴提交", + CherryPick: "拣选提交", CheckoutFile: "检出文件", DiscardOldFileChange: "放弃旧文件更改", - SquashCommitDown: "向下聚合提交", + SquashCommitDown: "向下压缩提交", FixupCommit: "修正提交", RewordCommit: "改写提交", DropCommit: "删除提交", @@ -481,7 +465,7 @@ func chineseTranslationSet() TranslationSet { AmendCommit: "修改提交", RevertCommit: "还原提交", CreateFixupCommit: "创建修正提交", - SquashAllAboveFixupCommits: "聚合所有以上的修正提交", + SquashAllAboveFixupCommits: "压缩所有以上的修正提交", CreateLightweightTag: "创建轻量级标签", CopyCommitMessageToClipboard: "将提交消息复制到剪贴板", MoveCommitUp: "向上提交", diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go index 0b56ffe78..f0e5e8d2a 100644 --- a/pkg/i18n/dutch.go +++ b/pkg/i18n/dutch.go @@ -4,15 +4,12 @@ func dutchTranslationSet() TranslationSet { return TranslationSet{ NotEnoughSpace: "Niet genoeg ruimte om de panelen te renderen", DiffTitle: "Diff", - LogTitle: "Log", FilesTitle: "Bestanden", BranchesTitle: "Branches", CommitsTitle: "Commits", StashTitle: "Stash", UnstagedChanges: `Unstaged wijzigingen`, StagedChanges: `Staged wijzigingen`, - PatchBuildingMainTitle: `Voeg lijnen/hunks toe aan patch`, - MergingMainTitle: "Los merge conflicten op", MainTitle: "Hoofd", StagingTitle: "Staging", NormalTitle: "Normaal", @@ -30,22 +27,18 @@ func dutchTranslationSet() TranslationSet { LcNavigate: "navigeer", LcMenu: "menu", LcExecute: "uitvoeren", - LcOpen: "open", - LcIgnore: "negeren", - LcDelete: "verwijderen", LcToggleStaged: "toggle staged", LcToggleStagedAll: "toggle staged alle", LcRefresh: "verversen", LcPush: "push", LcPull: "pull", - LcEdit: "bewerken", LcScroll: "scroll", - LcAbortMerge: "samenvoegen afbreken", - LcResolveMergeConflicts: "los merge conflicten op", + LcCommitFileFilter: "Commit dossiers filteren", + FilterStagedFiles: "Show only staged files", + FilterUnstagedFiles: "Show only unstaged files", + ResetCommitFilterState: "Reset commit file state filter", MergeConflictsTitle: "Merge Conflicten", LcCheckout: "uitchecken", - FileHasNoUnstagedChanges: "Het bestand heeft geen unstaged veranderingen om toe te voegen", - CannotGitAdd: "Kan commando niet uitvoeren git add --path untracked files", NoFilesDisplay: "Geen bestanden om te laten zien", NotAFile: "Dit is geen bestand", PullWait: "Pullen...", @@ -53,7 +46,6 @@ func dutchTranslationSet() TranslationSet { FetchWait: "Fetchen...", FileNoMergeCons: "Dit bestand heeft geen merge conflicten", LcSoftReset: "zacht reset", - SureTo: "Weet je het zeker dat je {{.fileName}} wilt {{.deleteVerb}} (je veranderingen zullen worden verwijderd)", AlreadyCheckedOutBranch: "Je hebt deze branch al uitgecheckt", SureForceCheckout: "Weet je zeker dat je het uitchecken wil forceren? Al je lokale verandering zullen worden verwijdert", ForceCheckoutBranch: "Forceer uitchecken op deze branch", @@ -67,27 +59,20 @@ func dutchTranslationSet() TranslationSet { CantRebaseOntoSelf: "Je kan niet een branch rebasen op zichzelf", CantMergeBranchIntoItself: "Je kan niet een branch in zichzelf mergen", LcForceCheckout: "forceer checkout", - LcMerge: "samenvoegen", LcCheckoutByName: "uitchecken bij naam", LcNewBranch: "nieuwe branch", LcDeleteBranch: "verwijder branch", - LcForceDeleteBranch: "verwijder branch (forceer)", NoBranchesThisRepo: "Geen branches voor deze repo", - NoTrackingThisBranch: "deze branch wordt niet gevolgd", CommitMessageConfirm: "{{.keyBindClose}}: Sluiten, {{.keyBindNewLine}}: Nieuwe lijn, {{.keyBindConfirm}}: Bevestig", CommitWithoutMessageErr: "Je kan geen commit maken zonder commit bericht", CloseConfirm: "{{.keyBindClose}}: Sluiten, {{.keyBindConfirm}}: Bevestig", LcClose: "sluiten", LcQuit: "quit", - SureResetThisCommit: "Weet je het zeker dat je wil resetten naar deze commit?", - ResetToCommit: "Reset Naar Commit", LcSquashDown: "squash beneden", - LcRename: "hernoemen", LcResetToThisCommit: "reset naar deze commit", LcFixupCommit: "Fixup commit", OnlySquashTopmostCommit: "Kan alleen bovenste commit squashen", YouNoCommitsToSquash: "Je hebt geen commits om mee te squashen", - CantFixupWhileUnstagedChanges: "Kan geen Fixup uitvoeren op unstaged veranderingen", Fixup: "Fixup", SureFixupThisCommit: "Weet je zeker dat je fixup wil uitvoeren op deze commit? De commit hieronder zol worden squashed in deze", SureSquashThisCommit: "Weet je zeker dat je deze commit wil samenvoegen met de commit hieronder?", @@ -102,14 +87,12 @@ func dutchTranslationSet() TranslationSet { LcEditCommit: "wijzig commit", LcAmendToCommit: "wijzig commit met staged veranderingen", LcRenameCommitEditor: "hernoem commit met editor", - PotentialErrInGetselectedCommit: "Er is mogelijk een error in getSelected Commit (geen match tussen ui en state)", NoCommitsThisBranch: "Geen commits in deze branch", Error: "Foutmelding", - RunningSubprocess: "subprocess lopend", LcSelectHunk: "selecteer stuk", LcNavigateConflicts: "navigeer conflicts", LcPickHunk: "kies stuk", - LcPickBothHunks: "kies beide stukken", + LcPickAllHunks: "kies beide stukken", LcUndo: "ongedaan maken", LcUndoReflog: "ongedaan maken (via reflog) (experimenteel)", LcRedoReflog: "redo (via reflog) (experimenteel)", @@ -126,8 +109,6 @@ func dutchTranslationSet() TranslationSet { NoStashTo: "Geen stash voor {{.method}}", NoTrackedStagedFilesStash: "Je hebt geen tracked/staged bestanden om te laten stashen", StashChanges: "Stash veranderingen", - IssntListOfViews: "{{.name}} is niet in de lijst van weergaves", - LcNewFocusedViewIs: "nieuw gefocussed weergave is {{.newFocusedView}}", NoChangedFiles: "Geen veranderde bestanden", MergeAborted: "Merge afgebroken", OpenConfig: "open config bestand", @@ -141,8 +122,6 @@ func dutchTranslationSet() TranslationSet { OnLatestVersionErr: "Je hebt al de laatste versie", MajorVersionErr: "Nieuwe versie ({{.newVersion}}) is niet backwards compatibele vergeleken met de huidige versie ({{.currentVersion}})", CouldNotFindBinaryErr: "Kon geen binary vinden op {{.url}}", - AnonymousReportingTitle: "Help lazygit te verbeteren", - AnonymousReportingPrompt: "Zou je anonieme data rapportage willen aanzetten om lazygit beter te kunnen maken? (enter/esc)", IntroPopupMessage: "Bedankt voor het gebruik maken van lazygit! 2 dingen die je moet weten:\n\n1) Als je meer van lazygit zijn features wilt leren bekijk dan deze video:\n https://youtu.be/CPLdltN7wgE\n\n2) Als je git gebruikt, ben je een programmeur! Met jouw hulp kunnen we lazygit verbeteren, dus overweeg om een ​​donateur te worden en mee te doen aan het plezier op\n https://github.com/jesseduffield/lazygit", GitconfigParseErr: `Gogit kon je gitconfig bestand niet goed parsen door de aanwezigheid van losstaande '\' tekens. Het weghalen van deze tekens zou het probleem moeten oplossen. `, LcEditFile: `verander bestand`, @@ -162,24 +141,19 @@ func dutchTranslationSet() TranslationSet { NoAutomaticGitFetchBody: `Lazygit kan niet "git fetch" uitvoeren in een privé repository, gebruik f in het branches paneel om "git fetch" manueel uit te voeren`, FileEnter: `stage individuele hunks/lijnen`, FileStagingRequirements: `Kan alleen individuele lijnen stagen van getrackte bestanden met onstaged veranderingen`, - SelectHunk: `selecteer hunk`, StageSelection: `toggle lijnen staged / unstaged`, ResetSelection: `verwijdert change (git reset)`, ToggleDragSelect: `toggle drag selecteer`, ToggleSelectHunk: `toggle selecteer hunk`, ToggleSelectionForPatch: `voeg toe/verwijder lijn(en) in patch`, TogglePanel: `ga naar een ander paneel`, - CantStageStaged: `Je kan niet al gestaged verandering stagen!`, ReturnToFilesPanel: `ga terug naar het bestanden paneel`, - CantFindHunks: `Kan geen hunks vinden in deze patch`, - CantFindHunk: `Kan geen hunk vinden`, FastForward: `fast-forward deze branch vanaf zijn upstream`, Fetching: "fetching en fast-forwarding {{.from}} -> {{.to}} ...", FoundConflicts: "Conflicten!, Om af te breken druk 'esc', anders druk op 'enter'", FoundConflictsTitle: "Auto-merge mislukt", - Undo: "ongedaan maken", PickHunk: "kies hunk", - PickBothHunks: "kies bijde hunks", + PickAllHunks: "kies bijde hunks", ViewMergeRebaseOptions: "bekijk merge/rebase opties", NotMergingOrRebasing: "Je bent momenteel niet aan het rebasen of mergen", RecentRepos: "recente repositories", @@ -189,7 +163,6 @@ func dutchTranslationSet() TranslationSet { LocalBranchesTitle: "Branches Tabblad", SearchTitle: "Zoek", TagsTitle: "Tags Tabblad", - BranchCommitsTitle: "Commits Tabblad", MenuTitle: "Menu", RemotesTitle: "Remotes Tabblad", CredentialsTitle: "Credentials", @@ -198,7 +171,6 @@ func dutchTranslationSet() TranslationSet { InformationTitle: "Informatie", SecondaryTitle: "Secondary", ReflogCommitsTitle: "Reflog Tabblad", - Title: "Title", GlobalTitle: "Globale Sneltoetsen", ConflictsResolved: "alle merge conflicten zijn opgelost. Wilt je verder gaan?", RebasingTitle: "Rebasen", @@ -225,8 +197,8 @@ func dutchTranslationSet() TranslationSet { NextHunk: "selecteer de volgende hunk", PrevConflict: "selecteer voorgaand conflict", NextConflict: "selecteer volgende conflict", - SelectTop: "selecteer bovenste hunk", - SelectBottom: "selecteer onderste hunk", + SelectPrevHunk: "selecteer bovenste hunk", + SelectNextHunk: "selecteer onderste hunk", ScrollDown: "scroll omlaag", ScrollUp: "scroll omhoog", LcScrollUpMainPanel: "scroll naar beneden vanaf hoofdpaneel", @@ -248,8 +220,6 @@ func dutchTranslationSet() TranslationSet { CommitFiles: "Commit bestanden", LcViewCommitFiles: "bekijk gecommite bestanden", CommitFilesTitle: "Commit bestanden", - LcGoBack: "ga terug", - NoCommiteFiles: "Geen bestanden voor deze commit", LcCheckoutCommitFile: "bestand uitchecken", LcDiscardOldFileChange: "uitsluit deze commit zijn veranderingen aan dit bestand", DiscardFileChangesTitle: "uitsluit bestand zijn veranderingen", @@ -268,7 +238,6 @@ func dutchTranslationSet() TranslationSet { LcDiscardUntrackedFiles: "negeer niet-gevonden bestanden", LcViewResetOptions: `bekijk reset opties`, LcHardReset: "harde reset", - LcHardResetUpstream: "harde naar upstream branch", LcCreateFixupCommit: `creëer fixup commit voor deze commit`, LcSquashAboveCommits: `squash bovenstaande commits`, SquashAboveCommits: `Squash bovenstaande commits`, @@ -297,8 +266,6 @@ func dutchTranslationSet() TranslationSet { LcEnterFile: "enter bestand om geselecteerde regels toe te voegen aan de patch", ExitLineByLineMode: `sluit lijn-bij-lijn modus`, EnterUpstream: `Enter upstream als ' '`, - EnterUpstreamWithSlash: `Enter upstream als '/'`, - LcNotTrackingRemote: "(nog geen remote aan het volgen)", ReturnToRemotesList: `Ga terug naar remotes lijst`, LcAddNewRemote: `voeg een nieuwe remote toe`, LcNewRemoteName: `Nieuwe remote name:`, @@ -360,7 +327,7 @@ func dutchTranslationSet() TranslationSet { LcFilterBy: "filter bij", LcExitFilterMode: "stop met filteren bij pad", LcFilterPathOption: "vulin pad om op te filteren", - LcEnterFileName: "vulin path:", + EnterFileName: "Vulin path:", FilteringMenuTitle: "Filteren", MustExitFilterModeTitle: "Command niet beschikbaar", MustExitFilterModePrompt: "Command niet beschikbaar in filter modus. Sluit filter modus?", diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index bfb0b7d54..1a825944f 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -13,15 +13,12 @@ package i18n type TranslationSet struct { NotEnoughSpace string DiffTitle string - LogTitle string FilesTitle string BranchesTitle string CommitsTitle string StashTitle string UnstagedChanges string StagedChanges string - PatchBuildingMainTitle string - MergingMainTitle string MainTitle string StagingTitle string MergingTitle string @@ -41,9 +38,6 @@ type TranslationSet struct { LcNavigate string LcMenu string LcExecute string - LcOpen string - LcIgnore string - LcDelete string LcToggleStaged string LcToggleStagedAll string LcToggleTreeView string @@ -51,15 +45,14 @@ type TranslationSet struct { LcRefresh string LcPush string LcPull string - LcEdit string LcScroll string - LcAbortMerge string - LcResolveMergeConflicts string + LcCommitFileFilter string + FilterStagedFiles string + FilterUnstagedFiles string + ResetCommitFilterState string MergeConflictsTitle string LcCheckout string NoChangedFiles string - FileHasNoUnstagedChanges string - CannotGitAdd string NoFilesDisplay string NotAFile string PullWait string @@ -67,7 +60,6 @@ type TranslationSet struct { FetchWait string FileNoMergeCons string LcSoftReset string - SureTo string AlreadyCheckedOutBranch string SureForceCheckout string ForceCheckoutBranch string @@ -81,27 +73,20 @@ type TranslationSet struct { CantRebaseOntoSelf string CantMergeBranchIntoItself string LcForceCheckout string - LcMerge string LcCheckoutByName string LcNewBranch string LcDeleteBranch string - LcForceDeleteBranch string NoBranchesThisRepo string - NoTrackingThisBranch string CommitMessageConfirm string CommitWithoutMessageErr string CloseConfirm string LcClose string LcQuit string - SureResetThisCommit string - ResetToCommit string LcSquashDown string - LcRename string LcResetToThisCommit string LcFixupCommit string OnlySquashTopmostCommit string YouNoCommitsToSquash string - CantFixupWhileUnstagedChanges string Fixup string SureFixupThisCommit string SureSquashThisCommit string @@ -116,14 +101,12 @@ type TranslationSet struct { LcEditCommit string LcAmendToCommit string LcRenameCommitEditor string - PotentialErrInGetselectedCommit string NoCommitsThisBranch string Error string - RunningSubprocess string LcSelectHunk string LcNavigateConflicts string LcPickHunk string - LcPickBothHunks string + LcPickAllHunks string LcUndo string LcUndoReflog string LcRedoReflog string @@ -140,8 +123,6 @@ type TranslationSet struct { NoStashTo string NoTrackedStagedFilesStash string StashChanges string - IssntListOfViews string - LcNewFocusedViewIs string MergeAborted string OpenConfig string EditConfig string @@ -154,8 +135,6 @@ type TranslationSet struct { OnLatestVersionErr string MajorVersionErr string CouldNotFindBinaryErr string - AnonymousReportingTitle string - AnonymousReportingPrompt string MergeToolTitle string MergeToolPrompt string IntroPopupMessage string @@ -177,24 +156,19 @@ type TranslationSet struct { NoAutomaticGitFetchBody string FileEnter string FileStagingRequirements string - SelectHunk string StageSelection string ResetSelection string ToggleDragSelect string ToggleSelectHunk string ToggleSelectionForPatch string TogglePanel string - CantStageStaged string ReturnToFilesPanel string - CantFindHunks string - CantFindHunk string FastForward string Fetching string FoundConflicts string FoundConflictsTitle string - Undo string PickHunk string - PickBothHunks string + PickAllHunks string ViewMergeRebaseOptions string NotMergingOrRebasing string RecentRepos string @@ -204,7 +178,6 @@ type TranslationSet struct { LocalBranchesTitle string SearchTitle string TagsTitle string - BranchCommitsTitle string MenuTitle string RemotesTitle string CredentialsTitle string @@ -213,7 +186,6 @@ type TranslationSet struct { InformationTitle string SecondaryTitle string ReflogCommitsTitle string - Title string ConflictsResolved string RebasingTitle string ConfirmRebase string @@ -239,8 +211,8 @@ type TranslationSet struct { NextHunk string PrevConflict string NextConflict string - SelectTop string - SelectBottom string + SelectPrevHunk string + SelectNextHunk string ScrollDown string ScrollUp string LcScrollUpMainPanel string @@ -263,8 +235,6 @@ type TranslationSet struct { CommitFiles string LcViewCommitFiles string CommitFilesTitle string - LcGoBack string - NoCommiteFiles string LcCheckoutCommitFile string LcDiscardOldFileChange string DiscardFileChangesTitle string @@ -282,7 +252,6 @@ type TranslationSet struct { LcDiscardAnyUnstagedChanges string LcDiscardUntrackedFiles string LcHardReset string - LcHardResetUpstream string LcViewResetOptions string LcCreateFixupCommit string LcSquashAboveCommits string @@ -312,8 +281,6 @@ type TranslationSet struct { LcEnterFile string ExitLineByLineMode string EnterUpstream string - EnterUpstreamWithSlash string - LcNotTrackingRemote string ReturnToRemotesList string LcAddNewRemote string LcNewRemoteName string @@ -375,7 +342,7 @@ type TranslationSet struct { LcFilterBy string LcExitFilterMode string LcFilterPathOption string - LcEnterFileName string + EnterFileName string FilteringMenuTitle string MustExitFilterModeTitle string MustExitFilterModePrompt string @@ -394,6 +361,7 @@ type TranslationSet struct { LcCopyFileNameToClipboard string LcCopyCommitFileNameToClipboard string LcCommitPrefixPatternError string + LcCopySelectedTexToClipboard string NoFilesStagedTitle string NoFilesStagedPrompt string BranchNotFoundTitle string @@ -436,6 +404,8 @@ type TranslationSet struct { SubCommitsTitle string SubmodulesTitle string NavigationTitle string + SuggestionsCheatsheetTitle string + // Unlike the cheatsheet title above, the real suggestions title has a little message saying press tab to focus SuggestionsTitle string ExtrasTitle string PushingTagStatus string @@ -460,6 +430,10 @@ type TranslationSet struct { LcSelectBranch string CreateOrShowPullRequest string CreatingPullRequestAtUrl string + SelectConfigFile string + NoConfigFileFoundErr string + LcLoadingFileSuggestions string + MustSpecifyOriginError string Spans Spans } @@ -510,6 +484,7 @@ type Spans struct { GitFlowFinish string GitFlowStart string CopyToClipboard string + CopySelectedTextToClipboard string RemovePatchFromCommit string MovePatchToSelectedCommit string MovePatchIntoIndex string @@ -565,15 +540,12 @@ func englishTranslationSet() TranslationSet { return TranslationSet{ NotEnoughSpace: "Not enough space to render panels", DiffTitle: "Diff", - LogTitle: "Log", FilesTitle: "Files", BranchesTitle: "Branches", CommitsTitle: "Commits", StashTitle: "Stash", UnstagedChanges: `Unstaged Changes`, StagedChanges: `Staged Changes`, - PatchBuildingMainTitle: `Add Lines/Hunks To Patch`, - MergingMainTitle: "Resolve merge conflicts", MainTitle: "Main", StagingTitle: "Staging", MergingTitle: "Merging", @@ -592,9 +564,6 @@ func englishTranslationSet() TranslationSet { LcNavigate: "navigate", LcMenu: "menu", LcExecute: "execute", - LcOpen: "open", - LcIgnore: "ignore", - LcDelete: "delete", LcToggleStaged: "toggle staged", LcToggleStagedAll: "stage/unstage all", LcToggleTreeView: "toggle file tree view", @@ -602,15 +571,14 @@ func englishTranslationSet() TranslationSet { LcRefresh: "refresh", LcPush: "push", LcPull: "pull", - LcEdit: "edit", LcScroll: "scroll", - LcAbortMerge: "abort merge", - LcResolveMergeConflicts: "resolve merge conflicts", MergeConflictsTitle: "Merge Conflicts", LcCheckout: "checkout", + LcCommitFileFilter: "Filter commit files", + FilterStagedFiles: "Show only staged files", + FilterUnstagedFiles: "Show only unstaged files", + ResetCommitFilterState: "Reset filter", NoChangedFiles: "No changed files", - FileHasNoUnstagedChanges: "File has no unstaged changes to add", - CannotGitAdd: "Cannot git add --patch untracked files", NoFilesDisplay: "No file to display", NotAFile: "Not a file", PullWait: "Pulling...", @@ -618,7 +586,6 @@ func englishTranslationSet() TranslationSet { FetchWait: "Fetching...", FileNoMergeCons: "This file has no inline merge conflicts", LcSoftReset: "soft reset", - SureTo: "Are you sure you want to {{.deleteVerb}} {{.fileName}} (you will lose your changes)?", AlreadyCheckedOutBranch: "You have already checked out this branch", SureForceCheckout: "Are you sure you want force checkout? You will lose all local changes", ForceCheckoutBranch: "Force Checkout Branch", @@ -632,28 +599,21 @@ func englishTranslationSet() TranslationSet { CantRebaseOntoSelf: "You cannot rebase a branch onto itself", CantMergeBranchIntoItself: "You cannot merge a branch into itself", LcForceCheckout: "force checkout", - LcMerge: "merge", LcCheckoutByName: "checkout by name", LcNewBranch: "new branch", LcDeleteBranch: "delete branch", - LcForceDeleteBranch: "delete branch (force)", NoBranchesThisRepo: "No branches for this repo", - NoTrackingThisBranch: "There is no tracking for this branch", CommitMessageConfirm: "{{.keyBindClose}}: close, {{.keyBindNewLine}}: new line, {{.keyBindConfirm}}: confirm", CommitWithoutMessageErr: "You cannot commit without a commit message", CloseConfirm: "{{.keyBindClose}}: close, {{.keyBindConfirm}}: confirm", LcClose: "close", LcQuit: "quit", - SureResetThisCommit: "Are you sure you want to reset to this commit?", - ResetToCommit: "Reset To Commit", LcSquashDown: "squash down", - LcRename: "rename", LcResetToThisCommit: "reset to this commit", LcFixupCommit: "fixup commit", NoCommitsThisBranch: "No commits for this branch", OnlySquashTopmostCommit: "Can only squash topmost commit", YouNoCommitsToSquash: "You have no commits to squash with", - CantFixupWhileUnstagedChanges: "Can't fixup while there are unstaged changes", Fixup: "Fixup", SureFixupThisCommit: "Are you sure you want to 'fixup' this commit? It will be merged into the commit below", SureSquashThisCommit: "Are you sure you want to squash this commit into the commit below?", @@ -668,13 +628,11 @@ func englishTranslationSet() TranslationSet { LcEditCommit: "edit commit", LcAmendToCommit: "amend commit with staged changes", LcRenameCommitEditor: "rename commit with editor", - PotentialErrInGetselectedCommit: "potential error in getSelected Commit (mismatched ui and state)", Error: "Error", - RunningSubprocess: "running subprocess", LcSelectHunk: "select hunk", LcNavigateConflicts: "navigate conflicts", LcPickHunk: "pick hunk", - LcPickBothHunks: "pick both hunks", + LcPickAllHunks: "pick all hunks", LcUndo: "undo", LcUndoReflog: "undo (via reflog) (experimental)", LcRedoReflog: "redo (via reflog) (experimental)", @@ -691,8 +649,6 @@ func englishTranslationSet() TranslationSet { NoStashTo: "No stash to {{.method}}", NoTrackedStagedFilesStash: "You have no tracked/staged files to stash", StashChanges: "Stash changes", - IssntListOfViews: "{{.name}} is not in the list of views", - LcNewFocusedViewIs: "new focused view is {{.newFocusedView}}", MergeAborted: "Merge aborted", OpenConfig: "open config file", EditConfig: "edit config file", @@ -705,8 +661,6 @@ func englishTranslationSet() TranslationSet { OnLatestVersionErr: "You already have the latest version", MajorVersionErr: "New version ({{.newVersion}}) has non-backwards compatible changes compared to the current version ({{.currentVersion}})", CouldNotFindBinaryErr: "Could not find any binary at {{.url}}", - AnonymousReportingTitle: "Help make lazygit better", - AnonymousReportingPrompt: "Would you like to enable anonymous reporting data to help improve lazygit? (enter/esc)", MergeToolTitle: "Merge tool", MergeToolPrompt: "Are you sure you want to open `git mergetool`?", IntroPopupMessage: englishIntroPopupMessage, @@ -728,24 +682,19 @@ func englishTranslationSet() TranslationSet { NoAutomaticGitFetchBody: `Lazygit can't use "git fetch" in a private repo; use 'f' in the files panel to run "git fetch" manually`, FileEnter: `stage individual hunks/lines for file, or collapse/expand for directory`, FileStagingRequirements: `Can only stage individual lines for tracked files`, - SelectHunk: `select hunk`, StageSelection: `toggle line staged / unstaged`, ResetSelection: `delete change (git reset)`, ToggleDragSelect: `toggle drag select`, ToggleSelectHunk: `toggle select hunk`, ToggleSelectionForPatch: `add/remove line(s) to patch`, TogglePanel: `switch to other panel`, - CantStageStaged: `You can't stage an already staged change!`, ReturnToFilesPanel: `return to files panel`, - CantFindHunks: `Could not find any hunks in this patch`, - CantFindHunk: `Could not find hunk`, FastForward: `fast-forward this branch from its upstream`, Fetching: "fetching and fast-forwarding {{.from}} -> {{.to}} ...", FoundConflicts: "Conflicts! To abort press 'esc', otherwise press 'enter'", FoundConflictsTitle: "Auto-merge failed", - Undo: "undo", PickHunk: "pick hunk", - PickBothHunks: "pick both hunks", + PickAllHunks: "pick all hunks", ViewMergeRebaseOptions: "view merge/rebase options", NotMergingOrRebasing: "You are currently neither rebasing nor merging", RecentRepos: "recent repositories", @@ -755,7 +704,6 @@ func englishTranslationSet() TranslationSet { LocalBranchesTitle: "Branches Tab", SearchTitle: "Search", TagsTitle: "Tags Tab", - BranchCommitsTitle: "Commits Tab", MenuTitle: "Menu", RemotesTitle: "Remotes Tab", CredentialsTitle: "Credentials", @@ -764,7 +712,6 @@ func englishTranslationSet() TranslationSet { InformationTitle: "Information", SecondaryTitle: "Secondary", ReflogCommitsTitle: "Reflog Tab", - Title: "Title", GlobalTitle: "Global Keybindings", ConflictsResolved: "all merge conflicts resolved. Continue?", RebasingTitle: "Rebasing", @@ -791,8 +738,8 @@ func englishTranslationSet() TranslationSet { NextHunk: "select next hunk", PrevConflict: "select previous conflict", NextConflict: "select next conflict", - SelectTop: "select top hunk", - SelectBottom: "select bottom hunk", + SelectPrevHunk: "select previous hunk", + SelectNextHunk: "select next hunk", ScrollDown: "scroll down", ScrollUp: "scroll up", LcScrollUpMainPanel: "scroll up main panel", @@ -815,8 +762,6 @@ func englishTranslationSet() TranslationSet { CommitFiles: "Commit files", LcViewCommitFiles: "view commit's files", CommitFilesTitle: "Commit Files", - LcGoBack: "go back", - NoCommiteFiles: "No files for this commit", LcCheckoutCommitFile: "checkout file", LcDiscardOldFileChange: "discard this commit's changes to this file", DiscardFileChangesTitle: "Discard file changes", @@ -834,7 +779,6 @@ func englishTranslationSet() TranslationSet { LcDiscardAnyUnstagedChanges: "discard unstaged changes", LcDiscardUntrackedFiles: "discard untracked files", LcHardReset: "hard reset", - LcHardResetUpstream: "hard reset to upstream branch", LcViewResetOptions: `view reset options`, LcCreateFixupCommit: `create fixup commit for this commit`, LcSquashAboveCommits: `squash all 'fixup!' commits above selected commit (autosquash)`, @@ -864,8 +808,6 @@ func englishTranslationSet() TranslationSet { LcEnterFile: "enter file to add selected lines to the patch (or toggle directory collapsed)", ExitLineByLineMode: `exit line-by-line mode`, EnterUpstream: `Enter upstream as ' '`, - EnterUpstreamWithSlash: `Enter upstream as '/'`, - LcNotTrackingRemote: "(not tracking any remote)", ReturnToRemotesList: `Return to remotes list`, LcAddNewRemote: `add new remote`, LcNewRemoteName: `New remote name:`, @@ -927,7 +869,7 @@ func englishTranslationSet() TranslationSet { LcFilterBy: "filter by", LcExitFilterMode: "stop filtering by path", LcFilterPathOption: "enter path to filter by", - LcEnterFileName: "enter path:", + EnterFileName: "Enter path:", FilteringMenuTitle: "Filtering", MustExitFilterModeTitle: "Command not available", MustExitFilterModePrompt: "Command not available in filtered mode. Exit filtered mode?", @@ -946,6 +888,7 @@ func englishTranslationSet() TranslationSet { LcCopyBranchNameToClipboard: "copy branch name to clipboard", LcCopyFileNameToClipboard: "copy the file name to the clipboard", LcCopyCommitFileNameToClipboard: "copy the committed file name to the clipboard", + LcCopySelectedTexToClipboard: "copy the selected text to the clipboard", LcCommitPrefixPatternError: "Error in commitPrefix pattern", NoFilesStagedTitle: "No files staged", NoFilesStagedPrompt: "You have not staged any files. Commit all files?", @@ -989,7 +932,8 @@ func englishTranslationSet() TranslationSet { SubCommitsTitle: "Sub-commits", SubmodulesTitle: "Submodules", NavigationTitle: "List Panel Navigation", - SuggestionsTitle: "Suggestions", + SuggestionsCheatsheetTitle: "Suggestions", + SuggestionsTitle: "Suggestions (press %s to focus)", ExtrasTitle: "Extras", PushingTagStatus: "pushing tag", PullRequestURLCopiedToClipboard: "Pull request URL copied to clipboard", @@ -1001,7 +945,7 @@ func englishTranslationSet() TranslationSet { CommandLog: "Command Log", ToggleShowCommandLog: "Toggle show/hide command log", FocusCommandLog: "Focus command log", - CommandLogHeader: "You can hide/focus this panel by pressing '%s' or hide it permanently in your config with `gui.showCommandLog: false`\n", + CommandLogHeader: "You can hide/focus this panel by pressing '%s'\n", RandomTip: "Random Tip", SelectParentCommitForMerge: "Select parent commit for merge", ToggleWhitespaceInDiffView: "Toggle whether or not whitespace changes are shown in the diff view", @@ -1013,6 +957,10 @@ func englishTranslationSet() TranslationSet { LcDefaultBranch: "default branch", LcSelectBranch: "select branch", CreatingPullRequestAtUrl: "Creating pull request at URL: %s", + SelectConfigFile: "Select config file", + NoConfigFileFoundErr: "No config file found", + LcLoadingFileSuggestions: "loading file suggestions", + MustSpecifyOriginError: "Must specify a remote if specifying a branch", Spans: Spans{ // TODO: combine this with the original keybinding descriptions (those are all in lowercase atm) CheckoutCommit: "Checkout commit", @@ -1061,6 +1009,7 @@ func englishTranslationSet() TranslationSet { GitFlowFinish: "Git flow finish", GitFlowStart: "Git Flow start", CopyToClipboard: "Copy to clipboard", + CopySelectedTextToClipboard: "Copy selected text to clipboard", RemovePatchFromCommit: "Remove patch from commit", MovePatchToSelectedCommit: "Move patch to selected commit", MovePatchIntoIndex: "Move patch into index", diff --git a/pkg/i18n/i18n.go b/pkg/i18n/i18n.go index dece062f4..8f6452c54 100644 --- a/pkg/i18n/i18n.go +++ b/pkg/i18n/i18n.go @@ -4,6 +4,7 @@ import ( "strings" "github.com/cloudfoundry/jibber_jabber" + "github.com/go-errors/errors" "github.com/imdario/mergo" "github.com/sirupsen/logrus" ) @@ -14,20 +15,31 @@ type Localizer struct { S TranslationSet } -// NewTranslationSet creates a new Localizer -func NewTranslationSet(log *logrus.Entry) *TranslationSet { - userLang := detectLanguage(jibber_jabber.DetectLanguage) +func NewTranslationSetFromConfig(log *logrus.Entry, configLanguage string) (*TranslationSet, error) { + if configLanguage == "auto" { + language := detectLanguage(jibber_jabber.DetectLanguage) + return NewTranslationSet(log, language), nil + } - log.Info("language: " + userLang) + for key := range GetTranslationSets() { + if key == configLanguage { + return NewTranslationSet(log, configLanguage), nil + } + } + + return NewTranslationSet(log, "en"), errors.New("Language not found: " + configLanguage) +} + +func NewTranslationSet(log *logrus.Entry, language string) *TranslationSet { + log.Info("language: " + language) baseSet := englishTranslationSet() for languageCode, translationSet := range GetTranslationSets() { - if strings.HasPrefix(userLang, languageCode) { + if strings.HasPrefix(language, languageCode) { _ = mergo.Merge(&baseSet, translationSet, mergo.WithOverride) } } - return &baseSet } diff --git a/pkg/i18n/polish.go b/pkg/i18n/polish.go index aed1ceb10..4c223d246 100644 --- a/pkg/i18n/polish.go +++ b/pkg/i18n/polish.go @@ -4,95 +4,79 @@ func polishTranslationSet() TranslationSet { return TranslationSet{ NotEnoughSpace: "Za mało miejsca do wyświetlenia paneli", DiffTitle: "Różnice", - LogTitle: "Log", FilesTitle: "Pliki", BranchesTitle: "Gałęzie", CommitsTitle: "Commity", StashTitle: "Schowek", - UnstagedChanges: `Unstaged Changes`, - StagedChanges: `Staged Changes`, - MergingMainTitle: "Resolve merge conflicts", - CommitMessage: "Wiadomość commita", - CredentialsUsername: "Username", - CredentialsPassword: "Password", - CredentialsPassphrase: "Passphrase", - PassUnameWrong: "Password, passphrase and/or username wrong", - CommitChanges: "commituj zmiany", - AmendLastCommit: "zmień ostatnie zatwierdzenie", - SureToAmend: "Czy na pewno chcesz zmienić ostatnie zatwierdzenie? Możesz zmienić komunikat zatwierdzenia z panelu zatwierdzeń.", - NoCommitToAmend: "Nie ma zobowiązania do zmiany.", - CommitChangesWithEditor: "commituj zmiany używając edytora z gita", + UnstagedChanges: "Zmiany poza poczekalnią", + StagedChanges: "Zmiany w poczekalni", + CommitMessage: "Komunikat commita", + CredentialsUsername: "Użytkownik", + CredentialsPassword: "Hasło", + CredentialsPassphrase: "Fraza", + PassUnameWrong: "Niewłaściwe hasło, fraza lub nazwa użytkownika", + CommitChanges: "Zatwierdź zmiany", + AmendLastCommit: "Zmień ostatni commit", + SureToAmend: "Czy na pewno chcesz zmienić ostatni commit? Możesz zmienić komunikat commitu z panelu commitów.", + NoCommitToAmend: "Brak commitów do zmiany.", + CommitChangesWithEditor: "Zatwierdź zmiany używając edytora", StatusTitle: "Status", GlobalTitle: "Globalne", LcNavigate: "nawiguj", LcMenu: "menu", LcExecute: "wykonaj", - LcOpen: "otwórz", - LcIgnore: "ignoruj", - LcDelete: "usuń", - LcToggleStaged: "przełącz zatwierdzenie", - LcToggleStagedAll: "przełącz wszystkie zatwierdzenia", + LcToggleStaged: "przełącz stan poczekalni", + LcToggleStagedAll: "przełącz stan poczekalni wszystkich", LcRefresh: "odśwież", - LcEdit: "edytuj", LcScroll: "przewiń", - LcAbortMerge: "o scalaniu", - LcResolveMergeConflicts: "rozwiąż konflikty scalania", + LcCommitFileFilter: "Filtrowanie commitów", + FilterStagedFiles: "Pokaż tylko pliki w poczekalni", + FilterUnstagedFiles: "Pokaż tylko pliki poza poczekalnią", + ResetCommitFilterState: "Resetuj filtr commitów", LcCheckout: "przełącz", NoChangedFiles: "Brak zmienionych plików", - FileHasNoUnstagedChanges: "Plik nie zawiera żadnych nieopublikowanych zmian do dodania", - CannotGitAdd: "Nie można git add --patch nieśledzonych plików", - NoFilesDisplay: "Brak pliku do wyświetlenia", - PullWait: "Wciąganie zmian...", - PushWait: "Wypychanie zmian...", - FetchWait: "Fetching...", - FileNoMergeCons: "Ten plik nie powoduje konfliktów scalania", - SureTo: "Jesteś pewny, że chcesz {{.deleteVerb}} {{.fileName}} (stracisz swoje wprowadzone zmiany)?", + NoFilesDisplay: "Brak plików do wyświetlenia", + PullWait: "Pobieranie zmian...", + PushWait: "Wysyłanie zmian...", + FetchWait: "Pobieram...", + FileNoMergeCons: "Brak konfliktów scalania w pliku", AlreadyCheckedOutBranch: "Już przęłączono na tą gałąź", SureForceCheckout: "Jesteś pewny, że chcesz wymusić przełączenie? Stracisz wszystkie lokalne zmiany", ForceCheckoutBranch: "Wymuś przełączenie gałęzi", BranchName: "Nazwa gałęzi", NewBranchNameBranchOff: "Nazwa nowej gałęzi (gałąź na bazie {{.branchName}})", - CantDeleteCheckOutBranch: "Nie możesz usunąć obecnej przełączonej gałęzi!", + CantDeleteCheckOutBranch: "Nie możesz usunąć obecnie przełączonej gałęzi!", DeleteBranch: "Usuń gałąź", DeleteBranchMessage: "Jesteś pewien, że chcesz usunąć gałąź {{.selectedBranchName}} ?", ForceDeleteBranchMessage: "Na pewno wymusić usunięcie gałęzi {{.selectedBranchName}}?", - LcRebaseBranch: "rebase branch", - CantRebaseOntoSelf: "You cannot rebase a branch onto itself", + LcRebaseBranch: "zmiana bazy gałęzi", + CantRebaseOntoSelf: "Nie możesz zmienić bazy gałęzi na nią samą", CantMergeBranchIntoItself: "Nie możesz scalić gałęzi do samej siebie", LcForceCheckout: "wymuś przełączenie", - LcMerge: "scal", LcCheckoutByName: "przełącz używając nazwy", LcNewBranch: "nowa gałąź", LcDeleteBranch: "usuń gałąź", - LcForceDeleteBranch: "usuń gałąź (wymuś)", NoBranchesThisRepo: "Brak gałęzi dla tego repozytorium", - NoTrackingThisBranch: "Brak śledzenia dla tej gałęzi", - CommitMessageConfirm: "{{.keyBindClose}}: zamknij, {{.keyBindNewLine}}: new line, {{.keyBindConfirm}}: potwierdź", - CommitWithoutMessageErr: "Nie możesz commitować bez podania wiadomości", + CommitMessageConfirm: "{{.keyBindClose}}: zamknij, {{.keyBindNewLine}}: nowa linia, {{.keyBindConfirm}}: potwierdź", + CommitWithoutMessageErr: "Nie możesz commitować bez komunikatu", CloseConfirm: "{{.keyBindClose}}: zamknij, {{.keyBindConfirm}}: potwierdź", LcClose: "zamknij", - SureResetThisCommit: "Jesteś pewny, że chcesz zresetować ten commit?", - ResetToCommit: "Zresetuj, aby commitować", - LcSquashDown: "ściśnij w dół", - LcRename: "przemianuj", + LcSquashDown: "ściśnij", LcResetToThisCommit: "zresetuj do tego commita", LcFixupCommit: "napraw commit", NoCommitsThisBranch: "Brak commitów dla tej gałęzi", - OnlySquashTopmostCommit: "Można tylko ścisnąć najwyższy commit", - YouNoCommitsToSquash: "Nie masz commitów do ściśnięcia", - CantFixupWhileUnstagedChanges: "Nie można wykonać naprawy, kiedy istnieją niezatwierdzone zmiany", + OnlySquashTopmostCommit: "Można tylko spłaszczyć najwyższy commit", + YouNoCommitsToSquash: "Nie masz commitów do spłaszczenia", Fixup: "Napraw", - SureFixupThisCommit: "Jesteś pewny, ze chcesz naprawić ten commit? Commit poniżej zostanie ściśnięty w górę wraz z tym", - OnlyRenameTopCommit: "Można przmianować tylko najwyższy commit", - LcRenameCommit: "przemianuj commit", - LcRenameCommitEditor: "przemianuj commit w edytorze", - PotentialErrInGetselectedCommit: "potencjalny błąd w getSelected Commit (niedopasowane ui i stan)", + SureFixupThisCommit: "Jesteś pewny, ze chcesz naprawić ten commit? Commit poniżej zostanie spłaszczony w górę wraz z tym", + OnlyRenameTopCommit: "Można zmienić nazwę tylko ostatniemu commitowi", + LcRenameCommit: "zmień nazwę commita", + LcRenameCommitEditor: "zmień nazwę commita w edytorze", Error: "Błąd", - RunningSubprocess: "uruchomiony podproces", LcSelectHunk: "wybierz kawałek", LcNavigateConflicts: "nawiguj konflikty", LcPickHunk: "wybierz kawałek", - LcPickBothHunks: "wybierz oba kawałki", + LcPickAllHunks: "wybierz oba kawałki", LcUndo: "cofnij", LcPop: "wyciągnij", LcDrop: "porzuć", @@ -103,157 +87,148 @@ func polishTranslationSet() TranslationSet { NoStashTo: "Brak schowka dla {{.method}}", NoTrackedStagedFilesStash: "Nie masz śledzonych/zatwierdzonych plików do przechowania", StashChanges: "Przechowaj zmiany", - IssntListOfViews: "{{.name}} nie jest na liście widoków", - LcNewFocusedViewIs: "nowy skupiony widok to {{.newFocusedView}}", MergeAborted: "Scalanie anulowane", - OpenConfig: "otwórz plik konfiguracyjny", - EditConfig: "edytuj plik konfiguracyjny", - ForcePush: "Wymuś wypchnięcie", - ForcePushPrompt: "Twoja gałąź rozeszła się z gałęzią zdalną. Wciśnij 'esc' aby anulować lub 'enter' aby wymusić wypchnięcie.", - ForcePushDisabled: "Your branch has diverged from the remote branch and you've disabled force pushing", - UpdatesRejectedAndForcePushDisabled: "Updates were rejected and you have disabled force pushing", + OpenConfig: "otwórz konfigurację", + EditConfig: "edytuj konfigurację", + ForcePush: "Wymuś wysłanie", + ForcePushPrompt: "Twoja gałąź rozeszła się z gałęzią zdalną. Wciśnij 'esc' aby anulować lub 'enter' aby wymusić wysłanie.", + ForcePushDisabled: "Twoja gałąź rozeszła się z gałęzią zdalną i wyłączyłeś wymuszenie wysłania", + UpdatesRejectedAndForcePushDisabled: "Aktualizacje zostały odrzucone i wyłączyłeś wymuszenie wysłania", LcCheckForUpdate: "sprawdź aktualizacje", CheckingForUpdates: "Sprawdzanie aktualizacji...", OnLatestVersionErr: "Już posiadasz najnowszą wersję", MajorVersionErr: "Nowa wersja ({{.newVersion}}) posiada niekompatybilne zmiany w porównaniu do obecnej wersji ({{.currentVersion}})", CouldNotFindBinaryErr: "Nie można znaleźć pliku binarnego w {{.url}}", - AnonymousReportingTitle: "Help make lazygit better", - AnonymousReportingPrompt: "Włączyć anonimowe raportowanie błędów w celu pomocy w usprawnianiu lazygita (enter/esc)?", - LcEditFile: `edytuj plik`, - LcOpenFile: `otwórz plik`, - LcIgnoreFile: `dodaj do .gitignore`, - LcRefreshFiles: `odśwież pliki`, - LcMergeIntoCurrentBranch: `scal do obecnej gałęzi`, - ConfirmQuit: `Na pewno chcesz wyjść z programu?`, - LcAllBranchesLogGraph: `pokazywać wszystkie logi branżowe`, - UnsupportedGitService: `Nieobsługiwana usługa git`, - LcCreateOrShowPullRequest: `utwórz żądanie wyciągnięcia`, - LcCopyPullRequestURL: `skopiuj adres URL żądania ściągnięcia do schowka`, - NoBranchOnRemote: `Ta gałąź nie istnieje na zdalnym. Najpierw musisz go odepchnąć na odległość.`, - LcFetch: `fetch`, - NoAutomaticGitFetchTitle: `No automatic git fetch`, - NoAutomaticGitFetchBody: `Lazygit can't use "git fetch" in a private repo use f in the branches panel to run "git fetch" manually`, - FileEnter: `zatwierdź pojedyncze linie`, - FileStagingRequirements: `Można tylko zatwierdzić pojedyncze linie dla śledzonych plików z niezatwierdzonymi zmianami`, - StagingTitle: `Zatwierdzanie`, - ReturnToFilesPanel: `wróć do panelu plików`, - CantFindHunks: `Nie można znaleźć żadnych kawałków w tej łatce`, - CantFindHunk: `Nie można znaleźć kawałka`, - RebasingTitle: "Rebasing", - MergingTitle: "Merging", - ConfirmRebase: "Are you sure you want to rebase {{.checkedOutBranch}} onto {{.selectedBranch}}?", - ConfirmMerge: "Are you sure you want to merge {{.selectedBranch}} into {{.checkedOutBranch}}?", - FwdNoUpstream: "Cannot fast-forward a branch with no upstream", - FwdCommitsToPush: "Cannot fast-forward a branch with commits to push", - ErrorOccurred: "An error occurred! Please create an issue at", - MainTitle: "Main", - NormalTitle: "Normal", - LcSoftReset: "soft reset", - SureSquashThisCommit: "Are you sure you want to squash this commit into the commit below?", - Squash: "Squash", - LcPickCommit: "pick commit (when mid-rebase)", - LcRevertCommit: "revert commit", - LcDeleteCommit: "delete commit", - LcMoveDownCommit: "move commit down one", - LcMoveUpCommit: "move commit up one", - LcEditCommit: "edit commit", - LcAmendToCommit: "amend commit with staged changes", - FoundConflicts: "Conflicts! To abort press 'esc', otherwise press 'enter'", - FoundConflictsTitle: "Auto-merge failed", - Undo: "undo", - PickHunk: "pick hunk", - PickBothHunks: "pick both hunks", - ViewMergeRebaseOptions: "view merge/rebase options", - NotMergingOrRebasing: "You are currently neither rebasing nor merging", - RecentRepos: "recent repositories", - MergeOptionsTitle: "Merge Options", - RebaseOptionsTitle: "Rebase Options", - ConflictsResolved: "all merge conflicts resolved. Continue?", - NoRoom: "Not enough room", - YouAreHere: "YOU ARE HERE", - LcRewordNotSupported: "rewording commits while interactively rebasing is not currently supported", - LcCherryPickCopy: "copy commit (cherry-pick)", - LcCherryPickCopyRange: "copy commit range (cherry-pick)", - LcPasteCommits: "paste commits (cherry-pick)", - SureCherryPick: "Are you sure you want to cherry-pick the copied commits onto this branch?", - CherryPick: "Cherry-Pick", - CannotRebaseOntoFirstCommit: "You cannot interactive rebase onto the first commit", - CannotSquashOntoSecondCommit: "You cannot squash/fixup onto the second commit", - Donate: "Donate", - PrevLine: "select previous line", - NextLine: "select next line", - PrevHunk: "select previous hunk", - NextHunk: "select next hunk", - PrevConflict: "select previous conflict", - NextConflict: "select next conflict", - SelectTop: "select top hunk", - SelectBottom: "select bottom hunk", - ScrollDown: "scroll down", - ScrollUp: "scroll up", - AmendCommitTitle: "Amend Commit", - AmendCommitPrompt: "Are you sure you want to amend this commit with your staged files?", - DeleteCommitTitle: "Delete Commit", - DeleteCommitPrompt: "Are you sure you want to delete this commit?", - SquashingStatus: "squashing", - FixingStatus: "fixing up", - DeletingStatus: "deleting", - MovingStatus: "moving", - RebasingStatus: "rebasing", - AmendingStatus: "amending", - CherryPickingStatus: "cherry-picking", - CommitFiles: "Commit files", - LcViewCommitFiles: "view commit's files", - CommitFilesTitle: "Commit files", - LcGoBack: "go back", - NoCommiteFiles: "No files for this commit", - LcCheckoutCommitFile: "checkout file", - LcDiscardOldFileChange: "discard this commit's changes to this file", - DiscardFileChangesTitle: "Discard file changes", - DiscardFileChangesPrompt: "Are you sure you want to discard this commit's changes to this file? If this file was created in this commit, it will be deleted", - DisabledForGPG: "Feature not available for users using GPG", - CreateRepo: "Not in a git repository. Create a new git repository? (y/n): ", - AutoStashTitle: "Autostash?", - AutoStashPrompt: "You must stash and pop your changes to bring them across. Do this automatically? (enter/esc)", - StashPrefix: "Auto-stashing changes for ", - LcViewDiscardOptions: "view 'discard changes' options", - LcCancel: "cancel", - LcDiscardAllChanges: "discard all changes", - LcDiscardUnstagedChanges: "discard unstaged changes", - LcDiscardAllChangesToAllFiles: "nuke working tree", - LcDiscardAnyUnstagedChanges: "discard unstaged changes", - LcDiscardUntrackedFiles: "discard untracked files", - LcHardReset: "hard reset", - LcViewResetOptions: `view reset options`, - LcCreateFixupCommit: `create fixup commit for this commit`, - LcSquashAboveCommits: `squash all 'fixup!' commits above selected commits (autosquash)`, - SquashAboveCommits: `Squash all 'fixup!' commits above selected commits (autosquash)`, - SureSquashAboveCommits: `Are you sure you want to squash all fixup! commits above {{.commit}}?`, - CreateFixupCommit: `Create fixup commit`, - SureCreateFixupCommit: `Are you sure you want to create a fixup! commit for commit {{.commit}}?`, - LcExecuteCustomCommand: "execute custom command", - CustomCommand: "Custom Command:", - LcCommitChangesWithoutHook: "commit changes without pre-commit hook", - SkipHookPrefixNotConfigured: "You have not configured a commit message prefix for skipping hooks. Set `git.skipHookPrefix = 'WIP'` in your config", - LcResetTo: `reset to`, - PressEnterToReturn: "Press enter to return to lazygit", - LcViewStashOptions: "view stash options", - LcStashAllChanges: "przechowaj pliki", - LcStashStagedChanges: "stash staged changes", - LcStashOptions: "Stash options", - NotARepository: "Error: must be run inside a git repository", - LcJump: "jump to panel", - ExitLineByLineMode: `exit line-by-line mode`, - EnterUpstream: `Enter upstream as ' '`, - ReturnToRemotesList: `return to remotes list`, - IgnoreTracked: "Ignore tracked file", - IgnoreTrackedPrompt: "Are you sure you want to ignore a tracked file?", - LcCommitPrefixPatternError: "Error in commitPrefix pattern", - NoFilesStagedTitle: "No files staged", - NoFilesStagedPrompt: "You have not staged any files. Commit all files?", - BranchNotFoundTitle: "Branch not found", - BranchNotFoundPrompt: "Branch not found. Create a new branch named", + LcEditFile: "edytuj plik", + LcOpenFile: "otwórz plik", + LcIgnoreFile: "dodaj do .gitignore", + LcRefreshFiles: "odśwież pliki", + LcMergeIntoCurrentBranch: "scal do obecnej gałęzi", + ConfirmQuit: "Na pewno chcesz wyjść z programu?", + LcAllBranchesLogGraph: "pokaż wszystkie logi gałęzi", + UnsupportedGitService: "Nieobsługiwana usługa git", + LcCreatePullRequest: "utwórz żądanie pobrania", + LcCopyPullRequestURL: "skopiuj adres URL żądania pobrania do schowka", + NoBranchOnRemote: "Ta gałąź nie istnieje w zdalnym repo. Najpierw musisz ją wysłać.", + LcFetch: "pobierz", + NoAutomaticGitFetchTitle: `Brak automatycznego "git fetch"`, + NoAutomaticGitFetchBody: `Lazygit nie może użyć "git fetch" w prywatnym repo, użyj f w panelu gałęzi żeby uruchomić "git fetch" ręcznie`, + FileEnter: "zatwierdź pojedyncze linie", + FileStagingRequirements: "Można tylko zatwierdzić pojedyncze linie dla śledzonych plików z niezatwierdzonymi zmianami", + StagingTitle: "Poczekalnia", + ReturnToFilesPanel: "wróć do panelu plików", + RebasingTitle: "Zmiana bazy", + MergingTitle: "Scalanie", + ConfirmRebase: "Czy napewno chcesz zmienić bazę {{.checkedOutBranch}} na {{.selectedBranch}}?", + ConfirmMerge: "Czy na pewno chcesz scalić {{.selectedBranch}} do {{.checkedOutBranch}}?", + FwdNoUpstream: "Nie można przewinąć gałęzi bez gałęzi nadrzędnej", + FwdCommitsToPush: "Nie można przewinąć gałęzi z commitami do wysłania", + ErrorOccurred: "Wystąpił błąd! Zgłoś problem na", + MainTitle: "Główne", + NormalTitle: "Zwykłe", + LcSoftReset: "miękki reset", + SureSquashThisCommit: "Czy na pewno spłaszczyć ten commit do commita niżej?", + Squash: "Spłaszcz", + LcPickCommit: "wybierz commit (podczas zmiany bazy)", + LcRevertCommit: "odwróć commit", + LcDeleteCommit: "usuń commit", + LcMoveDownCommit: "przenieś commit 1 w dół", + LcMoveUpCommit: "przenieś commit 1 w górę", + LcEditCommit: "edytuj commit", + LcAmendToCommit: "popraw commit zmianami z poczekalni", + FoundConflicts: "Konflikty! Wciśnij 'esc' żeby przerwać, w przeciwnym razie wciśnij 'enter'", + FoundConflictsTitle: "Automatyczne scalenie nie powiodło się", + PickHunk: "wybierz kawałek", + PickAllHunks: "wybierz wszystkie kawałki", + ViewMergeRebaseOptions: "widok scalenia/opcje zmiany bazy", + NotMergingOrRebasing: "W tej chwili nie scalasz ani nie zmieniasz bazy", + RecentRepos: "ostatnie repozytoria", + MergeOptionsTitle: "Opcje scalania", + RebaseOptionsTitle: "Opcje zmiany bazy", + ConflictsResolved: "Wszystkie konflikty scalania rozwiązane. Kontynuować?", + NoRoom: "Brak miejsca", + YouAreHere: "JESTEŚ TU", + LcRewordNotSupported: "przeredagowanie commitów podczas interaktywnej zmiany bazy nie jest obecnie wspierane", + LcCherryPickCopy: "kopiuj commit (przebieranie)", + LcCherryPickCopyRange: "kopiuj zakres commitów (przebieranie)", + LcPasteCommits: "wklej commity (przebieranie)", + SureCherryPick: "Czy na pewno chcesz przebierać w skopiowanych commitach na tej gałęzi?", + CherryPick: "Przebieranie", + CannotRebaseOntoFirstCommit: "Nie można interaktywnie zmienić bazy na pierwszym commicie", + CannotSquashOntoSecondCommit: "Nie można spłaszczyć na drugi commit", + Donate: "Wesprzyj", + PrevLine: "poprzednia linia", + NextLine: "następna linia", + PrevHunk: "poprzedni kawałek", + NextHunk: "następny kawałek", + PrevConflict: "poprzedni konflikt", + NextConflict: "następny konflikt", + SelectPrevHunk: "wybierz poprzedni kawałek", + SelectNextHunk: "wybierz następny kawałek", + ScrollDown: "przewiń w dół", + ScrollUp: "przewiń w górę", + AmendCommitTitle: "Popraw commit", + AmendCommitPrompt: "Czy na pewno chcesz poprawić ten commit plikami z poczekalni?", + DeleteCommitTitle: "Usuń commit", + DeleteCommitPrompt: "Czy na pewno usunąć ten commit?", + SquashingStatus: "spłaszczanie", + FixingStatus: "naprawianie", + DeletingStatus: "usuwanie", + MovingStatus: "przenoszenie", + RebasingStatus: "zmiana bazy", + AmendingStatus: "poprawianie", + CherryPickingStatus: "przebieranie", + CommitFiles: "Pliki commita", + LcViewCommitFiles: "przeglądaj pliki commita", + CommitFilesTitle: "Pliki commita", + LcCheckoutCommitFile: "plik wybierania", + LcDiscardOldFileChange: "porzuć zmiany commita dla tego pliku", + DiscardFileChangesTitle: "Porzuć zmiany w pliku", + DiscardFileChangesPrompt: "Czy na pewno porzucić zmiany w tym pliku? Jeśli ten plik był utworzony w tym commicie, zostanie usunięty", + DisabledForGPG: "Funkcja niedostępna dla użytkowników GPG", + CreateRepo: "Nie jesteś w repozytorium. Utworzyć nowe repozytorium Gita? (y/n): ", + AutoStashTitle: "Automatyczny schowek", + AutoStashPrompt: "Musisz schować i wyciągnąć zmiany żeby je przenosić. Robić to automatycznie? (enter/esc)", + StashPrefix: "Automatyczne dodawanie zmian do schowka dla ", + LcViewDiscardOptions: "pokaż opcje porzucania zmian", + LcCancel: "anuluj", + LcDiscardAllChanges: "porzuć wszystkie zmiany", + LcDiscardUnstagedChanges: "porzuć zmiany poza poczekalnią", + LcDiscardAllChangesToAllFiles: "wytnij drzewo robocze", + LcDiscardAnyUnstagedChanges: "porzuć zmiany poza poczekalnią", + LcDiscardUntrackedFiles: "porzuć pliki nieśledzone", + LcHardReset: "twardy reset", + LcViewResetOptions: "wyświetl opcje resetu", + LcCreateFixupCommit: "utwórz commit naprawczy dla tego commita", + LcSquashAboveCommits: `spłaszcz wszystkie commity naprawcze powyżej zaznaczonych commitów (autosquash)`, + SquashAboveCommits: `spłaszcz wszystkie commity naprawcze powyżej zaznaczonych commitów (autosquash)`, + SureSquashAboveCommits: `Na pewno chcesz spłaszczyć wszystkie commity naprawcze powyżej {{.commit}}?`, + CreateFixupCommit: `Utwóż commit naprawczy`, + SureCreateFixupCommit: `Na pewno utworzyć commit naprawczy dla commita {{.commit}}?`, + LcExecuteCustomCommand: "wykonaj własną komendę", + CustomCommand: "Własna komenda:", + LcCommitChangesWithoutHook: "zatwierdź zmiany bez skryptu pre-commit", + SkipHookPrefixNotConfigured: "Nie masz skonfigurowanego prefixa komunikatu commita dla pomijania skryptów. Ustaw `git.skipHookPrefix = 'WIP'` w konfiguracji", + LcResetTo: "zresetuj do", + PressEnterToReturn: "Wciśnij enter żeby wrócić do lazygit", + LcViewStashOptions: "wyświetl opcje schowka", + LcStashAllChanges: "przechowaj zmiany", + LcStashStagedChanges: "przechowaj zmiany z poczekalni", + LcStashOptions: "Opcje schowka", + NotARepository: "Błąd: nie jesteś w repozytorium", + LcJump: "przeskocz do panelu", + ExitLineByLineMode: `wyście z trybu "linia po linii"`, + EnterUpstream: `Podaj gałąź nadrzędną jako ' '`, + ReturnToRemotesList: `wróć do listy repozytoriów zdalnych`, + IgnoreTracked: "Ignoruj plik śledzony", + IgnoreTrackedPrompt: "Na pewno ignorować plik śledzony?", + LcCommitPrefixPatternError: "Błąd we wzorcu prefixu commita", + NoFilesStagedTitle: "Brak plików w poczekalni", + NoFilesStagedPrompt: "Nie masz plików w poczekalni. Zatwierdzić wszystkie pliki?", + BranchNotFoundTitle: "Nie znaleziono gałęzi", + BranchNotFoundPrompt: "Nie znaleziono gałęzi. Utwórz nową gałąź ", PullRequestURLCopiedToClipboard: "URL żądania ściągnięcia skopiowany do schowka", - CommitMessageCopiedToClipboard: "Commit message skopiowany do schowka", + CommitMessageCopiedToClipboard: "Komunikat commita skopiowany do schowka", LcCopiedToClipboard: "skopiowany do schowka", CreateOrOpenPullRequestOptions: "Utwórz opcje żądania ściągnięcia", LcCreateOrOpenPullRequestOptions: "utwórz opcje żądania ściągnięcia", diff --git a/pkg/integration/integration.go b/pkg/integration/integration.go index 577aaa3b8..4b1842d44 100644 --- a/pkg/integration/integration.go +++ b/pkg/integration/integration.go @@ -33,7 +33,7 @@ func RunTests( updateSnapshots bool, record bool, speedEnv string, - onFail func(t *testing.T, expected string, actual string), + onFail func(t *testing.T, expected string, actual string, prefix string), includeSkipped bool, ) error { rootDir := GetRootDirectory() @@ -66,8 +66,10 @@ func RunTests( fnWrapper(test, func(t *testing.T) error { speeds := getTestSpeeds(test.Speed, updateSnapshots, speedEnv) testPath := filepath.Join(testDir, test.Name) - actualDir := filepath.Join(testPath, "actual") - expectedDir := filepath.Join(testPath, "expected") + actualRepoDir := filepath.Join(testPath, "actual") + expectedRepoDir := filepath.Join(testPath, "expected") + actualRemoteDir := filepath.Join(testPath, "actual_remote") + expectedRemoteDir := filepath.Join(testPath, "expected_remote") logf("path: %s", testPath) // three retries at normal speed for the sake of flakey tests @@ -76,8 +78,9 @@ func RunTests( logf("%s: attempting test at speed %f\n", test.Name, speed) findOrCreateDir(testPath) - prepareIntegrationTestDir(actualDir) - err := createFixture(testPath, actualDir) + prepareIntegrationTestDir(actualRepoDir) + removeRemoteDir(actualRemoteDir) + err := createFixture(testPath, actualRepoDir) if err != nil { return err } @@ -95,25 +98,46 @@ func RunTests( } if updateSnapshots { - err = oscommands.CopyDir(actualDir, expectedDir) + err = oscommands.CopyDir(actualRepoDir, expectedRepoDir) if err != nil { return err } err = os.Rename( - filepath.Join(expectedDir, ".git"), - filepath.Join(expectedDir, ".git_keep"), + filepath.Join(expectedRepoDir, ".git"), + filepath.Join(expectedRepoDir, ".git_keep"), ) if err != nil { return err } + + // see if we have a remote dir and if so, copy it over. Otherwise, delete the expected dir because we have no remote folder. + if folderExists(actualRemoteDir) { + err = oscommands.CopyDir(actualRemoteDir, expectedRemoteDir) + if err != nil { + return err + } + } else { + removeRemoteDir(expectedRemoteDir) + } } - actual, expected, err := generateSnapshots(actualDir, expectedDir) + actualRepo, expectedRepo, err := generateSnapshots(actualRepoDir, expectedRepoDir) if err != nil { return err } - if expected == actual { + actualRemote := "remote folder does not exist" + expectedRemote := "remote folder does not exist" + if folderExists(expectedRemoteDir) { + actualRemote, expectedRemote, err = generateSnapshotsForRemote(actualRemoteDir, expectedRemoteDir) + if err != nil { + return err + } + } else if folderExists(actualRemoteDir) { + actualRemote = "remote folder exists" + } + + if expectedRepo == actualRepo && expectedRemote == actualRemote { logf("%s: success at speed %f\n", test.Name, speed) break } @@ -126,7 +150,11 @@ func RunTests( return err } logf("%s", string(bytes)) - onFail(t, expected, actual) + if expectedRepo != actualRepo { + onFail(t, expectedRepo, actualRepo, "repo") + } else { + onFail(t, expectedRemote, actualRemote, "remote") + } } } @@ -137,6 +165,13 @@ func RunTests( return nil } +func removeRemoteDir(dir string) { + err := os.RemoveAll(dir) + if err != nil { + panic(err) + } +} + func prepareIntegrationTestDir(actualDir string) { // remove contents of integration test directory dir, err := ioutil.ReadDir(actualDir) @@ -351,6 +386,20 @@ func generateSnapshots(actualDir string, expectedDir string) (string, string, er return actual, expected, nil } +func generateSnapshotsForRemote(actualDir string, expectedDir string) (string, string, error) { + actual, err := generateSnapshot(actualDir) + if err != nil { + return "", "", err + } + + expected, err := generateSnapshot(expectedDir) + if err != nil { + return "", "", err + } + + return actual, expected, nil +} + func getLazygitCommand(testPath string, rootDir string, record bool, speed float64, extraCmdArgs string) (*exec.Cmd, error) { osCommand := oscommands.NewDummyOSCommand() @@ -397,3 +446,8 @@ func getLazygitCommand(testPath string, rootDir string, record bool, speed float return cmd, nil } + +func folderExists(path string) bool { + _, err := os.Stat(path) + return err == nil +} diff --git a/pkg/secureexec/secureexec_default.go b/pkg/secureexec/secureexec_default.go index 1992358ce..f6b843d45 100644 --- a/pkg/secureexec/secureexec_default.go +++ b/pkg/secureexec/secureexec_default.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package secureexec diff --git a/pkg/secureexec/secureexec_windows.go b/pkg/secureexec/secureexec_windows.go index 537e0bfc1..51e8634b4 100644 --- a/pkg/secureexec/secureexec_windows.go +++ b/pkg/secureexec/secureexec_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package secureexec diff --git a/pkg/tasks/async_handler.go b/pkg/tasks/async_handler.go new file mode 100644 index 000000000..897efb0e2 --- /dev/null +++ b/pkg/tasks/async_handler.go @@ -0,0 +1,56 @@ +package tasks + +import ( + "sync" + + "github.com/jesseduffield/lazygit/pkg/utils" +) + +// the purpose of an AsyncHandler is to ensure that if we have multiple long-running +// requests, we only handle the result of the latest one. For example, if I am +// searching for 'abc' and I have to type 'a' then 'b' then 'c' and each keypress +// dispatches a request to search for things with the string so-far, we'll be searching +// for 'a', 'ab', and 'abc', and it may be that 'abc' comes back first, then 'ab', +// then 'a' and we don't want to display the result for 'a' just because it came +// back last. AsyncHandler keeps track of the order in which things were dispatched +// so that we can ignore anything that comes back late. +type AsyncHandler struct { + currentId int + lastId int + mutex sync.Mutex + onReject func() +} + +func NewAsyncHandler() *AsyncHandler { + return &AsyncHandler{ + mutex: sync.Mutex{}, + } +} + +func (self *AsyncHandler) Do(f func() func()) { + self.mutex.Lock() + self.currentId++ + id := self.currentId + self.mutex.Unlock() + + go utils.Safe(func() { + after := f() + self.handle(after, id) + }) +} + +// f here is expected to be a function that doesn't take long to run +func (self *AsyncHandler) handle(f func(), id int) { + self.mutex.Lock() + defer self.mutex.Unlock() + + if id < self.lastId { + if self.onReject != nil { + self.onReject() + } + return + } + + self.lastId = id + f() +} diff --git a/pkg/tasks/async_handler_test.go b/pkg/tasks/async_handler_test.go new file mode 100644 index 000000000..b6edbec20 --- /dev/null +++ b/pkg/tasks/async_handler_test.go @@ -0,0 +1,44 @@ +package tasks + +import ( + "fmt" + "sync" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestAsyncHandler(t *testing.T) { + wg := sync.WaitGroup{} + wg.Add(2) + + handler := NewAsyncHandler() + handler.onReject = func() { + wg.Done() + } + + result := 0 + + wg2 := sync.WaitGroup{} + wg2.Add(1) + + handler.Do(func() func() { + wg2.Wait() + return func() { + fmt.Println("setting to 1") + result = 1 + } + }) + handler.Do(func() func() { + return func() { + fmt.Println("setting to 2") + result = 2 + wg.Done() + wg2.Done() + } + }) + + wg.Wait() + + assert.EqualValues(t, 2, result) +} diff --git a/pkg/tasks/tasks.go b/pkg/tasks/tasks.go index 8287b3927..ba86317ac 100644 --- a/pkg/tasks/tasks.go +++ b/pkg/tasks/tasks.go @@ -31,15 +31,36 @@ type ViewBufferManager struct { Log *logrus.Entry newTaskId int readLines chan int + taskKey string + onNewKey func() // beforeStart is the function that is called before starting a new task - beforeStart func() - refreshView func() - flushStaleCells func() + beforeStart func() + refreshView func() + onEndOfInput func() } -func NewViewBufferManager(log *logrus.Entry, writer io.Writer, beforeStart func(), refreshView func(), flushStaleCells func()) *ViewBufferManager { - return &ViewBufferManager{Log: log, writer: writer, beforeStart: beforeStart, refreshView: refreshView, flushStaleCells: flushStaleCells, readLines: make(chan int, 1024)} +func (m *ViewBufferManager) GetTaskKey() string { + return m.taskKey +} + +func NewViewBufferManager( + log *logrus.Entry, + writer io.Writer, + beforeStart func(), + refreshView func(), + onEndOfInput func(), + onNewKey func(), +) *ViewBufferManager { + return &ViewBufferManager{ + Log: log, + writer: writer, + beforeStart: beforeStart, + refreshView: refreshView, + onEndOfInput: onEndOfInput, + readLines: make(chan int, 1024), + onNewKey: onNewKey, + } } func (m *ViewBufferManager) ReadLines(n int) { @@ -117,11 +138,11 @@ func (m *ViewBufferManager) NewCmdTask(r io.Reader, cmd *exec.Cmd, prefix string if !ok { // if we're here then there's nothing left to scan from the source // so we're at the EOF and can flush the stale content - m.flushStaleCells() + m.onEndOfInput() m.refreshView() break outer } - _, _ = m.writer.Write(append(scanner.Bytes(), []byte("\n")...)) + _, _ = m.writer.Write(append(scanner.Bytes(), '\n')) } m.refreshView() case <-stop: @@ -179,11 +200,17 @@ func (t *ViewBufferManager) Close() { // 1) command based, where the manager can be asked to read more lines, but the command can be killed // 2) string based, where the manager can also be asked to read more lines -func (m *ViewBufferManager) NewTask(f func(stop chan struct{}) error) error { +func (m *ViewBufferManager) NewTask(f func(stop chan struct{}) error, key string) error { go utils.Safe(func() { m.taskIDMutex.Lock() m.newTaskId++ taskID := m.newTaskId + + if m.GetTaskKey() != key && m.onNewKey != nil { + m.onNewKey() + } + m.taskKey = key + m.taskIDMutex.Unlock() m.waitingMutex.Lock() diff --git a/pkg/theme/gocui.go b/pkg/theme/gocui.go new file mode 100644 index 000000000..6bda0c721 --- /dev/null +++ b/pkg/theme/gocui.go @@ -0,0 +1,45 @@ +package theme + +import ( + "github.com/gookit/color" + "github.com/jesseduffield/gocui" + "github.com/jesseduffield/lazygit/pkg/utils" +) + +var gocuiColorMap = map[string]gocui.Attribute{ + "default": gocui.ColorDefault, + "black": gocui.ColorBlack, + "red": gocui.ColorRed, + "green": gocui.ColorGreen, + "yellow": gocui.ColorYellow, + "blue": gocui.ColorBlue, + "magenta": gocui.ColorMagenta, + "cyan": gocui.ColorCyan, + "white": gocui.ColorWhite, + "bold": gocui.AttrBold, + "reverse": gocui.AttrReverse, + "underline": gocui.AttrUnderline, +} + +// GetAttribute gets the gocui color attribute from the string +func GetGocuiAttribute(key string) gocui.Attribute { + if utils.IsValidHexValue(key) { + values := color.HEX(key).Values() + return gocui.NewRGBColor(int32(values[0]), int32(values[1]), int32(values[2])) + } + + value, present := gocuiColorMap[key] + if present { + return value + } + return gocui.ColorWhite +} + +// GetGocuiStyle bitwise OR's a list of attributes obtained via the given keys +func GetGocuiStyle(keys []string) gocui.Attribute { + var attribute gocui.Attribute + for _, key := range keys { + attribute |= GetGocuiAttribute(key) + } + return attribute +} diff --git a/pkg/theme/style.go b/pkg/theme/style.go new file mode 100644 index 000000000..69c404e3b --- /dev/null +++ b/pkg/theme/style.go @@ -0,0 +1,42 @@ +package theme + +import ( + "github.com/gookit/color" + "github.com/jesseduffield/lazygit/pkg/gui/style" + "github.com/jesseduffield/lazygit/pkg/utils" +) + +func GetTextStyle(keys []string, background bool) style.TextStyle { + s := style.New() + + for _, key := range keys { + switch key { + case "bold": + s = s.SetBold() + case "reverse": + s = s.SetReverse() + case "underline": + s = s.SetUnderline() + default: + value, present := style.ColorMap[key] + if present { + var c style.TextStyle + if background { + c = value.Background + } else { + c = value.Foreground + } + s = s.MergeStyle(c) + } else if utils.IsValidHexValue(key) { + c := style.NewRGBColor(color.HEX(key, background)) + if background { + s.SetBg(c) + } else { + s.SetFg(c) + } + } + } + } + + return s +} diff --git a/pkg/theme/theme.go b/pkg/theme/theme.go index 218ee4b19..c3e12fdcc 100644 --- a/pkg/theme/theme.go +++ b/pkg/theme/theme.go @@ -1,19 +1,12 @@ package theme import ( - "encoding/hex" - - "github.com/fatih/color" "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/config" + "github.com/jesseduffield/lazygit/pkg/gui/style" ) var ( - // DefaultTextColor is the default text color - DefaultTextColor = color.FgWhite - // DefaultHiTextColor is the default highlighted text color - DefaultHiTextColor = color.FgHiWhite - // GocuiDefaultTextColor does the same as DefaultTextColor but this one only colors gocui default text colors GocuiDefaultTextColor gocui.Attribute @@ -23,161 +16,54 @@ var ( // InactiveBorderColor is the border color of the inactive active frames InactiveBorderColor gocui.Attribute - // SelectedLineBgColor is the background color for the selected line - SelectedLineBgColor color.Attribute - - // SelectedRangeBgColor is the background color of the selected range of lines - SelectedRangeBgColor color.Attribute - // GocuiSelectedLineBgColor is the background color for the selected line in gocui GocuiSelectedLineBgColor gocui.Attribute - OptionsFgColor color.Attribute - OptionsColor gocui.Attribute - DiffTerminalColor = color.FgMagenta + // DefaultTextColor is the default text color + DefaultTextColor = style.FgWhite + + // DefaultHiTextColor is the default highlighted text color + DefaultHiTextColor = style.FgLightWhite + + // SelectedLineBgColor is the background color for the selected line + SelectedLineBgColor = style.New() + + // SelectedRangeBgColor is the background color of the selected range of lines + SelectedRangeBgColor = style.New() + + // CherryPickedCommitColor is the text style when cherry picking a commit + CherryPickedCommitTextStyle = style.New() + + OptionsFgColor = style.New() + + DiffTerminalColor = style.FgMagenta ) // UpdateTheme updates all theme variables func UpdateTheme(themeConfig config.ThemeConfig) { - ActiveBorderColor = GetGocuiColor(themeConfig.ActiveBorderColor) - InactiveBorderColor = GetGocuiColor(themeConfig.InactiveBorderColor) - SelectedLineBgColor = GetBgColor(themeConfig.SelectedLineBgColor) - SelectedRangeBgColor = GetBgColor(themeConfig.SelectedRangeBgColor) - GocuiSelectedLineBgColor = GetGocuiColor(themeConfig.SelectedLineBgColor) - OptionsColor = GetGocuiColor(themeConfig.OptionsTextColor) - OptionsFgColor = GetFgColor(themeConfig.OptionsTextColor) + ActiveBorderColor = GetGocuiStyle(themeConfig.ActiveBorderColor) + InactiveBorderColor = GetGocuiStyle(themeConfig.InactiveBorderColor) + SelectedLineBgColor = GetTextStyle(themeConfig.SelectedLineBgColor, true) + SelectedRangeBgColor = GetTextStyle(themeConfig.SelectedRangeBgColor, true) + + cherryPickedCommitBgTextStyle := GetTextStyle(themeConfig.CherryPickedCommitBgColor, true) + cherryPickedCommitFgTextStyle := GetTextStyle(themeConfig.CherryPickedCommitFgColor, false) + CherryPickedCommitTextStyle = cherryPickedCommitBgTextStyle.MergeStyle(cherryPickedCommitFgTextStyle) + + GocuiSelectedLineBgColor = GetGocuiStyle(themeConfig.SelectedLineBgColor) + OptionsColor = GetGocuiStyle(themeConfig.OptionsTextColor) + OptionsFgColor = GetTextStyle(themeConfig.OptionsTextColor, false) isLightTheme := themeConfig.LightTheme if isLightTheme { - DefaultTextColor = color.FgBlack - DefaultHiTextColor = color.FgHiBlack + DefaultTextColor = style.FgBlack + DefaultHiTextColor = style.FgBlackLighter GocuiDefaultTextColor = gocui.ColorBlack } else { - DefaultTextColor = color.FgWhite - DefaultHiTextColor = color.FgHiWhite + DefaultTextColor = style.FgWhite + DefaultHiTextColor = style.FgLightWhite GocuiDefaultTextColor = gocui.ColorWhite } } - -// getHexColorValues returns the rgb values of a hex color -func getHexColorValues(v string) (r int32, g int32, b int32, valid bool) { - if len(v) == 4 { - v = string([]byte{v[0], v[1], v[1], v[2], v[2], v[3], v[3]}) - } else if len(v) != 7 { - return - } - - if v[0] != '#' { - return - } - - rgb, err := hex.DecodeString(v[1:]) - if err != nil { - return - } - - return int32(rgb[0]), int32(rgb[1]), int32(rgb[2]), true -} - -// GetAttribute gets the gocui color attribute from the string -func GetGocuiAttribute(key string) gocui.Attribute { - r, g, b, validHexColor := getHexColorValues(key) - if validHexColor { - return gocui.NewRGBColor(r, g, b) - } - - colorMap := map[string]gocui.Attribute{ - "default": gocui.ColorDefault, - "black": gocui.ColorBlack, - "red": gocui.ColorRed, - "green": gocui.ColorGreen, - "yellow": gocui.ColorYellow, - "blue": gocui.ColorBlue, - "magenta": gocui.ColorMagenta, - "cyan": gocui.ColorCyan, - "white": gocui.ColorWhite, - "bold": gocui.AttrBold, - "reverse": gocui.AttrReverse, - "underline": gocui.AttrUnderline, - } - value, present := colorMap[key] - if present { - return value - } - return gocui.ColorWhite -} - -// GetFgAttribute gets the color foreground attribute from the string -func GetFgAttribute(key string) color.Attribute { - colorMap := map[string]color.Attribute{ - "default": color.FgWhite, - "black": color.FgBlack, - "red": color.FgRed, - "green": color.FgGreen, - "yellow": color.FgYellow, - "blue": color.FgBlue, - "magenta": color.FgMagenta, - "cyan": color.FgCyan, - "white": color.FgWhite, - "bold": color.Bold, - "reverse": color.ReverseVideo, - "underline": color.Underline, - } - value, present := colorMap[key] - if present { - return value - } - return color.FgWhite -} - -// GetBgAttribute gets the color background attribute from the string -func GetBgAttribute(key string) color.Attribute { - colorMap := map[string]color.Attribute{ - "default": color.BgWhite, - "black": color.BgBlack, - "red": color.BgRed, - "green": color.BgGreen, - "yellow": color.BgYellow, - "blue": color.BgBlue, - "magenta": color.BgMagenta, - "cyan": color.BgCyan, - "white": color.BgWhite, - "bold": color.Bold, - "reverse": color.ReverseVideo, - "underline": color.Underline, - } - value, present := colorMap[key] - if present { - return value - } - return color.FgWhite -} - -// GetGocuiColor bitwise OR's a list of attributes obtained via the given keys -func GetGocuiColor(keys []string) gocui.Attribute { - var attribute gocui.Attribute - for _, key := range keys { - attribute |= GetGocuiAttribute(key) - } - return attribute -} - -// GetColor bitwise OR's a list of attributes obtained via the given keys -func GetBgColor(keys []string) color.Attribute { - var attribute color.Attribute - for _, key := range keys { - attribute |= GetBgAttribute(key) - } - return attribute -} - -// GetColor bitwise OR's a list of attributes obtained via the given keys -func GetFgColor(keys []string) color.Attribute { - var attribute color.Attribute - for _, key := range keys { - attribute |= GetFgAttribute(key) - } - return attribute -} diff --git a/pkg/theme/theme_test.go b/pkg/theme/theme_test.go deleted file mode 100644 index 311289408..000000000 --- a/pkg/theme/theme_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package theme - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestGetHexColorValues(t *testing.T) { - scenarios := []struct { - name string - hexColor string - rgb []int32 - valid bool - }{ - { - name: "valid uppercase hex color", - hexColor: "#00FF00", - rgb: []int32{0, 255, 0}, - valid: true, - }, - { - name: "valid lowercase hex color", - hexColor: "#00ff00", - rgb: []int32{0, 255, 0}, - valid: true, - }, - { - name: "valid short hex color", - hexColor: "#0bf", - rgb: []int32{0, 187, 255}, - valid: true, - }, - { - name: "invalid hex value", - hexColor: "#zz00ff", - valid: false, - }, - { - name: "invalid length hex color", - hexColor: "#", - valid: false, - }, - { - name: "invalid length hex color", - hexColor: "#aaaaaaaaaaa", - valid: false, - }, - } - - for _, s := range scenarios { - s := s - t.Run(s.name, func(t *testing.T) { - r, g, b, valid := getHexColorValues(s.hexColor) - assert.EqualValues(t, s.valid, valid, s.hexColor) - if valid { - assert.EqualValues(t, s.rgb[0], r, s.hexColor) - assert.EqualValues(t, s.rgb[1], g, s.hexColor) - assert.EqualValues(t, s.rgb[2], b, s.hexColor) - } - }) - } -} diff --git a/pkg/utils/color.go b/pkg/utils/color.go index b38dccf7f..0399377c7 100644 --- a/pkg/utils/color.go +++ b/pkg/utils/color.go @@ -1,25 +1,9 @@ package utils import ( - "fmt" "regexp" - - "github.com/fatih/color" ) -// ColoredString takes a string and a colour attribute and returns a colored -// string with that attribute -func ColoredString(str string, colorAttributes ...color.Attribute) string { - colour := color.New(colorAttributes...) - return ColoredStringDirect(str, colour) -} - -// ColoredStringDirect used for aggregating a few color attributes rather than -// just sending a single one -func ColoredStringDirect(str string, colour *color.Color) string { - return colour.SprintFunc()(fmt.Sprint(str)) -} - // Decolorise strips a string of color func Decolorise(str string) string { re := regexp.MustCompile(`\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]`) @@ -47,3 +31,24 @@ func getPadWidths(stringArrays [][]string) []int { } return padWidths } + +func IsValidHexValue(v string) bool { + if len(v) != 4 && len(v) != 7 { + return false + } + + if v[0] != '#' { + return false + } + + for _, char := range v[1:] { + switch char { + case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F': + continue + default: + return false + } + } + + return true +} diff --git a/pkg/utils/slice.go b/pkg/utils/slice.go index f536ea056..48acdbd2d 100644 --- a/pkg/utils/slice.go +++ b/pkg/utils/slice.go @@ -116,3 +116,31 @@ func StringArraysOverlap(strArrA []string, strArrB []string) bool { return false } + +func Uniq(values []string) []string { + added := make(map[string]bool) + result := make([]string, 0, len(values)) + for _, value := range values { + if added[value] { + continue + } + added[value] = true + result = append(result, value) + } + return result +} + +func Limit(values []string, limit int) []string { + if len(values) > limit { + return values[:limit] + } + return values +} + +func Reverse(values []string) []string { + result := make([]string, len(values)) + for i, val := range values { + result[len(values)-i-1] = val + } + return result +} diff --git a/pkg/utils/slice_test.go b/pkg/utils/slice_test.go index 491968cb4..3636f44cb 100644 --- a/pkg/utils/slice_test.go +++ b/pkg/utils/slice_test.go @@ -165,3 +165,86 @@ func TestEscapeSpecialChars(t *testing.T) { }) } } + +func TestUniq(t *testing.T) { + for _, test := range []struct { + values []string + want []string + }{ + { + values: []string{"a", "b", "c"}, + want: []string{"a", "b", "c"}, + }, + { + values: []string{"a", "b", "a", "b", "c"}, + want: []string{"a", "b", "c"}, + }, + } { + if got := Uniq(test.values); !assert.EqualValues(t, got, test.want) { + t.Errorf("Uniq(%v) = %v; want %v", test.values, got, test.want) + } + } +} + +func TestLimit(t *testing.T) { + for _, test := range []struct { + values []string + limit int + want []string + }{ + { + values: []string{"a", "b", "c"}, + limit: 3, + want: []string{"a", "b", "c"}, + }, + { + values: []string{"a", "b", "c"}, + limit: 4, + want: []string{"a", "b", "c"}, + }, + { + values: []string{"a", "b", "c"}, + limit: 2, + want: []string{"a", "b"}, + }, + { + values: []string{"a", "b", "c"}, + limit: 1, + want: []string{"a"}, + }, + { + values: []string{"a", "b", "c"}, + limit: 0, + want: []string{}, + }, + { + values: []string{}, + limit: 0, + want: []string{}, + }, + } { + if got := Limit(test.values, test.limit); !assert.EqualValues(t, got, test.want) { + t.Errorf("Limit(%v, %d) = %v; want %v", test.values, test.limit, got, test.want) + } + } +} + +func TestReverse(t *testing.T) { + for _, test := range []struct { + values []string + want []string + }{ + { + values: []string{"a", "b", "c"}, + want: []string{"c", "b", "a"}, + }, + { + values: []string{}, + want: []string{}, + }, + } { + if got := Reverse(test.values); !assert.EqualValues(t, got, test.want) { + t.Errorf("Reverse(%v) = %v; want %v", test.values, got, test.want) + } + } +} diff --git a/scripts/generate_cheatsheet.go b/scripts/generate_cheatsheet.go index e49156377..e2200b694 100644 --- a/scripts/generate_cheatsheet.go +++ b/scripts/generate_cheatsheet.go @@ -81,7 +81,7 @@ func localisedTitle(mApp *app.App, str string) string { "search": tr.SearchTitle, "secondary": tr.SecondaryTitle, "stash": tr.StashTitle, - "suggestions": tr.SuggestionsTitle, + "suggestions": tr.SuggestionsCheatsheetTitle, "extras": tr.ExtrasTitle, } diff --git a/test/default_test_config/config.yml b/test/default_test_config/config.yml index 69b4c4dea..087049261 100644 --- a/test/default_test_config/config.yml +++ b/test/default_test_config/config.yml @@ -6,3 +6,5 @@ gui: - bold SelectedRangeBgcolor: - reverse + # TODO: we should update most tests to use a file tree now that it's the default + showFileTree: false diff --git a/test/integration/forcePush/expected/.git_keep/COMMIT_EDITMSG b/test/integration/forcePush/expected/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..51be8ec3d --- /dev/null +++ b/test/integration/forcePush/expected/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +myfile4 diff --git a/test/integration/forcePush/expected/.git_keep/FETCH_HEAD b/test/integration/forcePush/expected/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..8997b0d11 --- /dev/null +++ b/test/integration/forcePush/expected/.git_keep/FETCH_HEAD @@ -0,0 +1 @@ +a9848fd98935937cd7d3909023ed1b588ccd4bfb branch 'master' of ../actual_remote diff --git a/test/integration/forcePush/expected/.git_keep/HEAD b/test/integration/forcePush/expected/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/forcePush/expected/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/forcePush/expected/.git_keep/ORIG_HEAD b/test/integration/forcePush/expected/.git_keep/ORIG_HEAD new file mode 100644 index 000000000..c081af82f --- /dev/null +++ b/test/integration/forcePush/expected/.git_keep/ORIG_HEAD @@ -0,0 +1 @@ +a9848fd98935937cd7d3909023ed1b588ccd4bfb diff --git a/test/integration/forcePush/expected/.git_keep/config b/test/integration/forcePush/expected/.git_keep/config new file mode 100644 index 000000000..821803a3e --- /dev/null +++ b/test/integration/forcePush/expected/.git_keep/config @@ -0,0 +1,16 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[remote "origin"] + url = ../actual_remote + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master diff --git a/test/integration/forcePush/expected/.git_keep/description b/test/integration/forcePush/expected/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/forcePush/expected/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/forcePush/expected/.git_keep/index b/test/integration/forcePush/expected/.git_keep/index new file mode 100644 index 000000000..84d23c3f4 Binary files /dev/null and b/test/integration/forcePush/expected/.git_keep/index differ diff --git a/test/integration/forcePush/expected/.git_keep/info/exclude b/test/integration/forcePush/expected/.git_keep/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/forcePush/expected/.git_keep/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/forcePush/expected/.git_keep/logs/HEAD b/test/integration/forcePush/expected/.git_keep/logs/HEAD new file mode 100644 index 000000000..9cef8b360 --- /dev/null +++ b/test/integration/forcePush/expected/.git_keep/logs/HEAD @@ -0,0 +1,5 @@ +0000000000000000000000000000000000000000 1fe60e6b7023a1b9751850f83ac5bda49ddd9278 CI 1634897551 +1100 commit (initial): myfile1 +1fe60e6b7023a1b9751850f83ac5bda49ddd9278 66bd8d357f6226ec264478db3606bc1c4be87e63 CI 1634897551 +1100 commit: myfile2 +66bd8d357f6226ec264478db3606bc1c4be87e63 a9848fd98935937cd7d3909023ed1b588ccd4bfb CI 1634897551 +1100 commit: myfile3 +a9848fd98935937cd7d3909023ed1b588ccd4bfb 66bd8d357f6226ec264478db3606bc1c4be87e63 CI 1634897551 +1100 reset: moving to HEAD^ +66bd8d357f6226ec264478db3606bc1c4be87e63 aed1af42535c9c6a27b9f660119452328fddd7cd CI 1634897551 +1100 commit: myfile4 diff --git a/test/integration/forcePush/expected/.git_keep/logs/refs/heads/master b/test/integration/forcePush/expected/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..9cef8b360 --- /dev/null +++ b/test/integration/forcePush/expected/.git_keep/logs/refs/heads/master @@ -0,0 +1,5 @@ +0000000000000000000000000000000000000000 1fe60e6b7023a1b9751850f83ac5bda49ddd9278 CI 1634897551 +1100 commit (initial): myfile1 +1fe60e6b7023a1b9751850f83ac5bda49ddd9278 66bd8d357f6226ec264478db3606bc1c4be87e63 CI 1634897551 +1100 commit: myfile2 +66bd8d357f6226ec264478db3606bc1c4be87e63 a9848fd98935937cd7d3909023ed1b588ccd4bfb CI 1634897551 +1100 commit: myfile3 +a9848fd98935937cd7d3909023ed1b588ccd4bfb 66bd8d357f6226ec264478db3606bc1c4be87e63 CI 1634897551 +1100 reset: moving to HEAD^ +66bd8d357f6226ec264478db3606bc1c4be87e63 aed1af42535c9c6a27b9f660119452328fddd7cd CI 1634897551 +1100 commit: myfile4 diff --git a/test/integration/forcePush/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/forcePush/expected/.git_keep/logs/refs/remotes/origin/master new file mode 100644 index 000000000..9ba3d77f4 --- /dev/null +++ b/test/integration/forcePush/expected/.git_keep/logs/refs/remotes/origin/master @@ -0,0 +1,3 @@ +0000000000000000000000000000000000000000 66bd8d357f6226ec264478db3606bc1c4be87e63 CI 1634897551 +1100 fetch origin: storing head +66bd8d357f6226ec264478db3606bc1c4be87e63 a9848fd98935937cd7d3909023ed1b588ccd4bfb CI 1634897551 +1100 update by push +a9848fd98935937cd7d3909023ed1b588ccd4bfb aed1af42535c9c6a27b9f660119452328fddd7cd CI 1634897553 +1100 update by push diff --git a/test/integration/forcePush/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/forcePush/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/forcePush/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/forcePush/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/forcePush/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/forcePush/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/forcePush/expected/.git_keep/objects/1f/e60e6b7023a1b9751850f83ac5bda49ddd9278 b/test/integration/forcePush/expected/.git_keep/objects/1f/e60e6b7023a1b9751850f83ac5bda49ddd9278 new file mode 100644 index 000000000..3c2c7f4e4 --- /dev/null +++ b/test/integration/forcePush/expected/.git_keep/objects/1f/e60e6b7023a1b9751850f83ac5bda49ddd9278 @@ -0,0 +1,5 @@ +xA +0@ѮsJF'E +:]Dmz9^stRBsf2lyWCj>ęcD1r*7q'Y =!pFzLu37;/O%):e \ No newline at end of file diff --git a/test/integration/forcePush/expected/.git_keep/objects/ce/0848710343a75263ea72cb5bdfa666b9ecda68 b/test/integration/forcePush/expected/.git_keep/objects/ce/0848710343a75263ea72cb5bdfa666b9ecda68 new file mode 100644 index 000000000..5e9361d35 Binary files /dev/null and b/test/integration/forcePush/expected/.git_keep/objects/ce/0848710343a75263ea72cb5bdfa666b9ecda68 differ diff --git a/test/integration/forcePush/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/forcePush/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/forcePush/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/forcePush/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/forcePush/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/forcePush/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/forcePush/expected/.git_keep/refs/heads/master b/test/integration/forcePush/expected/.git_keep/refs/heads/master new file mode 100644 index 000000000..eaa7bcba3 --- /dev/null +++ b/test/integration/forcePush/expected/.git_keep/refs/heads/master @@ -0,0 +1 @@ +aed1af42535c9c6a27b9f660119452328fddd7cd diff --git a/test/integration/forcePush/expected/.git_keep/refs/remotes/origin/master b/test/integration/forcePush/expected/.git_keep/refs/remotes/origin/master new file mode 100644 index 000000000..eaa7bcba3 --- /dev/null +++ b/test/integration/forcePush/expected/.git_keep/refs/remotes/origin/master @@ -0,0 +1 @@ +aed1af42535c9c6a27b9f660119452328fddd7cd diff --git a/test/integration/forcePush/expected/myfile1 b/test/integration/forcePush/expected/myfile1 new file mode 100644 index 000000000..a5bce3fd2 --- /dev/null +++ b/test/integration/forcePush/expected/myfile1 @@ -0,0 +1 @@ +test1 diff --git a/test/integration/forcePush/expected/myfile2 b/test/integration/forcePush/expected/myfile2 new file mode 100644 index 000000000..180cf8328 --- /dev/null +++ b/test/integration/forcePush/expected/myfile2 @@ -0,0 +1 @@ +test2 diff --git a/test/integration/forcePush/expected/myfile4 b/test/integration/forcePush/expected/myfile4 new file mode 100644 index 000000000..d234c5e05 --- /dev/null +++ b/test/integration/forcePush/expected/myfile4 @@ -0,0 +1 @@ +test4 diff --git a/test/integration/forcePush/expected_remote/HEAD b/test/integration/forcePush/expected_remote/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/forcePush/expected_remote/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/forcePush/expected_remote/config b/test/integration/forcePush/expected_remote/config new file mode 100644 index 000000000..ea4d9033b --- /dev/null +++ b/test/integration/forcePush/expected_remote/config @@ -0,0 +1,8 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true + ignorecase = true + precomposeunicode = true +[remote "origin"] + url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/forcePush/./actual diff --git a/test/integration/forcePush/expected_remote/description b/test/integration/forcePush/expected_remote/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/forcePush/expected_remote/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/forcePush/expected_remote/info/exclude b/test/integration/forcePush/expected_remote/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/forcePush/expected_remote/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/forcePush/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/forcePush/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/forcePush/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/forcePush/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/forcePush/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/forcePush/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/forcePush/expected_remote/objects/1f/e60e6b7023a1b9751850f83ac5bda49ddd9278 b/test/integration/forcePush/expected_remote/objects/1f/e60e6b7023a1b9751850f83ac5bda49ddd9278 new file mode 100644 index 000000000..3c2c7f4e4 --- /dev/null +++ b/test/integration/forcePush/expected_remote/objects/1f/e60e6b7023a1b9751850f83ac5bda49ddd9278 @@ -0,0 +1,5 @@ +xA +0@ѮsJF'E +:]Dmz9^stRBsf2lyWCj>ęcD1r*7q'Y =!pFzLu37;/O%):e \ No newline at end of file diff --git a/test/integration/forcePush/expected_remote/objects/ce/0848710343a75263ea72cb5bdfa666b9ecda68 b/test/integration/forcePush/expected_remote/objects/ce/0848710343a75263ea72cb5bdfa666b9ecda68 new file mode 100644 index 000000000..5e9361d35 Binary files /dev/null and b/test/integration/forcePush/expected_remote/objects/ce/0848710343a75263ea72cb5bdfa666b9ecda68 differ diff --git a/test/integration/forcePush/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/forcePush/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/forcePush/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/forcePush/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/forcePush/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/forcePush/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/forcePush/expected_remote/packed-refs b/test/integration/forcePush/expected_remote/packed-refs new file mode 100644 index 000000000..7a7114a0a --- /dev/null +++ b/test/integration/forcePush/expected_remote/packed-refs @@ -0,0 +1,2 @@ +# pack-refs with: peeled fully-peeled sorted +66bd8d357f6226ec264478db3606bc1c4be87e63 refs/heads/master diff --git a/test/integration/forcePush/expected_remote/refs/heads/master b/test/integration/forcePush/expected_remote/refs/heads/master new file mode 100644 index 000000000..eaa7bcba3 --- /dev/null +++ b/test/integration/forcePush/expected_remote/refs/heads/master @@ -0,0 +1 @@ +aed1af42535c9c6a27b9f660119452328fddd7cd diff --git a/test/integration/forcePush/recording.json b/test/integration/forcePush/recording.json new file mode 100644 index 000000000..1fd122aab --- /dev/null +++ b/test/integration/forcePush/recording.json @@ -0,0 +1 @@ +{"KeyEvents":[{"Timestamp":1054,"Mod":0,"Key":256,"Ch":80},{"Timestamp":1736,"Mod":0,"Key":13,"Ch":13},{"Timestamp":2486,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/forcePush/setup.sh b/test/integration/forcePush/setup.sh new file mode 100644 index 000000000..79a9499d0 --- /dev/null +++ b/test/integration/forcePush/setup.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +set -e + +cd $1 + +git init + +git config user.email "CI@example.com" +git config user.name "CI" + +echo test1 > myfile1 +git add . +git commit -am "myfile1" +echo test2 > myfile2 +git add . +git commit -am "myfile2" + +cd .. +git clone --bare ./actual actual_remote + +cd actual + +git remote add origin ../actual_remote +git fetch origin +git branch --set-upstream-to=origin/master master + +echo test3 > myfile3 +git add . +git commit -am "myfile3" + +git push origin master + +git reset --hard HEAD^ + +echo test4 > myfile4 +git add . +git commit -am "myfile4" + diff --git a/test/integration/forcePush/test.json b/test/integration/forcePush/test.json new file mode 100644 index 000000000..42519ead4 --- /dev/null +++ b/test/integration/forcePush/test.json @@ -0,0 +1 @@ +{ "description": "force push with lease if required", "speed": 10 } diff --git a/test/integration/pull/expected/.git_keep/COMMIT_EDITMSG b/test/integration/pull/expected/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..51be8ec3d --- /dev/null +++ b/test/integration/pull/expected/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +myfile4 diff --git a/test/integration/pull/expected/.git_keep/FETCH_HEAD b/test/integration/pull/expected/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..d13b7c7d7 --- /dev/null +++ b/test/integration/pull/expected/.git_keep/FETCH_HEAD @@ -0,0 +1 @@ +6ad6c42187d356f4eab4f004cca17863746adec1 branch 'master' of ../actual_remote diff --git a/test/integration/pull/expected/.git_keep/HEAD b/test/integration/pull/expected/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pull/expected/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pull/expected/.git_keep/ORIG_HEAD b/test/integration/pull/expected/.git_keep/ORIG_HEAD new file mode 100644 index 000000000..22c16cf39 --- /dev/null +++ b/test/integration/pull/expected/.git_keep/ORIG_HEAD @@ -0,0 +1 @@ +0c0f210a4e5ff3b58e4190501c2b755695f439fa diff --git a/test/integration/pull/expected/.git_keep/config b/test/integration/pull/expected/.git_keep/config new file mode 100644 index 000000000..821803a3e --- /dev/null +++ b/test/integration/pull/expected/.git_keep/config @@ -0,0 +1,16 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[remote "origin"] + url = ../actual_remote + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master diff --git a/test/integration/pull/expected/.git_keep/description b/test/integration/pull/expected/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pull/expected/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pull/expected/.git_keep/index b/test/integration/pull/expected/.git_keep/index new file mode 100644 index 000000000..85847f137 Binary files /dev/null and b/test/integration/pull/expected/.git_keep/index differ diff --git a/test/integration/pull/expected/.git_keep/info/exclude b/test/integration/pull/expected/.git_keep/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pull/expected/.git_keep/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pull/expected/.git_keep/logs/HEAD b/test/integration/pull/expected/.git_keep/logs/HEAD new file mode 100644 index 000000000..f15401d8d --- /dev/null +++ b/test/integration/pull/expected/.git_keep/logs/HEAD @@ -0,0 +1,6 @@ +0000000000000000000000000000000000000000 003527daa0801470151d8f93140a02fc306fea00 CI 1634896904 +1100 commit (initial): myfile1 +003527daa0801470151d8f93140a02fc306fea00 0c0f210a4e5ff3b58e4190501c2b755695f439fa CI 1634896904 +1100 commit: myfile2 +0c0f210a4e5ff3b58e4190501c2b755695f439fa 336826e035e431ac94eca7f3cb6dd3fb072f7a5a CI 1634896904 +1100 commit: myfile3 +336826e035e431ac94eca7f3cb6dd3fb072f7a5a 6ad6c42187d356f4eab4f004cca17863746adec1 CI 1634896904 +1100 commit: myfile4 +6ad6c42187d356f4eab4f004cca17863746adec1 0c0f210a4e5ff3b58e4190501c2b755695f439fa CI 1634896904 +1100 reset: moving to head^^ +0c0f210a4e5ff3b58e4190501c2b755695f439fa 6ad6c42187d356f4eab4f004cca17863746adec1 CI 1634896905 +1100 pull --no-edit: Fast-forward diff --git a/test/integration/pull/expected/.git_keep/logs/refs/heads/master b/test/integration/pull/expected/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..f15401d8d --- /dev/null +++ b/test/integration/pull/expected/.git_keep/logs/refs/heads/master @@ -0,0 +1,6 @@ +0000000000000000000000000000000000000000 003527daa0801470151d8f93140a02fc306fea00 CI 1634896904 +1100 commit (initial): myfile1 +003527daa0801470151d8f93140a02fc306fea00 0c0f210a4e5ff3b58e4190501c2b755695f439fa CI 1634896904 +1100 commit: myfile2 +0c0f210a4e5ff3b58e4190501c2b755695f439fa 336826e035e431ac94eca7f3cb6dd3fb072f7a5a CI 1634896904 +1100 commit: myfile3 +336826e035e431ac94eca7f3cb6dd3fb072f7a5a 6ad6c42187d356f4eab4f004cca17863746adec1 CI 1634896904 +1100 commit: myfile4 +6ad6c42187d356f4eab4f004cca17863746adec1 0c0f210a4e5ff3b58e4190501c2b755695f439fa CI 1634896904 +1100 reset: moving to head^^ +0c0f210a4e5ff3b58e4190501c2b755695f439fa 6ad6c42187d356f4eab4f004cca17863746adec1 CI 1634896905 +1100 pull --no-edit: Fast-forward diff --git a/test/integration/pull/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/pull/expected/.git_keep/logs/refs/remotes/origin/master new file mode 100644 index 000000000..b254fcd0d --- /dev/null +++ b/test/integration/pull/expected/.git_keep/logs/refs/remotes/origin/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 6ad6c42187d356f4eab4f004cca17863746adec1 CI 1634896904 +1100 fetch origin: storing head diff --git a/test/integration/pull/expected/.git_keep/objects/00/3527daa0801470151d8f93140a02fc306fea00 b/test/integration/pull/expected/.git_keep/objects/00/3527daa0801470151d8f93140a02fc306fea00 new file mode 100644 index 000000000..0ed3c76d8 --- /dev/null +++ b/test/integration/pull/expected/.git_keep/objects/00/3527daa0801470151d8f93140a02fc306fea00 @@ -0,0 +1,2 @@ +xA +0@ѮsʌNJ\yL")#tyS5[˥*`e3쩋T^%{⧽ i-U{I>H@+;9i'w+4, \ No newline at end of file diff --git a/test/integration/pull/expected/.git_keep/objects/0c/0f210a4e5ff3b58e4190501c2b755695f439fa b/test/integration/pull/expected/.git_keep/objects/0c/0f210a4e5ff3b58e4190501c2b755695f439fa new file mode 100644 index 000000000..a89fa981c Binary files /dev/null and b/test/integration/pull/expected/.git_keep/objects/0c/0f210a4e5ff3b58e4190501c2b755695f439fa differ diff --git a/test/integration/pull/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pull/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pull/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pull/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pull/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pull/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pull/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pull/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pull/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pull/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pull/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pull/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pull/expected/.git_keep/objects/33/6826e035e431ac94eca7f3cb6dd3fb072f7a5a b/test/integration/pull/expected/.git_keep/objects/33/6826e035e431ac94eca7f3cb6dd3fb072f7a5a new file mode 100644 index 000000000..2b7ab37ad Binary files /dev/null and b/test/integration/pull/expected/.git_keep/objects/33/6826e035e431ac94eca7f3cb6dd3fb072f7a5a differ diff --git a/test/integration/pull/expected/.git_keep/objects/6a/d6c42187d356f4eab4f004cca17863746adec1 b/test/integration/pull/expected/.git_keep/objects/6a/d6c42187d356f4eab4f004cca17863746adec1 new file mode 100644 index 000000000..335077711 --- /dev/null +++ b/test/integration/pull/expected/.git_keep/objects/6a/d6c42187d356f4eab4f004cca17863746adec1 @@ -0,0 +1,2 @@ +xA +0@Q9Ed2I"BW=4`R"~◵[t껪! #LhkdO f]_"rLZ$V,3E_1uhx׏FJ#{p'7[90 \ No newline at end of file diff --git a/test/integration/pull/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pull/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pull/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pull/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pull/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pull/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pull/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/pull/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/pull/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/pull/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pull/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pull/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pull/expected/.git_keep/refs/heads/master b/test/integration/pull/expected/.git_keep/refs/heads/master new file mode 100644 index 000000000..120f0043b --- /dev/null +++ b/test/integration/pull/expected/.git_keep/refs/heads/master @@ -0,0 +1 @@ +6ad6c42187d356f4eab4f004cca17863746adec1 diff --git a/test/integration/pull/expected/.git_keep/refs/remotes/origin/master b/test/integration/pull/expected/.git_keep/refs/remotes/origin/master new file mode 100644 index 000000000..120f0043b --- /dev/null +++ b/test/integration/pull/expected/.git_keep/refs/remotes/origin/master @@ -0,0 +1 @@ +6ad6c42187d356f4eab4f004cca17863746adec1 diff --git a/test/integration/pull/expected/myfile1 b/test/integration/pull/expected/myfile1 new file mode 100644 index 000000000..a5bce3fd2 --- /dev/null +++ b/test/integration/pull/expected/myfile1 @@ -0,0 +1 @@ +test1 diff --git a/test/integration/pull/expected/myfile2 b/test/integration/pull/expected/myfile2 new file mode 100644 index 000000000..180cf8328 --- /dev/null +++ b/test/integration/pull/expected/myfile2 @@ -0,0 +1 @@ +test2 diff --git a/test/integration/pull/expected/myfile3 b/test/integration/pull/expected/myfile3 new file mode 100644 index 000000000..df6b0d2bc --- /dev/null +++ b/test/integration/pull/expected/myfile3 @@ -0,0 +1 @@ +test3 diff --git a/test/integration/pull/expected/myfile4 b/test/integration/pull/expected/myfile4 new file mode 100644 index 000000000..d234c5e05 --- /dev/null +++ b/test/integration/pull/expected/myfile4 @@ -0,0 +1 @@ +test4 diff --git a/test/integration/pull/expected_remote/HEAD b/test/integration/pull/expected_remote/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pull/expected_remote/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pull/expected_remote/config b/test/integration/pull/expected_remote/config new file mode 100644 index 000000000..94ceda391 --- /dev/null +++ b/test/integration/pull/expected_remote/config @@ -0,0 +1,8 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true + ignorecase = true + precomposeunicode = true +[remote "origin"] + url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/pull/./actual diff --git a/test/integration/pull/expected_remote/description b/test/integration/pull/expected_remote/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pull/expected_remote/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pull/expected_remote/info/exclude b/test/integration/pull/expected_remote/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pull/expected_remote/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pull/expected_remote/objects/00/3527daa0801470151d8f93140a02fc306fea00 b/test/integration/pull/expected_remote/objects/00/3527daa0801470151d8f93140a02fc306fea00 new file mode 100644 index 000000000..0ed3c76d8 --- /dev/null +++ b/test/integration/pull/expected_remote/objects/00/3527daa0801470151d8f93140a02fc306fea00 @@ -0,0 +1,2 @@ +xA +0@ѮsʌNJ\yL")#tyS5[˥*`e3쩋T^%{⧽ i-U{I>H@+;9i'w+4, \ No newline at end of file diff --git a/test/integration/pull/expected_remote/objects/0c/0f210a4e5ff3b58e4190501c2b755695f439fa b/test/integration/pull/expected_remote/objects/0c/0f210a4e5ff3b58e4190501c2b755695f439fa new file mode 100644 index 000000000..a89fa981c Binary files /dev/null and b/test/integration/pull/expected_remote/objects/0c/0f210a4e5ff3b58e4190501c2b755695f439fa differ diff --git a/test/integration/pull/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pull/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pull/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pull/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pull/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pull/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pull/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pull/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pull/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pull/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pull/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pull/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pull/expected_remote/objects/33/6826e035e431ac94eca7f3cb6dd3fb072f7a5a b/test/integration/pull/expected_remote/objects/33/6826e035e431ac94eca7f3cb6dd3fb072f7a5a new file mode 100644 index 000000000..2b7ab37ad Binary files /dev/null and b/test/integration/pull/expected_remote/objects/33/6826e035e431ac94eca7f3cb6dd3fb072f7a5a differ diff --git a/test/integration/pull/expected_remote/objects/6a/d6c42187d356f4eab4f004cca17863746adec1 b/test/integration/pull/expected_remote/objects/6a/d6c42187d356f4eab4f004cca17863746adec1 new file mode 100644 index 000000000..335077711 --- /dev/null +++ b/test/integration/pull/expected_remote/objects/6a/d6c42187d356f4eab4f004cca17863746adec1 @@ -0,0 +1,2 @@ +xA +0@Q9Ed2I"BW=4`R"~◵[t껪! #LhkdO f]_"rLZ$V,3E_1uhx׏FJ#{p'7[90 \ No newline at end of file diff --git a/test/integration/pull/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pull/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pull/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pull/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pull/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pull/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pull/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/pull/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/pull/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/pull/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pull/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pull/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pull/expected_remote/packed-refs b/test/integration/pull/expected_remote/packed-refs new file mode 100644 index 000000000..2683a6cf6 --- /dev/null +++ b/test/integration/pull/expected_remote/packed-refs @@ -0,0 +1,2 @@ +# pack-refs with: peeled fully-peeled sorted +6ad6c42187d356f4eab4f004cca17863746adec1 refs/heads/master diff --git a/test/integration/pull/recording.json b/test/integration/pull/recording.json new file mode 100644 index 000000000..9aa74c150 --- /dev/null +++ b/test/integration/pull/recording.json @@ -0,0 +1 @@ +{"KeyEvents":[{"Timestamp":618,"Mod":0,"Key":256,"Ch":112},{"Timestamp":1225,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/pull/setup.sh b/test/integration/pull/setup.sh new file mode 100644 index 000000000..2634d0278 --- /dev/null +++ b/test/integration/pull/setup.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +set -e + +cd $1 + +git init + +git config user.email "CI@example.com" +git config user.name "CI" + +echo test1 > myfile1 +git add . +git commit -am "myfile1" +echo test2 > myfile2 +git add . +git commit -am "myfile2" +echo test3 > myfile3 +git add . +git commit -am "myfile3" +echo test4 > myfile4 +git add . +git commit -am "myfile4" + +cd .. +git clone --bare ./actual actual_remote + +cd actual + +# the test is to ensure that we actually can pull these two commits back from the origin +git reset --hard HEAD~2 +git remote add origin ../actual_remote +git fetch origin +git branch --set-upstream-to=origin/master master diff --git a/test/integration/pull/test.json b/test/integration/pull/test.json new file mode 100644 index 000000000..93a03aaea --- /dev/null +++ b/test/integration/pull/test.json @@ -0,0 +1 @@ +{ "description": "pull changes from the remote", "speed": 10 } diff --git a/test/integration/pullMerge/expected/.git_keep/COMMIT_EDITMSG b/test/integration/pullMerge/expected/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..51be8ec3d --- /dev/null +++ b/test/integration/pullMerge/expected/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +myfile4 diff --git a/test/integration/pullMerge/expected/.git_keep/FETCH_HEAD b/test/integration/pullMerge/expected/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..e2a5e2793 --- /dev/null +++ b/test/integration/pullMerge/expected/.git_keep/FETCH_HEAD @@ -0,0 +1 @@ +7f157a65ec0c8d6cffce08d6768e6733939e75a1 branch 'master' of ../actual_remote diff --git a/test/integration/pullMerge/expected/.git_keep/HEAD b/test/integration/pullMerge/expected/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pullMerge/expected/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pullMerge/expected/.git_keep/ORIG_HEAD b/test/integration/pullMerge/expected/.git_keep/ORIG_HEAD new file mode 100644 index 000000000..d3db7a1d9 --- /dev/null +++ b/test/integration/pullMerge/expected/.git_keep/ORIG_HEAD @@ -0,0 +1 @@ +2a0805355a8040f9eebfa2dbf70b8bc313d6f456 diff --git a/test/integration/pullMerge/expected/.git_keep/config b/test/integration/pullMerge/expected/.git_keep/config new file mode 100644 index 000000000..110d1b43e --- /dev/null +++ b/test/integration/pullMerge/expected/.git_keep/config @@ -0,0 +1,18 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[remote "origin"] + url = ../actual_remote + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master +[pull] + rebase = false diff --git a/test/integration/pullMerge/expected/.git_keep/description b/test/integration/pullMerge/expected/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pullMerge/expected/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pullMerge/expected/.git_keep/index b/test/integration/pullMerge/expected/.git_keep/index new file mode 100644 index 000000000..d8f385b74 Binary files /dev/null and b/test/integration/pullMerge/expected/.git_keep/index differ diff --git a/test/integration/pullMerge/expected/.git_keep/info/exclude b/test/integration/pullMerge/expected/.git_keep/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pullMerge/expected/.git_keep/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pullMerge/expected/.git_keep/logs/HEAD b/test/integration/pullMerge/expected/.git_keep/logs/HEAD new file mode 100644 index 000000000..bd085fb7f --- /dev/null +++ b/test/integration/pullMerge/expected/.git_keep/logs/HEAD @@ -0,0 +1,7 @@ +0000000000000000000000000000000000000000 7c0bda1656e7695870ed15839643564b0a9283a8 CI 1634896907 +1100 commit (initial): myfile1 +7c0bda1656e7695870ed15839643564b0a9283a8 5529eadf398ce89032744d5f4151000f07d70124 CI 1634896907 +1100 commit: myfile2 +5529eadf398ce89032744d5f4151000f07d70124 703e85166069a42b4254af06b68dffc159ea3f24 CI 1634896907 +1100 commit: myfile3 +703e85166069a42b4254af06b68dffc159ea3f24 7f157a65ec0c8d6cffce08d6768e6733939e75a1 CI 1634896907 +1100 commit: myfile4 +7f157a65ec0c8d6cffce08d6768e6733939e75a1 5529eadf398ce89032744d5f4151000f07d70124 CI 1634896907 +1100 reset: moving to head^^ +5529eadf398ce89032744d5f4151000f07d70124 2a0805355a8040f9eebfa2dbf70b8bc313d6f456 CI 1634896907 +1100 commit: myfile4 +2a0805355a8040f9eebfa2dbf70b8bc313d6f456 b10baba2f9d877322f94f8770e2e0c8ab1db6bcc CI 1634896908 +1100 pull --no-edit: Merge made by the 'recursive' strategy. diff --git a/test/integration/pullMerge/expected/.git_keep/logs/refs/heads/master b/test/integration/pullMerge/expected/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..bd085fb7f --- /dev/null +++ b/test/integration/pullMerge/expected/.git_keep/logs/refs/heads/master @@ -0,0 +1,7 @@ +0000000000000000000000000000000000000000 7c0bda1656e7695870ed15839643564b0a9283a8 CI 1634896907 +1100 commit (initial): myfile1 +7c0bda1656e7695870ed15839643564b0a9283a8 5529eadf398ce89032744d5f4151000f07d70124 CI 1634896907 +1100 commit: myfile2 +5529eadf398ce89032744d5f4151000f07d70124 703e85166069a42b4254af06b68dffc159ea3f24 CI 1634896907 +1100 commit: myfile3 +703e85166069a42b4254af06b68dffc159ea3f24 7f157a65ec0c8d6cffce08d6768e6733939e75a1 CI 1634896907 +1100 commit: myfile4 +7f157a65ec0c8d6cffce08d6768e6733939e75a1 5529eadf398ce89032744d5f4151000f07d70124 CI 1634896907 +1100 reset: moving to head^^ +5529eadf398ce89032744d5f4151000f07d70124 2a0805355a8040f9eebfa2dbf70b8bc313d6f456 CI 1634896907 +1100 commit: myfile4 +2a0805355a8040f9eebfa2dbf70b8bc313d6f456 b10baba2f9d877322f94f8770e2e0c8ab1db6bcc CI 1634896908 +1100 pull --no-edit: Merge made by the 'recursive' strategy. diff --git a/test/integration/pullMerge/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/pullMerge/expected/.git_keep/logs/refs/remotes/origin/master new file mode 100644 index 000000000..cd4098ff1 --- /dev/null +++ b/test/integration/pullMerge/expected/.git_keep/logs/refs/remotes/origin/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 7f157a65ec0c8d6cffce08d6768e6733939e75a1 CI 1634896907 +1100 fetch origin: storing head diff --git a/test/integration/pullMerge/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pullMerge/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pullMerge/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pullMerge/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pullMerge/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pullMerge/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pullMerge/expected/.git_keep/objects/2a/0805355a8040f9eebfa2dbf70b8bc313d6f456 b/test/integration/pullMerge/expected/.git_keep/objects/2a/0805355a8040f9eebfa2dbf70b8bc313d6f456 new file mode 100644 index 000000000..8988a8d06 Binary files /dev/null and b/test/integration/pullMerge/expected/.git_keep/objects/2a/0805355a8040f9eebfa2dbf70b8bc313d6f456 differ diff --git a/test/integration/pullMerge/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pullMerge/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pullMerge/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pullMerge/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pullMerge/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pullMerge/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pullMerge/expected/.git_keep/objects/55/29eadf398ce89032744d5f4151000f07d70124 b/test/integration/pullMerge/expected/.git_keep/objects/55/29eadf398ce89032744d5f4151000f07d70124 new file mode 100644 index 000000000..c0dd8a01d --- /dev/null +++ b/test/integration/pullMerge/expected/.git_keep/objects/55/29eadf398ce89032744d5f4151000f07d70124 @@ -0,0 +1,2 @@ +xK +0@] 2$"BW=ƴ`R">7-"SU$P"W(E2׉ɞA}Tg~j|9] \ No newline at end of file diff --git a/test/integration/pullMerge/expected/.git_keep/objects/70/3e85166069a42b4254af06b68dffc159ea3f24 b/test/integration/pullMerge/expected/.git_keep/objects/70/3e85166069a42b4254af06b68dffc159ea3f24 new file mode 100644 index 000000000..48dfdc50c Binary files /dev/null and b/test/integration/pullMerge/expected/.git_keep/objects/70/3e85166069a42b4254af06b68dffc159ea3f24 differ diff --git a/test/integration/pullMerge/expected/.git_keep/objects/7c/0bda1656e7695870ed15839643564b0a9283a8 b/test/integration/pullMerge/expected/.git_keep/objects/7c/0bda1656e7695870ed15839643564b0a9283a8 new file mode 100644 index 000000000..b08614b98 --- /dev/null +++ b/test/integration/pullMerge/expected/.git_keep/objects/7c/0bda1656e7695870ed15839643564b0a9283a8 @@ -0,0 +1,3 @@ +xA +0@Q9iI"BW=FL!R"~r*JdQCaV +R "\S.0p~6fw 9DLzLɝ})5, \ No newline at end of file diff --git a/test/integration/pullMerge/expected/.git_keep/objects/7f/157a65ec0c8d6cffce08d6768e6733939e75a1 b/test/integration/pullMerge/expected/.git_keep/objects/7f/157a65ec0c8d6cffce08d6768e6733939e75a1 new file mode 100644 index 000000000..1af721127 Binary files /dev/null and b/test/integration/pullMerge/expected/.git_keep/objects/7f/157a65ec0c8d6cffce08d6768e6733939e75a1 differ diff --git a/test/integration/pullMerge/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pullMerge/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pullMerge/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pullMerge/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pullMerge/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pullMerge/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pullMerge/expected/.git_keep/objects/b1/0baba2f9d877322f94f8770e2e0c8ab1db6bcc b/test/integration/pullMerge/expected/.git_keep/objects/b1/0baba2f9d877322f94f8770e2e0c8ab1db6bcc new file mode 100644 index 000000000..d3842cf9b Binary files /dev/null and b/test/integration/pullMerge/expected/.git_keep/objects/b1/0baba2f9d877322f94f8770e2e0c8ab1db6bcc differ diff --git a/test/integration/pullMerge/expected/.git_keep/objects/ce/0848710343a75263ea72cb5bdfa666b9ecda68 b/test/integration/pullMerge/expected/.git_keep/objects/ce/0848710343a75263ea72cb5bdfa666b9ecda68 new file mode 100644 index 000000000..5e9361d35 Binary files /dev/null and b/test/integration/pullMerge/expected/.git_keep/objects/ce/0848710343a75263ea72cb5bdfa666b9ecda68 differ diff --git a/test/integration/pullMerge/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/pullMerge/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/pullMerge/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/pullMerge/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pullMerge/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pullMerge/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pullMerge/expected/.git_keep/refs/heads/master b/test/integration/pullMerge/expected/.git_keep/refs/heads/master new file mode 100644 index 000000000..547542fbd --- /dev/null +++ b/test/integration/pullMerge/expected/.git_keep/refs/heads/master @@ -0,0 +1 @@ +b10baba2f9d877322f94f8770e2e0c8ab1db6bcc diff --git a/test/integration/pullMerge/expected/.git_keep/refs/remotes/origin/master b/test/integration/pullMerge/expected/.git_keep/refs/remotes/origin/master new file mode 100644 index 000000000..0b78ce1e0 --- /dev/null +++ b/test/integration/pullMerge/expected/.git_keep/refs/remotes/origin/master @@ -0,0 +1 @@ +7f157a65ec0c8d6cffce08d6768e6733939e75a1 diff --git a/test/integration/pullMerge/expected/myfile1 b/test/integration/pullMerge/expected/myfile1 new file mode 100644 index 000000000..a5bce3fd2 --- /dev/null +++ b/test/integration/pullMerge/expected/myfile1 @@ -0,0 +1 @@ +test1 diff --git a/test/integration/pullMerge/expected/myfile2 b/test/integration/pullMerge/expected/myfile2 new file mode 100644 index 000000000..180cf8328 --- /dev/null +++ b/test/integration/pullMerge/expected/myfile2 @@ -0,0 +1 @@ +test2 diff --git a/test/integration/pullMerge/expected/myfile3 b/test/integration/pullMerge/expected/myfile3 new file mode 100644 index 000000000..df6b0d2bc --- /dev/null +++ b/test/integration/pullMerge/expected/myfile3 @@ -0,0 +1 @@ +test3 diff --git a/test/integration/pullMerge/expected/myfile4 b/test/integration/pullMerge/expected/myfile4 new file mode 100644 index 000000000..d234c5e05 --- /dev/null +++ b/test/integration/pullMerge/expected/myfile4 @@ -0,0 +1 @@ +test4 diff --git a/test/integration/pullMerge/expected_remote/HEAD b/test/integration/pullMerge/expected_remote/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pullMerge/expected_remote/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pullMerge/expected_remote/config b/test/integration/pullMerge/expected_remote/config new file mode 100644 index 000000000..5a46fafb8 --- /dev/null +++ b/test/integration/pullMerge/expected_remote/config @@ -0,0 +1,8 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true + ignorecase = true + precomposeunicode = true +[remote "origin"] + url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/pullMerge/./actual diff --git a/test/integration/pullMerge/expected_remote/description b/test/integration/pullMerge/expected_remote/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pullMerge/expected_remote/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pullMerge/expected_remote/info/exclude b/test/integration/pullMerge/expected_remote/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pullMerge/expected_remote/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pullMerge/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pullMerge/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pullMerge/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pullMerge/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pullMerge/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pullMerge/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pullMerge/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pullMerge/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pullMerge/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pullMerge/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pullMerge/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pullMerge/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pullMerge/expected_remote/objects/55/29eadf398ce89032744d5f4151000f07d70124 b/test/integration/pullMerge/expected_remote/objects/55/29eadf398ce89032744d5f4151000f07d70124 new file mode 100644 index 000000000..c0dd8a01d --- /dev/null +++ b/test/integration/pullMerge/expected_remote/objects/55/29eadf398ce89032744d5f4151000f07d70124 @@ -0,0 +1,2 @@ +xK +0@] 2$"BW=ƴ`R">7-"SU$P"W(E2׉ɞA}Tg~j|9] \ No newline at end of file diff --git a/test/integration/pullMerge/expected_remote/objects/70/3e85166069a42b4254af06b68dffc159ea3f24 b/test/integration/pullMerge/expected_remote/objects/70/3e85166069a42b4254af06b68dffc159ea3f24 new file mode 100644 index 000000000..48dfdc50c Binary files /dev/null and b/test/integration/pullMerge/expected_remote/objects/70/3e85166069a42b4254af06b68dffc159ea3f24 differ diff --git a/test/integration/pullMerge/expected_remote/objects/7c/0bda1656e7695870ed15839643564b0a9283a8 b/test/integration/pullMerge/expected_remote/objects/7c/0bda1656e7695870ed15839643564b0a9283a8 new file mode 100644 index 000000000..b08614b98 --- /dev/null +++ b/test/integration/pullMerge/expected_remote/objects/7c/0bda1656e7695870ed15839643564b0a9283a8 @@ -0,0 +1,3 @@ +xA +0@Q9iI"BW=FL!R"~r*JdQCaV +R "\S.0p~6fw 9DLzLɝ})5, \ No newline at end of file diff --git a/test/integration/pullMerge/expected_remote/objects/7f/157a65ec0c8d6cffce08d6768e6733939e75a1 b/test/integration/pullMerge/expected_remote/objects/7f/157a65ec0c8d6cffce08d6768e6733939e75a1 new file mode 100644 index 000000000..1af721127 Binary files /dev/null and b/test/integration/pullMerge/expected_remote/objects/7f/157a65ec0c8d6cffce08d6768e6733939e75a1 differ diff --git a/test/integration/pullMerge/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pullMerge/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pullMerge/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pullMerge/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pullMerge/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pullMerge/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pullMerge/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/pullMerge/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/pullMerge/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/pullMerge/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pullMerge/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pullMerge/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pullMerge/expected_remote/packed-refs b/test/integration/pullMerge/expected_remote/packed-refs new file mode 100644 index 000000000..0ec136723 --- /dev/null +++ b/test/integration/pullMerge/expected_remote/packed-refs @@ -0,0 +1,2 @@ +# pack-refs with: peeled fully-peeled sorted +7f157a65ec0c8d6cffce08d6768e6733939e75a1 refs/heads/master diff --git a/test/integration/pullMerge/recording.json b/test/integration/pullMerge/recording.json new file mode 100644 index 000000000..9b948e3eb --- /dev/null +++ b/test/integration/pullMerge/recording.json @@ -0,0 +1 @@ +{"KeyEvents":[{"Timestamp":537,"Mod":0,"Key":256,"Ch":112},{"Timestamp":1401,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/pullMerge/setup.sh b/test/integration/pullMerge/setup.sh new file mode 100644 index 000000000..b9d9a933a --- /dev/null +++ b/test/integration/pullMerge/setup.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +set -e + +cd $1 + +git init + +git config user.email "CI@example.com" +git config user.name "CI" + +echo test1 > myfile1 +git add . +git commit -am "myfile1" +echo test2 > myfile2 +git add . +git commit -am "myfile2" +echo test3 > myfile3 +git add . +git commit -am "myfile3" +echo test4 > myfile4 +git add . +git commit -am "myfile4" + +cd .. +git clone --bare ./actual actual_remote + +cd actual + +git reset --hard HEAD~2 + +echo test4 > myfile4 +git add . +git commit -am "myfile4" + +git remote add origin ../actual_remote +git fetch origin +git branch --set-upstream-to=origin/master master + +git config pull.rebase false diff --git a/test/integration/pullMerge/test.json b/test/integration/pullMerge/test.json new file mode 100644 index 000000000..8ce8c71bb --- /dev/null +++ b/test/integration/pullMerge/test.json @@ -0,0 +1 @@ +{ "description": "When user has configured pull with merge, ensure a merge commit is created upon pull", "speed": 10 } diff --git a/test/integration/pullMergeConflict/expected/.git_keep/COMMIT_EDITMSG b/test/integration/pullMergeConflict/expected/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..ce92bd599 --- /dev/null +++ b/test/integration/pullMergeConflict/expected/.git_keep/COMMIT_EDITMSG @@ -0,0 +1,25 @@ +Merge branch 'master' of ../actual_remote + +# Conflicts: +# myfile4 +# +# It looks like you may be committing a merge. +# If this is not correct, please remove the file +# /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/pullMergeConflict/actual/.git/MERGE_HEAD +# and try again. + + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# +# On branch master +# Your branch and 'origin/master' have diverged, +# and have 1 and 2 different commits each, respectively. +# (use "git pull" to merge the remote branch into yours) +# +# All conflicts fixed but you are still merging. +# +# Changes to be committed: +# new file: myfile3 +# modified: myfile4 +# diff --git a/test/integration/pullMergeConflict/expected/.git_keep/FETCH_HEAD b/test/integration/pullMergeConflict/expected/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..bd1ba7678 --- /dev/null +++ b/test/integration/pullMergeConflict/expected/.git_keep/FETCH_HEAD @@ -0,0 +1 @@ +38699899bb94dfae74e3e55cf5bd6d92e6f3292a branch 'master' of ../actual_remote diff --git a/test/integration/pullMergeConflict/expected/.git_keep/HEAD b/test/integration/pullMergeConflict/expected/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pullMergeConflict/expected/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pullMergeConflict/expected/.git_keep/ORIG_HEAD b/test/integration/pullMergeConflict/expected/.git_keep/ORIG_HEAD new file mode 100644 index 000000000..703055cf2 --- /dev/null +++ b/test/integration/pullMergeConflict/expected/.git_keep/ORIG_HEAD @@ -0,0 +1 @@ +7dba68a0030313e27b8dd5da2076952629485f2d diff --git a/test/integration/pullMergeConflict/expected/.git_keep/config b/test/integration/pullMergeConflict/expected/.git_keep/config new file mode 100644 index 000000000..110d1b43e --- /dev/null +++ b/test/integration/pullMergeConflict/expected/.git_keep/config @@ -0,0 +1,18 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[remote "origin"] + url = ../actual_remote + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master +[pull] + rebase = false diff --git a/test/integration/pullMergeConflict/expected/.git_keep/description b/test/integration/pullMergeConflict/expected/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pullMergeConflict/expected/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pullMergeConflict/expected/.git_keep/index b/test/integration/pullMergeConflict/expected/.git_keep/index new file mode 100644 index 000000000..d9ffd9453 Binary files /dev/null and b/test/integration/pullMergeConflict/expected/.git_keep/index differ diff --git a/test/integration/pullMergeConflict/expected/.git_keep/info/exclude b/test/integration/pullMergeConflict/expected/.git_keep/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pullMergeConflict/expected/.git_keep/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pullMergeConflict/expected/.git_keep/logs/HEAD b/test/integration/pullMergeConflict/expected/.git_keep/logs/HEAD new file mode 100644 index 000000000..566b28a05 --- /dev/null +++ b/test/integration/pullMergeConflict/expected/.git_keep/logs/HEAD @@ -0,0 +1,7 @@ +0000000000000000000000000000000000000000 f0e8e7922de77a5ab20b924640c8b8435bae0b0b CI 1634896911 +1100 commit (initial): myfile1 +f0e8e7922de77a5ab20b924640c8b8435bae0b0b ddf4b7fe8f45d07a181c2b57cc3434c982d3f4aa CI 1634896911 +1100 commit: myfile2 +ddf4b7fe8f45d07a181c2b57cc3434c982d3f4aa 80f8aed01cdb61f9e94c6a53c39f400dfbcf05c9 CI 1634896911 +1100 commit: myfile3 +80f8aed01cdb61f9e94c6a53c39f400dfbcf05c9 38699899bb94dfae74e3e55cf5bd6d92e6f3292a CI 1634896911 +1100 commit: myfile4 +38699899bb94dfae74e3e55cf5bd6d92e6f3292a ddf4b7fe8f45d07a181c2b57cc3434c982d3f4aa CI 1634896911 +1100 reset: moving to head^^ +ddf4b7fe8f45d07a181c2b57cc3434c982d3f4aa 7dba68a0030313e27b8dd5da2076952629485f2d CI 1634896911 +1100 commit: myfile4 conflict +7dba68a0030313e27b8dd5da2076952629485f2d 720c7e2dd34822d33cb24a0a3f0f4bdabf433500 CI 1634896916 +1100 commit (merge): Merge branch 'master' of ../actual_remote diff --git a/test/integration/pullMergeConflict/expected/.git_keep/logs/refs/heads/master b/test/integration/pullMergeConflict/expected/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..566b28a05 --- /dev/null +++ b/test/integration/pullMergeConflict/expected/.git_keep/logs/refs/heads/master @@ -0,0 +1,7 @@ +0000000000000000000000000000000000000000 f0e8e7922de77a5ab20b924640c8b8435bae0b0b CI 1634896911 +1100 commit (initial): myfile1 +f0e8e7922de77a5ab20b924640c8b8435bae0b0b ddf4b7fe8f45d07a181c2b57cc3434c982d3f4aa CI 1634896911 +1100 commit: myfile2 +ddf4b7fe8f45d07a181c2b57cc3434c982d3f4aa 80f8aed01cdb61f9e94c6a53c39f400dfbcf05c9 CI 1634896911 +1100 commit: myfile3 +80f8aed01cdb61f9e94c6a53c39f400dfbcf05c9 38699899bb94dfae74e3e55cf5bd6d92e6f3292a CI 1634896911 +1100 commit: myfile4 +38699899bb94dfae74e3e55cf5bd6d92e6f3292a ddf4b7fe8f45d07a181c2b57cc3434c982d3f4aa CI 1634896911 +1100 reset: moving to head^^ +ddf4b7fe8f45d07a181c2b57cc3434c982d3f4aa 7dba68a0030313e27b8dd5da2076952629485f2d CI 1634896911 +1100 commit: myfile4 conflict +7dba68a0030313e27b8dd5da2076952629485f2d 720c7e2dd34822d33cb24a0a3f0f4bdabf433500 CI 1634896916 +1100 commit (merge): Merge branch 'master' of ../actual_remote diff --git a/test/integration/pullMergeConflict/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/pullMergeConflict/expected/.git_keep/logs/refs/remotes/origin/master new file mode 100644 index 000000000..4473fe625 --- /dev/null +++ b/test/integration/pullMergeConflict/expected/.git_keep/logs/refs/remotes/origin/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 38699899bb94dfae74e3e55cf5bd6d92e6f3292a CI 1634896911 +1100 fetch origin: storing head diff --git a/test/integration/pullMergeConflict/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pullMergeConflict/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pullMergeConflict/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pullMergeConflict/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pullMergeConflict/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pullMergeConflict/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pullMergeConflict/expected/.git_keep/objects/1f/e5d8152187295b171f171c0d55d809500ae80f b/test/integration/pullMergeConflict/expected/.git_keep/objects/1f/e5d8152187295b171f171c0d55d809500ae80f new file mode 100644 index 000000000..5fcd3c3ea Binary files /dev/null and b/test/integration/pullMergeConflict/expected/.git_keep/objects/1f/e5d8152187295b171f171c0d55d809500ae80f differ diff --git a/test/integration/pullMergeConflict/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pullMergeConflict/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pullMergeConflict/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pullMergeConflict/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pullMergeConflict/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pullMergeConflict/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pullMergeConflict/expected/.git_keep/objects/38/699899bb94dfae74e3e55cf5bd6d92e6f3292a b/test/integration/pullMergeConflict/expected/.git_keep/objects/38/699899bb94dfae74e3e55cf5bd6d92e6f3292a new file mode 100644 index 000000000..c7b25d78c --- /dev/null +++ b/test/integration/pullMergeConflict/expected/.git_keep/objects/38/699899bb94dfae74e3e55cf5bd6d92e6f3292a @@ -0,0 +1,3 @@ +xA +0@Q9E4i"BW=F:D#ŗ֥ytj'PH4!sL%D֞; +QJ趲΀2O5pAB6m(ٕw{Fƻ~Jݞz myfile1 +git add . +git commit -am "myfile1" +echo test2 > myfile2 +git add . +git commit -am "myfile2" +echo test3 > myfile3 +git add . +git commit -am "myfile3" +echo test4 > myfile4 +git add . +git commit -am "myfile4" + +cd .. +git clone --bare ./actual actual_remote + +cd actual + +git reset --hard HEAD~2 + +echo conflict > myfile4 +git add . +git commit -am "myfile4 conflict" + +git remote add origin ../actual_remote +git fetch origin +git branch --set-upstream-to=origin/master master + +git config pull.rebase false diff --git a/test/integration/pullMergeConflict/test.json b/test/integration/pullMergeConflict/test.json new file mode 100644 index 000000000..c1d7a3480 --- /dev/null +++ b/test/integration/pullMergeConflict/test.json @@ -0,0 +1 @@ +{ "description": "When user has configured pull with merge, ensure we handle conflicts", "speed": 5 } diff --git a/test/integration/pullRebase/expected/.git_keep/COMMIT_EDITMSG b/test/integration/pullRebase/expected/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..ecdf2bdc8 --- /dev/null +++ b/test/integration/pullRebase/expected/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +myfile5 diff --git a/test/integration/pullRebase/expected/.git_keep/FETCH_HEAD b/test/integration/pullRebase/expected/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..a05fa9894 --- /dev/null +++ b/test/integration/pullRebase/expected/.git_keep/FETCH_HEAD @@ -0,0 +1 @@ +d0e04b2bced3bc76f0abf50698a7ab774cd54568 branch 'master' of ../actual_remote diff --git a/test/integration/pullRebase/expected/.git_keep/HEAD b/test/integration/pullRebase/expected/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pullRebase/expected/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pullRebase/expected/.git_keep/ORIG_HEAD b/test/integration/pullRebase/expected/.git_keep/ORIG_HEAD new file mode 100644 index 000000000..66241013d --- /dev/null +++ b/test/integration/pullRebase/expected/.git_keep/ORIG_HEAD @@ -0,0 +1 @@ +7b21277988b03a5fd9e933126e8d1f31d2498d08 diff --git a/test/integration/pullRebase/expected/.git_keep/config b/test/integration/pullRebase/expected/.git_keep/config new file mode 100644 index 000000000..1a54274ac --- /dev/null +++ b/test/integration/pullRebase/expected/.git_keep/config @@ -0,0 +1,18 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[remote "origin"] + url = ../actual_remote + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master +[pull] + rebase = true diff --git a/test/integration/pullRebase/expected/.git_keep/description b/test/integration/pullRebase/expected/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pullRebase/expected/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pullRebase/expected/.git_keep/index b/test/integration/pullRebase/expected/.git_keep/index new file mode 100644 index 000000000..3e4466b50 Binary files /dev/null and b/test/integration/pullRebase/expected/.git_keep/index differ diff --git a/test/integration/pullRebase/expected/.git_keep/info/exclude b/test/integration/pullRebase/expected/.git_keep/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pullRebase/expected/.git_keep/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pullRebase/expected/.git_keep/logs/HEAD b/test/integration/pullRebase/expected/.git_keep/logs/HEAD new file mode 100644 index 000000000..f5bdda011 --- /dev/null +++ b/test/integration/pullRebase/expected/.git_keep/logs/HEAD @@ -0,0 +1,9 @@ +0000000000000000000000000000000000000000 c0ae07711df69fb0a21efaca9d63da42a67eaedf CI 1634896919 +1100 commit (initial): myfile1 +c0ae07711df69fb0a21efaca9d63da42a67eaedf 0bbb382cb5729bfd2e6fd3e1d60237e03cb375a4 CI 1634896919 +1100 commit: myfile2 +0bbb382cb5729bfd2e6fd3e1d60237e03cb375a4 fe1d53ca86366f64f689586cb0fe243fed1d1482 CI 1634896919 +1100 commit: myfile3 +fe1d53ca86366f64f689586cb0fe243fed1d1482 d0e04b2bced3bc76f0abf50698a7ab774cd54568 CI 1634896919 +1100 commit: myfile4 +d0e04b2bced3bc76f0abf50698a7ab774cd54568 0bbb382cb5729bfd2e6fd3e1d60237e03cb375a4 CI 1634896919 +1100 reset: moving to head^^ +0bbb382cb5729bfd2e6fd3e1d60237e03cb375a4 7b21277988b03a5fd9e933126e8d1f31d2498d08 CI 1634896919 +1100 commit: myfile5 +7b21277988b03a5fd9e933126e8d1f31d2498d08 d0e04b2bced3bc76f0abf50698a7ab774cd54568 CI 1634896920 +1100 pull --no-edit: checkout d0e04b2bced3bc76f0abf50698a7ab774cd54568 +d0e04b2bced3bc76f0abf50698a7ab774cd54568 74755f34462bd712c676b84247831233da97a272 CI 1634896920 +1100 pull --no-edit: myfile5 +74755f34462bd712c676b84247831233da97a272 74755f34462bd712c676b84247831233da97a272 CI 1634896920 +1100 rebase finished: returning to refs/heads/master diff --git a/test/integration/pullRebase/expected/.git_keep/logs/refs/heads/master b/test/integration/pullRebase/expected/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..564aa150d --- /dev/null +++ b/test/integration/pullRebase/expected/.git_keep/logs/refs/heads/master @@ -0,0 +1,7 @@ +0000000000000000000000000000000000000000 c0ae07711df69fb0a21efaca9d63da42a67eaedf CI 1634896919 +1100 commit (initial): myfile1 +c0ae07711df69fb0a21efaca9d63da42a67eaedf 0bbb382cb5729bfd2e6fd3e1d60237e03cb375a4 CI 1634896919 +1100 commit: myfile2 +0bbb382cb5729bfd2e6fd3e1d60237e03cb375a4 fe1d53ca86366f64f689586cb0fe243fed1d1482 CI 1634896919 +1100 commit: myfile3 +fe1d53ca86366f64f689586cb0fe243fed1d1482 d0e04b2bced3bc76f0abf50698a7ab774cd54568 CI 1634896919 +1100 commit: myfile4 +d0e04b2bced3bc76f0abf50698a7ab774cd54568 0bbb382cb5729bfd2e6fd3e1d60237e03cb375a4 CI 1634896919 +1100 reset: moving to head^^ +0bbb382cb5729bfd2e6fd3e1d60237e03cb375a4 7b21277988b03a5fd9e933126e8d1f31d2498d08 CI 1634896919 +1100 commit: myfile5 +7b21277988b03a5fd9e933126e8d1f31d2498d08 74755f34462bd712c676b84247831233da97a272 CI 1634896920 +1100 rebase finished: returning to refs/heads/master diff --git a/test/integration/pullRebase/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/pullRebase/expected/.git_keep/logs/refs/remotes/origin/master new file mode 100644 index 000000000..f04c3d5eb --- /dev/null +++ b/test/integration/pullRebase/expected/.git_keep/logs/refs/remotes/origin/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 d0e04b2bced3bc76f0abf50698a7ab774cd54568 CI 1634896919 +1100 fetch origin: storing head diff --git a/test/integration/pullRebase/expected/.git_keep/objects/0b/bb382cb5729bfd2e6fd3e1d60237e03cb375a4 b/test/integration/pullRebase/expected/.git_keep/objects/0b/bb382cb5729bfd2e6fd3e1d60237e03cb375a4 new file mode 100644 index 000000000..53166135d Binary files /dev/null and b/test/integration/pullRebase/expected/.git_keep/objects/0b/bb382cb5729bfd2e6fd3e1d60237e03cb375a4 differ diff --git a/test/integration/pullRebase/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pullRebase/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pullRebase/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pullRebase/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pullRebase/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pullRebase/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pullRebase/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pullRebase/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pullRebase/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pullRebase/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pullRebase/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pullRebase/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pullRebase/expected/.git_keep/objects/74/755f34462bd712c676b84247831233da97a272 b/test/integration/pullRebase/expected/.git_keep/objects/74/755f34462bd712c676b84247831233da97a272 new file mode 100644 index 000000000..6cf095267 Binary files /dev/null and b/test/integration/pullRebase/expected/.git_keep/objects/74/755f34462bd712c676b84247831233da97a272 differ diff --git a/test/integration/pullRebase/expected/.git_keep/objects/7b/21277988b03a5fd9e933126e8d1f31d2498d08 b/test/integration/pullRebase/expected/.git_keep/objects/7b/21277988b03a5fd9e933126e8d1f31d2498d08 new file mode 100644 index 000000000..7557f1bec --- /dev/null +++ b/test/integration/pullRebase/expected/.git_keep/objects/7b/21277988b03a5fd9e933126e8d1f31d2498d08 @@ -0,0 +1,2 @@ +xK +0@] 2ɧ"BW=F&`D#}</o-]c~h)E8Tm!@EC^]3`2`"bBŃ @)dUzvi4?ھ-oѓ:9O]o]VqB: \ No newline at end of file diff --git a/test/integration/pullRebase/expected/.git_keep/objects/92/c2dd111eeb7daf4a0e30faff73b9441103805d b/test/integration/pullRebase/expected/.git_keep/objects/92/c2dd111eeb7daf4a0e30faff73b9441103805d new file mode 100644 index 000000000..7820c1e95 Binary files /dev/null and b/test/integration/pullRebase/expected/.git_keep/objects/92/c2dd111eeb7daf4a0e30faff73b9441103805d differ diff --git a/test/integration/pullRebase/expected/.git_keep/objects/98/fea3de076a474cabfac7130669625879051d43 b/test/integration/pullRebase/expected/.git_keep/objects/98/fea3de076a474cabfac7130669625879051d43 new file mode 100644 index 000000000..6b5097ac8 Binary files /dev/null and b/test/integration/pullRebase/expected/.git_keep/objects/98/fea3de076a474cabfac7130669625879051d43 differ diff --git a/test/integration/pullRebase/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pullRebase/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pullRebase/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pullRebase/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pullRebase/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pullRebase/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pullRebase/expected/.git_keep/objects/c0/ae07711df69fb0a21efaca9d63da42a67eaedf b/test/integration/pullRebase/expected/.git_keep/objects/c0/ae07711df69fb0a21efaca9d63da42a67eaedf new file mode 100644 index 000000000..bf8cba378 --- /dev/null +++ b/test/integration/pullRebase/expected/.git_keep/objects/c0/ae07711df69fb0a21efaca9d63da42a67eaedf @@ -0,0 +1,2 @@ +xA +0@ѮsJFc<ƘL")#tyS5[ S5d"9`'XZLEҽsi4cG7jO@)D;9i'w+6, \ No newline at end of file diff --git a/test/integration/pullRebase/expected/.git_keep/objects/d0/e04b2bced3bc76f0abf50698a7ab774cd54568 b/test/integration/pullRebase/expected/.git_keep/objects/d0/e04b2bced3bc76f0abf50698a7ab774cd54568 new file mode 100644 index 000000000..607a6325f --- /dev/null +++ b/test/integration/pullRebase/expected/.git_keep/objects/d0/e04b2bced3bc76f0abf50698a7ab774cd54568 @@ -0,0 +1,3 @@ +xA +0@Q9Ed:Dz4D#/kKvUCO!@(4s0-j% #1Ke +6aw{Fƻ~rݞz)ky`$I 3@T?_[J8 \ No newline at end of file diff --git a/test/integration/pullRebase/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/pullRebase/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/pullRebase/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/pullRebase/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pullRebase/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pullRebase/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pullRebase/expected/.git_keep/objects/fe/1d53ca86366f64f689586cb0fe243fed1d1482 b/test/integration/pullRebase/expected/.git_keep/objects/fe/1d53ca86366f64f689586cb0fe243fed1d1482 new file mode 100644 index 000000000..d16cbc927 Binary files /dev/null and b/test/integration/pullRebase/expected/.git_keep/objects/fe/1d53ca86366f64f689586cb0fe243fed1d1482 differ diff --git a/test/integration/pullRebase/expected/.git_keep/refs/heads/master b/test/integration/pullRebase/expected/.git_keep/refs/heads/master new file mode 100644 index 000000000..dcff007ea --- /dev/null +++ b/test/integration/pullRebase/expected/.git_keep/refs/heads/master @@ -0,0 +1 @@ +74755f34462bd712c676b84247831233da97a272 diff --git a/test/integration/pullRebase/expected/.git_keep/refs/remotes/origin/master b/test/integration/pullRebase/expected/.git_keep/refs/remotes/origin/master new file mode 100644 index 000000000..5a2173631 --- /dev/null +++ b/test/integration/pullRebase/expected/.git_keep/refs/remotes/origin/master @@ -0,0 +1 @@ +d0e04b2bced3bc76f0abf50698a7ab774cd54568 diff --git a/test/integration/pullRebase/expected/myfile1 b/test/integration/pullRebase/expected/myfile1 new file mode 100644 index 000000000..a5bce3fd2 --- /dev/null +++ b/test/integration/pullRebase/expected/myfile1 @@ -0,0 +1 @@ +test1 diff --git a/test/integration/pullRebase/expected/myfile2 b/test/integration/pullRebase/expected/myfile2 new file mode 100644 index 000000000..180cf8328 --- /dev/null +++ b/test/integration/pullRebase/expected/myfile2 @@ -0,0 +1 @@ +test2 diff --git a/test/integration/pullRebase/expected/myfile3 b/test/integration/pullRebase/expected/myfile3 new file mode 100644 index 000000000..df6b0d2bc --- /dev/null +++ b/test/integration/pullRebase/expected/myfile3 @@ -0,0 +1 @@ +test3 diff --git a/test/integration/pullRebase/expected/myfile4 b/test/integration/pullRebase/expected/myfile4 new file mode 100644 index 000000000..d234c5e05 --- /dev/null +++ b/test/integration/pullRebase/expected/myfile4 @@ -0,0 +1 @@ +test4 diff --git a/test/integration/pullRebase/expected/myfile5 b/test/integration/pullRebase/expected/myfile5 new file mode 100644 index 000000000..d234c5e05 --- /dev/null +++ b/test/integration/pullRebase/expected/myfile5 @@ -0,0 +1 @@ +test4 diff --git a/test/integration/pullRebase/expected_remote/HEAD b/test/integration/pullRebase/expected_remote/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pullRebase/expected_remote/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pullRebase/expected_remote/config b/test/integration/pullRebase/expected_remote/config new file mode 100644 index 000000000..201a8b505 --- /dev/null +++ b/test/integration/pullRebase/expected_remote/config @@ -0,0 +1,8 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true + ignorecase = true + precomposeunicode = true +[remote "origin"] + url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/pullRebase/./actual diff --git a/test/integration/pullRebase/expected_remote/description b/test/integration/pullRebase/expected_remote/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pullRebase/expected_remote/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pullRebase/expected_remote/info/exclude b/test/integration/pullRebase/expected_remote/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pullRebase/expected_remote/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pullRebase/expected_remote/objects/0b/bb382cb5729bfd2e6fd3e1d60237e03cb375a4 b/test/integration/pullRebase/expected_remote/objects/0b/bb382cb5729bfd2e6fd3e1d60237e03cb375a4 new file mode 100644 index 000000000..53166135d Binary files /dev/null and b/test/integration/pullRebase/expected_remote/objects/0b/bb382cb5729bfd2e6fd3e1d60237e03cb375a4 differ diff --git a/test/integration/pullRebase/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pullRebase/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pullRebase/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pullRebase/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pullRebase/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pullRebase/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pullRebase/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pullRebase/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pullRebase/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pullRebase/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pullRebase/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pullRebase/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pullRebase/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pullRebase/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pullRebase/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pullRebase/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pullRebase/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pullRebase/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pullRebase/expected_remote/objects/c0/ae07711df69fb0a21efaca9d63da42a67eaedf b/test/integration/pullRebase/expected_remote/objects/c0/ae07711df69fb0a21efaca9d63da42a67eaedf new file mode 100644 index 000000000..bf8cba378 --- /dev/null +++ b/test/integration/pullRebase/expected_remote/objects/c0/ae07711df69fb0a21efaca9d63da42a67eaedf @@ -0,0 +1,2 @@ +xA +0@ѮsJFc<ƘL")#tyS5[ S5d"9`'XZLEҽsi4cG7jO@)D;9i'w+6, \ No newline at end of file diff --git a/test/integration/pullRebase/expected_remote/objects/d0/e04b2bced3bc76f0abf50698a7ab774cd54568 b/test/integration/pullRebase/expected_remote/objects/d0/e04b2bced3bc76f0abf50698a7ab774cd54568 new file mode 100644 index 000000000..607a6325f --- /dev/null +++ b/test/integration/pullRebase/expected_remote/objects/d0/e04b2bced3bc76f0abf50698a7ab774cd54568 @@ -0,0 +1,3 @@ +xA +0@Q9Ed:Dz4D#/kKvUCO!@(4s0-j% #1Ke +6aw{Fƻ~rݞz)ky`$I 3@T?_[J8 \ No newline at end of file diff --git a/test/integration/pullRebase/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/pullRebase/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/pullRebase/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/pullRebase/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pullRebase/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pullRebase/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pullRebase/expected_remote/objects/fe/1d53ca86366f64f689586cb0fe243fed1d1482 b/test/integration/pullRebase/expected_remote/objects/fe/1d53ca86366f64f689586cb0fe243fed1d1482 new file mode 100644 index 000000000..d16cbc927 Binary files /dev/null and b/test/integration/pullRebase/expected_remote/objects/fe/1d53ca86366f64f689586cb0fe243fed1d1482 differ diff --git a/test/integration/pullRebase/expected_remote/packed-refs b/test/integration/pullRebase/expected_remote/packed-refs new file mode 100644 index 000000000..88b741528 --- /dev/null +++ b/test/integration/pullRebase/expected_remote/packed-refs @@ -0,0 +1,2 @@ +# pack-refs with: peeled fully-peeled sorted +d0e04b2bced3bc76f0abf50698a7ab774cd54568 refs/heads/master diff --git a/test/integration/pullRebase/recording.json b/test/integration/pullRebase/recording.json new file mode 100644 index 000000000..b23747e49 --- /dev/null +++ b/test/integration/pullRebase/recording.json @@ -0,0 +1 @@ +{"KeyEvents":[{"Timestamp":581,"Mod":0,"Key":256,"Ch":112},{"Timestamp":1804,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/pullRebase/setup.sh b/test/integration/pullRebase/setup.sh new file mode 100644 index 000000000..aef24c8e8 --- /dev/null +++ b/test/integration/pullRebase/setup.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +set -e + +cd $1 + +git init + +git config user.email "CI@example.com" +git config user.name "CI" + +echo test1 > myfile1 +git add . +git commit -am "myfile1" +echo test2 > myfile2 +git add . +git commit -am "myfile2" +echo test3 > myfile3 +git add . +git commit -am "myfile3" +echo test4 > myfile4 +git add . +git commit -am "myfile4" + +cd .. +git clone --bare ./actual actual_remote + +cd actual + +git reset --hard HEAD~2 + +echo test4 > myfile5 +git add . +git commit -am "myfile5" + +git remote add origin ../actual_remote +git fetch origin +git branch --set-upstream-to=origin/master master + +git config pull.rebase true diff --git a/test/integration/pullRebase/test.json b/test/integration/pullRebase/test.json new file mode 100644 index 000000000..224a93e54 --- /dev/null +++ b/test/integration/pullRebase/test.json @@ -0,0 +1 @@ +{ "description": "When user has configured pull with rebase, ensure we rebase upon pull", "speed": 10 } diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/COMMIT_EDITMSG b/test/integration/pullRebaseConflict/expected/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..2f4ead100 --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +myfile4 conflict diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/FETCH_HEAD b/test/integration/pullRebaseConflict/expected/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..8f2963fe4 --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/.git_keep/FETCH_HEAD @@ -0,0 +1 @@ +103c3eb899d173b83fc1b40261c8880fef359cc3 branch 'master' of ../actual_remote diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/HEAD b/test/integration/pullRebaseConflict/expected/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/ORIG_HEAD b/test/integration/pullRebaseConflict/expected/.git_keep/ORIG_HEAD new file mode 100644 index 000000000..4133994ce --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/.git_keep/ORIG_HEAD @@ -0,0 +1 @@ +116cef0e366265c3d002cdb3dce4e285e32b5d12 diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/config b/test/integration/pullRebaseConflict/expected/.git_keep/config new file mode 100644 index 000000000..1a54274ac --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/.git_keep/config @@ -0,0 +1,18 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[remote "origin"] + url = ../actual_remote + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master +[pull] + rebase = true diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/description b/test/integration/pullRebaseConflict/expected/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/index b/test/integration/pullRebaseConflict/expected/.git_keep/index new file mode 100644 index 000000000..286197c14 Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/index differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/info/exclude b/test/integration/pullRebaseConflict/expected/.git_keep/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/.git_keep/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/logs/HEAD b/test/integration/pullRebaseConflict/expected/.git_keep/logs/HEAD new file mode 100644 index 000000000..707a3154c --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/.git_keep/logs/HEAD @@ -0,0 +1,9 @@ +0000000000000000000000000000000000000000 34574474ac6f7dd2d3142bc28ee39db88d8a16af CI 1634896923 +1100 commit (initial): myfile1 +34574474ac6f7dd2d3142bc28ee39db88d8a16af 3b9389ff50095ad2d66d33bb6d67b5700f0bf6da CI 1634896923 +1100 commit: myfile2 +3b9389ff50095ad2d66d33bb6d67b5700f0bf6da aa6ae0785290ee09875f6bd5a5d50c0e7002de13 CI 1634896923 +1100 commit: myfile3 +aa6ae0785290ee09875f6bd5a5d50c0e7002de13 103c3eb899d173b83fc1b40261c8880fef359cc3 CI 1634896923 +1100 commit: myfile4 +103c3eb899d173b83fc1b40261c8880fef359cc3 3b9389ff50095ad2d66d33bb6d67b5700f0bf6da CI 1634896923 +1100 reset: moving to head^^ +3b9389ff50095ad2d66d33bb6d67b5700f0bf6da 116cef0e366265c3d002cdb3dce4e285e32b5d12 CI 1634896923 +1100 commit: myfile4 conflict +116cef0e366265c3d002cdb3dce4e285e32b5d12 103c3eb899d173b83fc1b40261c8880fef359cc3 CI 1634896924 +1100 pull --no-edit: checkout 103c3eb899d173b83fc1b40261c8880fef359cc3 +103c3eb899d173b83fc1b40261c8880fef359cc3 db7122c7f62714dfa854d8d22b2081d308912af8 CI 1634896926 +1100 rebase: myfile4 conflict +db7122c7f62714dfa854d8d22b2081d308912af8 db7122c7f62714dfa854d8d22b2081d308912af8 CI 1634896926 +1100 rebase finished: returning to refs/heads/master diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/logs/refs/heads/master b/test/integration/pullRebaseConflict/expected/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..eceafe30b --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/.git_keep/logs/refs/heads/master @@ -0,0 +1,7 @@ +0000000000000000000000000000000000000000 34574474ac6f7dd2d3142bc28ee39db88d8a16af CI 1634896923 +1100 commit (initial): myfile1 +34574474ac6f7dd2d3142bc28ee39db88d8a16af 3b9389ff50095ad2d66d33bb6d67b5700f0bf6da CI 1634896923 +1100 commit: myfile2 +3b9389ff50095ad2d66d33bb6d67b5700f0bf6da aa6ae0785290ee09875f6bd5a5d50c0e7002de13 CI 1634896923 +1100 commit: myfile3 +aa6ae0785290ee09875f6bd5a5d50c0e7002de13 103c3eb899d173b83fc1b40261c8880fef359cc3 CI 1634896923 +1100 commit: myfile4 +103c3eb899d173b83fc1b40261c8880fef359cc3 3b9389ff50095ad2d66d33bb6d67b5700f0bf6da CI 1634896923 +1100 reset: moving to head^^ +3b9389ff50095ad2d66d33bb6d67b5700f0bf6da 116cef0e366265c3d002cdb3dce4e285e32b5d12 CI 1634896923 +1100 commit: myfile4 conflict +116cef0e366265c3d002cdb3dce4e285e32b5d12 db7122c7f62714dfa854d8d22b2081d308912af8 CI 1634896926 +1100 rebase finished: returning to refs/heads/master diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/pullRebaseConflict/expected/.git_keep/logs/refs/remotes/origin/master new file mode 100644 index 000000000..f05f22244 --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/.git_keep/logs/refs/remotes/origin/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 103c3eb899d173b83fc1b40261c8880fef359cc3 CI 1634896923 +1100 fetch origin: storing head diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pullRebaseConflict/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/10/3c3eb899d173b83fc1b40261c8880fef359cc3 b/test/integration/pullRebaseConflict/expected/.git_keep/objects/10/3c3eb899d173b83fc1b40261c8880fef359cc3 new file mode 100644 index 000000000..54f9946f5 Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/10/3c3eb899d173b83fc1b40261c8880fef359cc3 differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/11/6cef0e366265c3d002cdb3dce4e285e32b5d12 b/test/integration/pullRebaseConflict/expected/.git_keep/objects/11/6cef0e366265c3d002cdb3dce4e285e32b5d12 new file mode 100644 index 000000000..01f6c3182 Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/11/6cef0e366265c3d002cdb3dce4e285e32b5d12 differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pullRebaseConflict/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pullRebaseConflict/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pullRebaseConflict/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/34/574474ac6f7dd2d3142bc28ee39db88d8a16af b/test/integration/pullRebaseConflict/expected/.git_keep/objects/34/574474ac6f7dd2d3142bc28ee39db88d8a16af new file mode 100644 index 000000000..229191e1c --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/.git_keep/objects/34/574474ac6f7dd2d3142bc28ee39db88d8a16af @@ -0,0 +1,2 @@ +xA + @Ѯ= DBV9ё2X<.7¹%"%KXݙ8c^'rM)DZssOn*h~5B, \ No newline at end of file diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/3b/9389ff50095ad2d66d33bb6d67b5700f0bf6da b/test/integration/pullRebaseConflict/expected/.git_keep/objects/3b/9389ff50095ad2d66d33bb6d67b5700f0bf6da new file mode 100644 index 000000000..fd885765d Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/3b/9389ff50095ad2d66d33bb6d67b5700f0bf6da differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/test/integration/pullRebaseConflict/expected/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 new file mode 100644 index 000000000..adf64119a Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/9b/1719f5cf069568785080a0bbabbe7c377e22ae b/test/integration/pullRebaseConflict/expected/.git_keep/objects/9b/1719f5cf069568785080a0bbabbe7c377e22ae new file mode 100644 index 000000000..13e3f581a Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/9b/1719f5cf069568785080a0bbabbe7c377e22ae differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pullRebaseConflict/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pullRebaseConflict/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/aa/6ae0785290ee09875f6bd5a5d50c0e7002de13 b/test/integration/pullRebaseConflict/expected/.git_keep/objects/aa/6ae0785290ee09875f6bd5a5d50c0e7002de13 new file mode 100644 index 000000000..94a6241c8 Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/aa/6ae0785290ee09875f6bd5a5d50c0e7002de13 differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/ae/d6c0a012c68a8b615ab0185b64f59c414d4746 b/test/integration/pullRebaseConflict/expected/.git_keep/objects/ae/d6c0a012c68a8b615ab0185b64f59c414d4746 new file mode 100644 index 000000000..5a90eb5f9 Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/ae/d6c0a012c68a8b615ab0185b64f59c414d4746 differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/b2/da3d615a1805f094849247add77d09aee06451 b/test/integration/pullRebaseConflict/expected/.git_keep/objects/b2/da3d615a1805f094849247add77d09aee06451 new file mode 100644 index 000000000..ae05cad1e Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/b2/da3d615a1805f094849247add77d09aee06451 differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/pullRebaseConflict/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/db/7122c7f62714dfa854d8d22b2081d308912af8 b/test/integration/pullRebaseConflict/expected/.git_keep/objects/db/7122c7f62714dfa854d8d22b2081d308912af8 new file mode 100644 index 000000000..e8035ad35 Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/db/7122c7f62714dfa854d8d22b2081d308912af8 differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pullRebaseConflict/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/e6/1e2c991de853082420fd27fd983098afd4c0c8 b/test/integration/pullRebaseConflict/expected/.git_keep/objects/e6/1e2c991de853082420fd27fd983098afd4c0c8 new file mode 100644 index 000000000..46f078cee Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/e6/1e2c991de853082420fd27fd983098afd4c0c8 differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/objects/e6/9912eb1649ce8dbb33678796cec3e89da3675d b/test/integration/pullRebaseConflict/expected/.git_keep/objects/e6/9912eb1649ce8dbb33678796cec3e89da3675d new file mode 100644 index 000000000..9fa52a8fd Binary files /dev/null and b/test/integration/pullRebaseConflict/expected/.git_keep/objects/e6/9912eb1649ce8dbb33678796cec3e89da3675d differ diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/refs/heads/master b/test/integration/pullRebaseConflict/expected/.git_keep/refs/heads/master new file mode 100644 index 000000000..ef35219b9 --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/.git_keep/refs/heads/master @@ -0,0 +1 @@ +db7122c7f62714dfa854d8d22b2081d308912af8 diff --git a/test/integration/pullRebaseConflict/expected/.git_keep/refs/remotes/origin/master b/test/integration/pullRebaseConflict/expected/.git_keep/refs/remotes/origin/master new file mode 100644 index 000000000..271b00ad9 --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/.git_keep/refs/remotes/origin/master @@ -0,0 +1 @@ +103c3eb899d173b83fc1b40261c8880fef359cc3 diff --git a/test/integration/pullRebaseConflict/expected/myfile1 b/test/integration/pullRebaseConflict/expected/myfile1 new file mode 100644 index 000000000..a5bce3fd2 --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/myfile1 @@ -0,0 +1 @@ +test1 diff --git a/test/integration/pullRebaseConflict/expected/myfile2 b/test/integration/pullRebaseConflict/expected/myfile2 new file mode 100644 index 000000000..180cf8328 --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/myfile2 @@ -0,0 +1 @@ +test2 diff --git a/test/integration/pullRebaseConflict/expected/myfile3 b/test/integration/pullRebaseConflict/expected/myfile3 new file mode 100644 index 000000000..df6b0d2bc --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/myfile3 @@ -0,0 +1 @@ +test3 diff --git a/test/integration/pullRebaseConflict/expected/myfile4 b/test/integration/pullRebaseConflict/expected/myfile4 new file mode 100644 index 000000000..9b1719f5c --- /dev/null +++ b/test/integration/pullRebaseConflict/expected/myfile4 @@ -0,0 +1 @@ +conflict diff --git a/test/integration/pullRebaseConflict/expected_remote/HEAD b/test/integration/pullRebaseConflict/expected_remote/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pullRebaseConflict/expected_remote/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pullRebaseConflict/expected_remote/config b/test/integration/pullRebaseConflict/expected_remote/config new file mode 100644 index 000000000..e2f03fd10 --- /dev/null +++ b/test/integration/pullRebaseConflict/expected_remote/config @@ -0,0 +1,8 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true + ignorecase = true + precomposeunicode = true +[remote "origin"] + url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/pullRebaseConflict/./actual diff --git a/test/integration/pullRebaseConflict/expected_remote/description b/test/integration/pullRebaseConflict/expected_remote/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pullRebaseConflict/expected_remote/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pullRebaseConflict/expected_remote/info/exclude b/test/integration/pullRebaseConflict/expected_remote/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pullRebaseConflict/expected_remote/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pullRebaseConflict/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pullRebaseConflict/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pullRebaseConflict/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pullRebaseConflict/expected_remote/objects/10/3c3eb899d173b83fc1b40261c8880fef359cc3 b/test/integration/pullRebaseConflict/expected_remote/objects/10/3c3eb899d173b83fc1b40261c8880fef359cc3 new file mode 100644 index 000000000..54f9946f5 Binary files /dev/null and b/test/integration/pullRebaseConflict/expected_remote/objects/10/3c3eb899d173b83fc1b40261c8880fef359cc3 differ diff --git a/test/integration/pullRebaseConflict/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pullRebaseConflict/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pullRebaseConflict/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pullRebaseConflict/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pullRebaseConflict/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pullRebaseConflict/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pullRebaseConflict/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pullRebaseConflict/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pullRebaseConflict/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pullRebaseConflict/expected_remote/objects/34/574474ac6f7dd2d3142bc28ee39db88d8a16af b/test/integration/pullRebaseConflict/expected_remote/objects/34/574474ac6f7dd2d3142bc28ee39db88d8a16af new file mode 100644 index 000000000..229191e1c --- /dev/null +++ b/test/integration/pullRebaseConflict/expected_remote/objects/34/574474ac6f7dd2d3142bc28ee39db88d8a16af @@ -0,0 +1,2 @@ +xA + @Ѯ= DBV9ё2X<.7¹%"%KXݙ8c^'rM)DZssOn*h~5B, \ No newline at end of file diff --git a/test/integration/pullRebaseConflict/expected_remote/objects/3b/9389ff50095ad2d66d33bb6d67b5700f0bf6da b/test/integration/pullRebaseConflict/expected_remote/objects/3b/9389ff50095ad2d66d33bb6d67b5700f0bf6da new file mode 100644 index 000000000..fd885765d Binary files /dev/null and b/test/integration/pullRebaseConflict/expected_remote/objects/3b/9389ff50095ad2d66d33bb6d67b5700f0bf6da differ diff --git a/test/integration/pullRebaseConflict/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pullRebaseConflict/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pullRebaseConflict/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pullRebaseConflict/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pullRebaseConflict/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pullRebaseConflict/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pullRebaseConflict/expected_remote/objects/aa/6ae0785290ee09875f6bd5a5d50c0e7002de13 b/test/integration/pullRebaseConflict/expected_remote/objects/aa/6ae0785290ee09875f6bd5a5d50c0e7002de13 new file mode 100644 index 000000000..94a6241c8 Binary files /dev/null and b/test/integration/pullRebaseConflict/expected_remote/objects/aa/6ae0785290ee09875f6bd5a5d50c0e7002de13 differ diff --git a/test/integration/pullRebaseConflict/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/pullRebaseConflict/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/pullRebaseConflict/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/pullRebaseConflict/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pullRebaseConflict/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pullRebaseConflict/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pullRebaseConflict/expected_remote/packed-refs b/test/integration/pullRebaseConflict/expected_remote/packed-refs new file mode 100644 index 000000000..5fc546218 --- /dev/null +++ b/test/integration/pullRebaseConflict/expected_remote/packed-refs @@ -0,0 +1,2 @@ +# pack-refs with: peeled fully-peeled sorted +103c3eb899d173b83fc1b40261c8880fef359cc3 refs/heads/master diff --git a/test/integration/pullRebaseConflict/recording.json b/test/integration/pullRebaseConflict/recording.json new file mode 100644 index 000000000..46a1e361f --- /dev/null +++ b/test/integration/pullRebaseConflict/recording.json @@ -0,0 +1 @@ +{"KeyEvents":[{"Timestamp":594,"Mod":0,"Key":256,"Ch":112},{"Timestamp":1378,"Mod":0,"Key":13,"Ch":13},{"Timestamp":1818,"Mod":0,"Key":13,"Ch":13},{"Timestamp":2067,"Mod":0,"Key":258,"Ch":0},{"Timestamp":2306,"Mod":0,"Key":256,"Ch":32},{"Timestamp":2810,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3562,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/pullRebaseConflict/setup.sh b/test/integration/pullRebaseConflict/setup.sh new file mode 100644 index 000000000..63146bda2 --- /dev/null +++ b/test/integration/pullRebaseConflict/setup.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +set -e + +cd $1 + +git init + +git config user.email "CI@example.com" +git config user.name "CI" + +echo test1 > myfile1 +git add . +git commit -am "myfile1" +echo test2 > myfile2 +git add . +git commit -am "myfile2" +echo test3 > myfile3 +git add . +git commit -am "myfile3" +echo test4 > myfile4 +git add . +git commit -am "myfile4" + +cd .. +git clone --bare ./actual actual_remote + +cd actual + +git reset --hard HEAD~2 + +echo conflict > myfile4 +git add . +git commit -am "myfile4 conflict" + +git remote add origin ../actual_remote +git fetch origin +git branch --set-upstream-to=origin/master master + +git config pull.rebase true diff --git a/test/integration/pullRebaseConflict/test.json b/test/integration/pullRebaseConflict/test.json new file mode 100644 index 000000000..39ddf1e3d --- /dev/null +++ b/test/integration/pullRebaseConflict/test.json @@ -0,0 +1 @@ +{ "description": "When user has configured pull with rebase, ensure we handle conflicts", "speed": 10 } diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/COMMIT_EDITMSG b/test/integration/pullRebaseInteractive/expected/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..12f245db0 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/COMMIT_EDITMSG @@ -0,0 +1,16 @@ +myfile4 conflict + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# +# interactive rebase in progress; onto ea4a99e +# Last command done (1 command done): +# pick efbb36c myfile4 conflict +# Next commands to do (3 remaining commands): +# pick 9147ce4 5 +# pick e2251a5 6 +# You are currently rebasing branch 'master' on 'ea4a99e'. +# +# Changes to be committed: +# modified: myfile4 +# diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/FETCH_HEAD b/test/integration/pullRebaseInteractive/expected/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..5d2dc1af4 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/FETCH_HEAD @@ -0,0 +1 @@ +ea4a99ea801f54f1ec09a88a28c65eb4db5865aa branch 'master' of ../actual_remote diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/HEAD b/test/integration/pullRebaseInteractive/expected/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/ORIG_HEAD b/test/integration/pullRebaseInteractive/expected/.git_keep/ORIG_HEAD new file mode 100644 index 000000000..a03bb270d --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/ORIG_HEAD @@ -0,0 +1 @@ +efbb36c97316886b089b1b27233cd8bfdc37ed4a diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/config b/test/integration/pullRebaseInteractive/expected/.git_keep/config new file mode 100644 index 000000000..cfff6ba8c --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/config @@ -0,0 +1,18 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[remote "origin"] + url = ../actual_remote + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master +[pull] + rebase = interactive diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/description b/test/integration/pullRebaseInteractive/expected/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/index b/test/integration/pullRebaseInteractive/expected/.git_keep/index new file mode 100644 index 000000000..906076536 Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/index differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/info/exclude b/test/integration/pullRebaseInteractive/expected/.git_keep/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/logs/HEAD b/test/integration/pullRebaseInteractive/expected/.git_keep/logs/HEAD new file mode 100644 index 000000000..ea2e57777 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/logs/HEAD @@ -0,0 +1,15 @@ +0000000000000000000000000000000000000000 74ca3dec707dde7c92727d9490517e498360fea8 CI 1634896929 +1100 commit (initial): myfile1 +74ca3dec707dde7c92727d9490517e498360fea8 ca58e8d47d619ffb625dc021f0ab2bb0f0bcf623 CI 1634896929 +1100 commit: myfile2 +ca58e8d47d619ffb625dc021f0ab2bb0f0bcf623 3fb33027aedae13ab0796292c821a0258f6c2f7b CI 1634896929 +1100 commit: myfile3 +3fb33027aedae13ab0796292c821a0258f6c2f7b ea4a99ea801f54f1ec09a88a28c65eb4db5865aa CI 1634896929 +1100 commit: myfile4 +ea4a99ea801f54f1ec09a88a28c65eb4db5865aa ca58e8d47d619ffb625dc021f0ab2bb0f0bcf623 CI 1634896929 +1100 reset: moving to head^^ +ca58e8d47d619ffb625dc021f0ab2bb0f0bcf623 efbb36c97316886b089b1b27233cd8bfdc37ed4a CI 1634896929 +1100 commit: myfile4 conflict +efbb36c97316886b089b1b27233cd8bfdc37ed4a 9147ce4817b84339d884cee1683f361fd3aa4696 CI 1634896929 +1100 commit: 5 +9147ce4817b84339d884cee1683f361fd3aa4696 e2251a5b6d32bf5fc57f234946e3fabeba3b5cca CI 1634896929 +1100 commit: 6 +e2251a5b6d32bf5fc57f234946e3fabeba3b5cca 89ee54b2ed7aff7c3aae24f64be85568f9a9d329 CI 1634896929 +1100 commit: 7 +89ee54b2ed7aff7c3aae24f64be85568f9a9d329 ea4a99ea801f54f1ec09a88a28c65eb4db5865aa CI 1634896931 +1100 rebase -i (start): checkout ea4a99ea801f54f1ec09a88a28c65eb4db5865aa +ea4a99ea801f54f1ec09a88a28c65eb4db5865aa 29daf999882c9e60c6b6a2868913a6cfd856d620 CI 1634896933 +1100 rebase -i (continue): myfile4 conflict +29daf999882c9e60c6b6a2868913a6cfd856d620 5c32741b468f0ab8ddd243e9871dcc8dec5c35f9 CI 1634896933 +1100 rebase -i (pick): 5 +5c32741b468f0ab8ddd243e9871dcc8dec5c35f9 423f7757eb2eea3de217b54447a94820af933d3a CI 1634896933 +1100 rebase -i (pick): 6 +423f7757eb2eea3de217b54447a94820af933d3a bf4fb489636d4bde42e478b04cbdcc079dcd0183 CI 1634896933 +1100 rebase -i (pick): 7 +bf4fb489636d4bde42e478b04cbdcc079dcd0183 bf4fb489636d4bde42e478b04cbdcc079dcd0183 CI 1634896933 +1100 rebase -i (finish): returning to refs/heads/master diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/logs/refs/heads/master b/test/integration/pullRebaseInteractive/expected/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..6ebd29d80 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/logs/refs/heads/master @@ -0,0 +1,10 @@ +0000000000000000000000000000000000000000 74ca3dec707dde7c92727d9490517e498360fea8 CI 1634896929 +1100 commit (initial): myfile1 +74ca3dec707dde7c92727d9490517e498360fea8 ca58e8d47d619ffb625dc021f0ab2bb0f0bcf623 CI 1634896929 +1100 commit: myfile2 +ca58e8d47d619ffb625dc021f0ab2bb0f0bcf623 3fb33027aedae13ab0796292c821a0258f6c2f7b CI 1634896929 +1100 commit: myfile3 +3fb33027aedae13ab0796292c821a0258f6c2f7b ea4a99ea801f54f1ec09a88a28c65eb4db5865aa CI 1634896929 +1100 commit: myfile4 +ea4a99ea801f54f1ec09a88a28c65eb4db5865aa ca58e8d47d619ffb625dc021f0ab2bb0f0bcf623 CI 1634896929 +1100 reset: moving to head^^ +ca58e8d47d619ffb625dc021f0ab2bb0f0bcf623 efbb36c97316886b089b1b27233cd8bfdc37ed4a CI 1634896929 +1100 commit: myfile4 conflict +efbb36c97316886b089b1b27233cd8bfdc37ed4a 9147ce4817b84339d884cee1683f361fd3aa4696 CI 1634896929 +1100 commit: 5 +9147ce4817b84339d884cee1683f361fd3aa4696 e2251a5b6d32bf5fc57f234946e3fabeba3b5cca CI 1634896929 +1100 commit: 6 +e2251a5b6d32bf5fc57f234946e3fabeba3b5cca 89ee54b2ed7aff7c3aae24f64be85568f9a9d329 CI 1634896929 +1100 commit: 7 +89ee54b2ed7aff7c3aae24f64be85568f9a9d329 bf4fb489636d4bde42e478b04cbdcc079dcd0183 CI 1634896933 +1100 rebase -i (finish): refs/heads/master onto ea4a99ea801f54f1ec09a88a28c65eb4db5865aa diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/pullRebaseInteractive/expected/.git_keep/logs/refs/remotes/origin/master new file mode 100644 index 000000000..4a22e7de9 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/logs/refs/remotes/origin/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 ea4a99ea801f54f1ec09a88a28c65eb4db5865aa CI 1634896929 +1100 fetch origin: storing head diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/00/a0b67048be84a6aeaa50b27ad90ab567d65837 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/00/a0b67048be84a6aeaa50b27ad90ab567d65837 new file mode 100644 index 000000000..48767aa88 Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/00/a0b67048be84a6aeaa50b27ad90ab567d65837 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/24/21815f8570a34d9f8c8991df1005150ed3ae99 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/24/21815f8570a34d9f8c8991df1005150ed3ae99 new file mode 100644 index 000000000..4df0a731d Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/24/21815f8570a34d9f8c8991df1005150ed3ae99 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/29/daf999882c9e60c6b6a2868913a6cfd856d620 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/29/daf999882c9e60c6b6a2868913a6cfd856d620 new file mode 100644 index 000000000..59ed7fe6b Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/29/daf999882c9e60c6b6a2868913a6cfd856d620 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/3f/b33027aedae13ab0796292c821a0258f6c2f7b b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/3f/b33027aedae13ab0796292c821a0258f6c2f7b new file mode 100644 index 000000000..72f6e886b Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/3f/b33027aedae13ab0796292c821a0258f6c2f7b differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/42/3f7757eb2eea3de217b54447a94820af933d3a b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/42/3f7757eb2eea3de217b54447a94820af933d3a new file mode 100644 index 000000000..a0d83ec6c --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/42/3f7757eb2eea3de217b54447a94820af933d3a @@ -0,0 +1,5 @@ +x}A +1 a=E4MI@D6) + +.\}|}W>x 2JA*8!:lXOn!QuF"*R +!bev^y^m{ꩬb!a Naܘ9⏛d-7 \ No newline at end of file diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/5c/32741b468f0ab8ddd243e9871dcc8dec5c35f9 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/5c/32741b468f0ab8ddd243e9871dcc8dec5c35f9 new file mode 100644 index 000000000..3bc24fb42 Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/5c/32741b468f0ab8ddd243e9871dcc8dec5c35f9 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/5d/0d8eb2623180ca95f2634f7e25f40521d5aea2 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/5d/0d8eb2623180ca95f2634f7e25f40521d5aea2 new file mode 100644 index 000000000..7fc19f59c Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/5d/0d8eb2623180ca95f2634f7e25f40521d5aea2 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/74/ca3dec707dde7c92727d9490517e498360fea8 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/74/ca3dec707dde7c92727d9490517e498360fea8 new file mode 100644 index 000000000..2f5e7e39f --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/74/ca3dec707dde7c92727d9490517e498360fea8 @@ -0,0 +1,2 @@ +xA +0@Q9ɤ4cL!R"~H|*x\2&H1rH J'l;L3ܦצ)$8#zzLɝ})7(, \ No newline at end of file diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/89/ee54b2ed7aff7c3aae24f64be85568f9a9d329 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/89/ee54b2ed7aff7c3aae24f64be85568f9a9d329 new file mode 100644 index 000000000..155cfe5f6 Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/89/ee54b2ed7aff7c3aae24f64be85568f9a9d329 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/8c/fc761d2799512553e491f7ceb3564a5e994999 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/8c/fc761d2799512553e491f7ceb3564a5e994999 new file mode 100644 index 000000000..8baacd0cc Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/8c/fc761d2799512553e491f7ceb3564a5e994999 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/91/47ce4817b84339d884cee1683f361fd3aa4696 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/91/47ce4817b84339d884cee1683f361fd3aa4696 new file mode 100644 index 000000000..04880639a Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/91/47ce4817b84339d884cee1683f361fd3aa4696 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/9b/1719f5cf069568785080a0bbabbe7c377e22ae b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/9b/1719f5cf069568785080a0bbabbe7c377e22ae new file mode 100644 index 000000000..13e3f581a Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/9b/1719f5cf069568785080a0bbabbe7c377e22ae differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/9d/aeafb9864cf43055ae93beb0afd6c7d144bfa4 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/9d/aeafb9864cf43055ae93beb0afd6c7d144bfa4 new file mode 100644 index 000000000..4667dcf6f Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/9d/aeafb9864cf43055ae93beb0afd6c7d144bfa4 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/ae/d6c0a012c68a8b615ab0185b64f59c414d4746 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/ae/d6c0a012c68a8b615ab0185b64f59c414d4746 new file mode 100644 index 000000000..5a90eb5f9 Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/ae/d6c0a012c68a8b615ab0185b64f59c414d4746 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/b2/da3d615a1805f094849247add77d09aee06451 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/b2/da3d615a1805f094849247add77d09aee06451 new file mode 100644 index 000000000..ae05cad1e Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/b2/da3d615a1805f094849247add77d09aee06451 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/b8/9e837219d9a8aceb8b0f13381be0afb0dac427 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/b8/9e837219d9a8aceb8b0f13381be0afb0dac427 new file mode 100644 index 000000000..3d41eceda Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/b8/9e837219d9a8aceb8b0f13381be0afb0dac427 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/bf/4fb489636d4bde42e478b04cbdcc079dcd0183 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/bf/4fb489636d4bde42e478b04cbdcc079dcd0183 new file mode 100644 index 000000000..11a65f3f4 Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/bf/4fb489636d4bde42e478b04cbdcc079dcd0183 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/ca/58e8d47d619ffb625dc021f0ab2bb0f0bcf623 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/ca/58e8d47d619ffb625dc021f0ab2bb0f0bcf623 new file mode 100644 index 000000000..1cf77f0bb Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/ca/58e8d47d619ffb625dc021f0ab2bb0f0bcf623 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/d4/8cf11b7fbbda4199b736bb9e8fadabf773eb9e b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/d4/8cf11b7fbbda4199b736bb9e8fadabf773eb9e new file mode 100644 index 000000000..d63c59fb0 Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/d4/8cf11b7fbbda4199b736bb9e8fadabf773eb9e differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/e2/251a5b6d32bf5fc57f234946e3fabeba3b5cca b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/e2/251a5b6d32bf5fc57f234946e3fabeba3b5cca new file mode 100644 index 000000000..f4473469b Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/e2/251a5b6d32bf5fc57f234946e3fabeba3b5cca differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/ea/4a99ea801f54f1ec09a88a28c65eb4db5865aa b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/ea/4a99ea801f54f1ec09a88a28c65eb4db5865aa new file mode 100644 index 000000000..a9ed03844 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/ea/4a99ea801f54f1ec09a88a28c65eb4db5865aa @@ -0,0 +1,2 @@ +xA +0@Q9EdfI"BW=4NR"~◵[wU!z%)U0$X#P$d0D0>Ddr13f, AT`wF{ƻ~m^n|ʜ13sT?i:/g8 \ No newline at end of file diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/ef/bb36c97316886b089b1b27233cd8bfdc37ed4a b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/ef/bb36c97316886b089b1b27233cd8bfdc37ed4a new file mode 100644 index 000000000..2f6153345 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/ef/bb36c97316886b089b1b27233cd8bfdc37ed4a @@ -0,0 +1,2 @@ +xA +0@Q9E̤ɘU1NИR">Kup껪eIP g2xz2V8D̈́L. pv9C,`ݟmdomՋzHK`=-˪J{un~/>@ \ No newline at end of file diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/objects/f0/bbe52a52883609acdb825c8af32b4b3ccb0607 b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/f0/bbe52a52883609acdb825c8af32b4b3ccb0607 new file mode 100644 index 000000000..b0b5fcfd9 Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected/.git_keep/objects/f0/bbe52a52883609acdb825c8af32b4b3ccb0607 differ diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/refs/heads/master b/test/integration/pullRebaseInteractive/expected/.git_keep/refs/heads/master new file mode 100644 index 000000000..bc528dc20 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/refs/heads/master @@ -0,0 +1 @@ +bf4fb489636d4bde42e478b04cbdcc079dcd0183 diff --git a/test/integration/pullRebaseInteractive/expected/.git_keep/refs/remotes/origin/master b/test/integration/pullRebaseInteractive/expected/.git_keep/refs/remotes/origin/master new file mode 100644 index 000000000..0597374d4 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/.git_keep/refs/remotes/origin/master @@ -0,0 +1 @@ +ea4a99ea801f54f1ec09a88a28c65eb4db5865aa diff --git a/test/integration/pullRebaseInteractive/expected/myfile1 b/test/integration/pullRebaseInteractive/expected/myfile1 new file mode 100644 index 000000000..a5bce3fd2 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/myfile1 @@ -0,0 +1 @@ +test1 diff --git a/test/integration/pullRebaseInteractive/expected/myfile2 b/test/integration/pullRebaseInteractive/expected/myfile2 new file mode 100644 index 000000000..180cf8328 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/myfile2 @@ -0,0 +1 @@ +test2 diff --git a/test/integration/pullRebaseInteractive/expected/myfile3 b/test/integration/pullRebaseInteractive/expected/myfile3 new file mode 100644 index 000000000..df6b0d2bc --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/myfile3 @@ -0,0 +1 @@ +test3 diff --git a/test/integration/pullRebaseInteractive/expected/myfile4 b/test/integration/pullRebaseInteractive/expected/myfile4 new file mode 100644 index 000000000..9b1719f5c --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/myfile4 @@ -0,0 +1 @@ +conflict diff --git a/test/integration/pullRebaseInteractive/expected/myfile5 b/test/integration/pullRebaseInteractive/expected/myfile5 new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/myfile5 @@ -0,0 +1 @@ +test diff --git a/test/integration/pullRebaseInteractive/expected/myfile6 b/test/integration/pullRebaseInteractive/expected/myfile6 new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/myfile6 @@ -0,0 +1 @@ +test diff --git a/test/integration/pullRebaseInteractive/expected/myfile7 b/test/integration/pullRebaseInteractive/expected/myfile7 new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected/myfile7 @@ -0,0 +1 @@ +test diff --git a/test/integration/pullRebaseInteractive/expected_remote/HEAD b/test/integration/pullRebaseInteractive/expected_remote/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected_remote/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pullRebaseInteractive/expected_remote/config b/test/integration/pullRebaseInteractive/expected_remote/config new file mode 100644 index 000000000..79d424485 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected_remote/config @@ -0,0 +1,8 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true + ignorecase = true + precomposeunicode = true +[remote "origin"] + url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/pullRebaseInteractive/./actual diff --git a/test/integration/pullRebaseInteractive/expected_remote/description b/test/integration/pullRebaseInteractive/expected_remote/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected_remote/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pullRebaseInteractive/expected_remote/info/exclude b/test/integration/pullRebaseInteractive/expected_remote/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected_remote/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pullRebaseInteractive/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pullRebaseInteractive/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pullRebaseInteractive/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pullRebaseInteractive/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pullRebaseInteractive/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pullRebaseInteractive/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pullRebaseInteractive/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pullRebaseInteractive/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pullRebaseInteractive/expected_remote/objects/3f/b33027aedae13ab0796292c821a0258f6c2f7b b/test/integration/pullRebaseInteractive/expected_remote/objects/3f/b33027aedae13ab0796292c821a0258f6c2f7b new file mode 100644 index 000000000..72f6e886b Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected_remote/objects/3f/b33027aedae13ab0796292c821a0258f6c2f7b differ diff --git a/test/integration/pullRebaseInteractive/expected_remote/objects/74/ca3dec707dde7c92727d9490517e498360fea8 b/test/integration/pullRebaseInteractive/expected_remote/objects/74/ca3dec707dde7c92727d9490517e498360fea8 new file mode 100644 index 000000000..2f5e7e39f --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected_remote/objects/74/ca3dec707dde7c92727d9490517e498360fea8 @@ -0,0 +1,2 @@ +xA +0@Q9ɤ4cL!R"~H|*x\2&H1rH J'l;L3ܦצ)$8#zzLɝ})7(, \ No newline at end of file diff --git a/test/integration/pullRebaseInteractive/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pullRebaseInteractive/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pullRebaseInteractive/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pullRebaseInteractive/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pullRebaseInteractive/expected_remote/objects/ca/58e8d47d619ffb625dc021f0ab2bb0f0bcf623 b/test/integration/pullRebaseInteractive/expected_remote/objects/ca/58e8d47d619ffb625dc021f0ab2bb0f0bcf623 new file mode 100644 index 000000000..1cf77f0bb Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected_remote/objects/ca/58e8d47d619ffb625dc021f0ab2bb0f0bcf623 differ diff --git a/test/integration/pullRebaseInteractive/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/pullRebaseInteractive/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/pullRebaseInteractive/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pullRebaseInteractive/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pullRebaseInteractive/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pullRebaseInteractive/expected_remote/objects/ea/4a99ea801f54f1ec09a88a28c65eb4db5865aa b/test/integration/pullRebaseInteractive/expected_remote/objects/ea/4a99ea801f54f1ec09a88a28c65eb4db5865aa new file mode 100644 index 000000000..a9ed03844 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected_remote/objects/ea/4a99ea801f54f1ec09a88a28c65eb4db5865aa @@ -0,0 +1,2 @@ +xA +0@Q9EdfI"BW=4NR"~◵[wU!z%)U0$X#P$d0D0>Ddr13f, AT`wF{ƻ~m^n|ʜ13sT?i:/g8 \ No newline at end of file diff --git a/test/integration/pullRebaseInteractive/expected_remote/packed-refs b/test/integration/pullRebaseInteractive/expected_remote/packed-refs new file mode 100644 index 000000000..33ecbd263 --- /dev/null +++ b/test/integration/pullRebaseInteractive/expected_remote/packed-refs @@ -0,0 +1,2 @@ +# pack-refs with: peeled fully-peeled sorted +ea4a99ea801f54f1ec09a88a28c65eb4db5865aa refs/heads/master diff --git a/test/integration/pullRebaseInteractive/recording.json b/test/integration/pullRebaseInteractive/recording.json new file mode 100644 index 000000000..dee2e4d8b --- /dev/null +++ b/test/integration/pullRebaseInteractive/recording.json @@ -0,0 +1 @@ +{"KeyEvents":[{"Timestamp":1280,"Mod":0,"Key":256,"Ch":112},{"Timestamp":2032,"Mod":0,"Key":13,"Ch":13},{"Timestamp":2392,"Mod":0,"Key":13,"Ch":13},{"Timestamp":2640,"Mod":0,"Key":258,"Ch":0},{"Timestamp":2896,"Mod":0,"Key":256,"Ch":32},{"Timestamp":3384,"Mod":0,"Key":13,"Ch":13},{"Timestamp":4158,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/pullRebaseInteractive/setup.sh b/test/integration/pullRebaseInteractive/setup.sh new file mode 100644 index 000000000..0795a297f --- /dev/null +++ b/test/integration/pullRebaseInteractive/setup.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +set -e + +cd $1 + +git init + +git config user.email "CI@example.com" +git config user.name "CI" + +echo test1 > myfile1 +git add . +git commit -am "myfile1" +echo test2 > myfile2 +git add . +git commit -am "myfile2" +echo test3 > myfile3 +git add . +git commit -am "myfile3" +echo test4 > myfile4 +git add . +git commit -am "myfile4" + +cd .. +git clone --bare ./actual actual_remote + +cd actual + +git reset --hard HEAD~2 + +echo conflict > myfile4 +git add . +git commit -am "myfile4 conflict" + +echo test > myfile5 +git add . +git commit -am "5" + +echo test > myfile6 +git add . +git commit -am "6" + +echo test > myfile7 +git add . +git commit -am "7" + +git remote add origin ../actual_remote +git fetch origin +git branch --set-upstream-to=origin/master master + +git config pull.rebase interactive diff --git a/test/integration/pullRebaseInteractive/test.json b/test/integration/pullRebaseInteractive/test.json new file mode 100644 index 000000000..7eb652fa1 --- /dev/null +++ b/test/integration/pullRebaseInteractive/test.json @@ -0,0 +1 @@ +{ "description": "When user has configured pull with interactive rebase, ensure we handle conflicts", "speed": 5 } diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/COMMIT_EDITMSG b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..13b4a42ac --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/COMMIT_EDITMSG @@ -0,0 +1,16 @@ +myfile4 conflict + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# +# interactive rebase in progress; onto 4589efc +# Last command done (1 command done): +# pick 9013b5f myfile4 conflict +# Next commands to do (3 remaining commands): +# pick 0fa5386 5 +# drop 69a5c9f 6 +# You are currently rebasing branch 'master' on '4589efc'. +# +# Changes to be committed: +# modified: myfile4 +# diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/FETCH_HEAD b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..4d6186494 --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/FETCH_HEAD @@ -0,0 +1 @@ +4589efcaf3024e841825bb289bb88eb0e4f8530a branch 'master' of ../actual_remote diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/HEAD b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/ORIG_HEAD b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/ORIG_HEAD new file mode 100644 index 000000000..d989f6dc2 --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/ORIG_HEAD @@ -0,0 +1 @@ +9013b5f12ca8a0fdd44fbe72028500bbac5c89ee diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/config b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/config new file mode 100644 index 000000000..cfff6ba8c --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/config @@ -0,0 +1,18 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[remote "origin"] + url = ../actual_remote + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master +[pull] + rebase = interactive diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/description b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/index b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/index new file mode 100644 index 000000000..109dfab63 Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/index differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/info/exclude b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/logs/HEAD b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/logs/HEAD new file mode 100644 index 000000000..f5f276231 --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/logs/HEAD @@ -0,0 +1,14 @@ +0000000000000000000000000000000000000000 5759b6258419271e67a172e51cd90048dd21f9c0 CI 1634896936 +1100 commit (initial): myfile1 +5759b6258419271e67a172e51cd90048dd21f9c0 476a1939075b60aa47da50a8c40c5b4412a2f18b CI 1634896936 +1100 commit: myfile2 +476a1939075b60aa47da50a8c40c5b4412a2f18b e047462bda495acbe565c85b205d614f38c0a692 CI 1634896936 +1100 commit: myfile3 +e047462bda495acbe565c85b205d614f38c0a692 4589efcaf3024e841825bb289bb88eb0e4f8530a CI 1634896936 +1100 commit: myfile4 +4589efcaf3024e841825bb289bb88eb0e4f8530a 476a1939075b60aa47da50a8c40c5b4412a2f18b CI 1634896936 +1100 reset: moving to head^^ +476a1939075b60aa47da50a8c40c5b4412a2f18b 9013b5f12ca8a0fdd44fbe72028500bbac5c89ee CI 1634896936 +1100 commit: myfile4 conflict +9013b5f12ca8a0fdd44fbe72028500bbac5c89ee 0fa53867500c0f3a5cca9b2112982795fae51c51 CI 1634896936 +1100 commit: 5 +0fa53867500c0f3a5cca9b2112982795fae51c51 69a5c9fb912112305bfe15272855afb50f6acf4b CI 1634896936 +1100 commit: 6 +69a5c9fb912112305bfe15272855afb50f6acf4b af4c4b2b977f8909e590ea5bc3bab59d991e4c28 CI 1634896936 +1100 commit: 7 +af4c4b2b977f8909e590ea5bc3bab59d991e4c28 4589efcaf3024e841825bb289bb88eb0e4f8530a CI 1634896938 +1100 rebase -i (start): checkout 4589efcaf3024e841825bb289bb88eb0e4f8530a +4589efcaf3024e841825bb289bb88eb0e4f8530a 5d08d9b6315ddb8fb8372d83b54862ba7d7fdc88 CI 1634896942 +1100 rebase -i (continue): myfile4 conflict +5d08d9b6315ddb8fb8372d83b54862ba7d7fdc88 7c717449332e4a81f7e5643eef9c95f459444e3f CI 1634896942 +1100 rebase -i (pick): 5 +7c717449332e4a81f7e5643eef9c95f459444e3f ae4e33d43751b83fbd0b6f0a1796d58462492e47 CI 1634896942 +1100 rebase -i (pick): 7 +ae4e33d43751b83fbd0b6f0a1796d58462492e47 ae4e33d43751b83fbd0b6f0a1796d58462492e47 CI 1634896942 +1100 rebase -i (finish): returning to refs/heads/master diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/logs/refs/heads/master b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..ae47bc191 --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/logs/refs/heads/master @@ -0,0 +1,10 @@ +0000000000000000000000000000000000000000 5759b6258419271e67a172e51cd90048dd21f9c0 CI 1634896936 +1100 commit (initial): myfile1 +5759b6258419271e67a172e51cd90048dd21f9c0 476a1939075b60aa47da50a8c40c5b4412a2f18b CI 1634896936 +1100 commit: myfile2 +476a1939075b60aa47da50a8c40c5b4412a2f18b e047462bda495acbe565c85b205d614f38c0a692 CI 1634896936 +1100 commit: myfile3 +e047462bda495acbe565c85b205d614f38c0a692 4589efcaf3024e841825bb289bb88eb0e4f8530a CI 1634896936 +1100 commit: myfile4 +4589efcaf3024e841825bb289bb88eb0e4f8530a 476a1939075b60aa47da50a8c40c5b4412a2f18b CI 1634896936 +1100 reset: moving to head^^ +476a1939075b60aa47da50a8c40c5b4412a2f18b 9013b5f12ca8a0fdd44fbe72028500bbac5c89ee CI 1634896936 +1100 commit: myfile4 conflict +9013b5f12ca8a0fdd44fbe72028500bbac5c89ee 0fa53867500c0f3a5cca9b2112982795fae51c51 CI 1634896936 +1100 commit: 5 +0fa53867500c0f3a5cca9b2112982795fae51c51 69a5c9fb912112305bfe15272855afb50f6acf4b CI 1634896936 +1100 commit: 6 +69a5c9fb912112305bfe15272855afb50f6acf4b af4c4b2b977f8909e590ea5bc3bab59d991e4c28 CI 1634896936 +1100 commit: 7 +af4c4b2b977f8909e590ea5bc3bab59d991e4c28 ae4e33d43751b83fbd0b6f0a1796d58462492e47 CI 1634896942 +1100 rebase -i (finish): refs/heads/master onto 4589efcaf3024e841825bb289bb88eb0e4f8530a diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/logs/refs/remotes/origin/master new file mode 100644 index 000000000..3c26173a8 --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/logs/refs/remotes/origin/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 4589efcaf3024e841825bb289bb88eb0e4f8530a CI 1634896936 +1100 fetch origin: storing head diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/00/a0b67048be84a6aeaa50b27ad90ab567d65837 b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/00/a0b67048be84a6aeaa50b27ad90ab567d65837 new file mode 100644 index 000000000..48767aa88 Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/00/a0b67048be84a6aeaa50b27ad90ab567d65837 differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/0f/a53867500c0f3a5cca9b2112982795fae51c51 b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/0f/a53867500c0f3a5cca9b2112982795fae51c51 new file mode 100644 index 000000000..f5f9df209 Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/0f/a53867500c0f3a5cca9b2112982795fae51c51 differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/26/02a2a5727666c205fef7f152786e1edb1c5d4b b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/26/02a2a5727666c205fef7f152786e1edb1c5d4b new file mode 100644 index 000000000..90bf4a139 Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/26/02a2a5727666c205fef7f152786e1edb1c5d4b differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/45/89efcaf3024e841825bb289bb88eb0e4f8530a b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/45/89efcaf3024e841825bb289bb88eb0e4f8530a new file mode 100644 index 000000000..abf2de1e2 --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/45/89efcaf3024e841825bb289bb88eb0e4f8530a @@ -0,0 +1,2 @@ +xA +0@Q9E$3Dz$`R"~◵[t껪uUp `ȇQC,:#%qD]_*@(r*YYxC$љudtOjS/em7)D^'7[8 \ No newline at end of file diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/47/6a1939075b60aa47da50a8c40c5b4412a2f18b b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/47/6a1939075b60aa47da50a8c40c5b4412a2f18b new file mode 100644 index 000000000..6f4196f0d Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/47/6a1939075b60aa47da50a8c40c5b4412a2f18b differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/57/59b6258419271e67a172e51cd90048dd21f9c0 b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/57/59b6258419271e67a172e51cd90048dd21f9c0 new file mode 100644 index 000000000..08237c841 --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/57/59b6258419271e67a172e51cd90048dd21f9c0 @@ -0,0 +1,3 @@ +xA +0@Q944cL!R"~H|*x\2&H1r8֑ +JNvfMC?bM/)0wG=&]ξu6, \ No newline at end of file diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/5d/08d9b6315ddb8fb8372d83b54862ba7d7fdc88 b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/5d/08d9b6315ddb8fb8372d83b54862ba7d7fdc88 new file mode 100644 index 000000000..eb8963927 --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/5d/08d9b6315ddb8fb8372d83b54862ba7d7fdc88 @@ -0,0 +1,2 @@ +x}α +0a2箾=m \ No newline at end of file diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/5d/0d8eb2623180ca95f2634f7e25f40521d5aea2 b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/5d/0d8eb2623180ca95f2634f7e25f40521d5aea2 new file mode 100644 index 000000000..7fc19f59c Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/5d/0d8eb2623180ca95f2634f7e25f40521d5aea2 differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/65/401620c5230dfa2ad6e0e2dcb6b447fe21262b b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/65/401620c5230dfa2ad6e0e2dcb6b447fe21262b new file mode 100644 index 000000000..a48fefe98 Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/65/401620c5230dfa2ad6e0e2dcb6b447fe21262b differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/69/a5c9fb912112305bfe15272855afb50f6acf4b b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/69/a5c9fb912112305bfe15272855afb50f6acf4b new file mode 100644 index 000000000..f4e99e6a6 Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/69/a5c9fb912112305bfe15272855afb50f6acf4b differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/7c/717449332e4a81f7e5643eef9c95f459444e3f b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/7c/717449332e4a81f7e5643eef9c95f459444e3f new file mode 100644 index 000000000..07becc026 --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/7c/717449332e4a81f7e5643eef9c95f459444e3f @@ -0,0 +1,3 @@ +x}M +0@a9E$L2"BW=L~P0.\}|C[k͈TtILYL0QmX $,C6!z +N8J&RuyY/yWmxJ!AgkQG=FϽq ұ8q \ No newline at end of file diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/8c/fc761d2799512553e491f7ceb3564a5e994999 b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/8c/fc761d2799512553e491f7ceb3564a5e994999 new file mode 100644 index 000000000..8baacd0cc Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/8c/fc761d2799512553e491f7ceb3564a5e994999 differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/90/13b5f12ca8a0fdd44fbe72028500bbac5c89ee b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/90/13b5f12ca8a0fdd44fbe72028500bbac5c89ee new file mode 100644 index 000000000..93173c9a0 Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/90/13b5f12ca8a0fdd44fbe72028500bbac5c89ee differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/9b/1719f5cf069568785080a0bbabbe7c377e22ae b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/9b/1719f5cf069568785080a0bbabbe7c377e22ae new file mode 100644 index 000000000..13e3f581a Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/9b/1719f5cf069568785080a0bbabbe7c377e22ae differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/9d/aeafb9864cf43055ae93beb0afd6c7d144bfa4 b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/9d/aeafb9864cf43055ae93beb0afd6c7d144bfa4 new file mode 100644 index 000000000..4667dcf6f Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/9d/aeafb9864cf43055ae93beb0afd6c7d144bfa4 differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/ae/4e33d43751b83fbd0b6f0a1796d58462492e47 b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/ae/4e33d43751b83fbd0b6f0a1796d58462492e47 new file mode 100644 index 000000000..d2952d0ad --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/expected/.git_keep/objects/ae/4e33d43751b83fbd0b6f0a1796d58462492e47 @@ -0,0 +1,2 @@ +x}α +0a myfile1 +git add . +git commit -am "myfile1" +echo test2 > myfile2 +git add . +git commit -am "myfile2" +echo test3 > myfile3 +git add . +git commit -am "myfile3" +echo test4 > myfile4 +git add . +git commit -am "myfile4" + +cd .. +git clone --bare ./actual actual_remote + +cd actual + +git reset --hard HEAD~2 + +echo conflict > myfile4 +git add . +git commit -am "myfile4 conflict" + +echo test > myfile5 +git add . +git commit -am "5" + +echo test > myfile6 +git add . +git commit -am "6" + +echo test > myfile7 +git add . +git commit -am "7" + +git remote add origin ../actual_remote +git fetch origin +git branch --set-upstream-to=origin/master master + +git config pull.rebase interactive diff --git a/test/integration/pullRebaseInteractiveWithDrop/test.json b/test/integration/pullRebaseInteractiveWithDrop/test.json new file mode 100644 index 000000000..6f85ff5b7 --- /dev/null +++ b/test/integration/pullRebaseInteractiveWithDrop/test.json @@ -0,0 +1 @@ +{ "description": "When user has configured pull with interactive rebase, ensure we handle conflicts and show commits yet to be rebased", "speed": 5 } diff --git a/test/integration/push/expected/.git_keep/COMMIT_EDITMSG b/test/integration/push/expected/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..51be8ec3d --- /dev/null +++ b/test/integration/push/expected/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +myfile4 diff --git a/test/integration/push/expected/.git_keep/FETCH_HEAD b/test/integration/push/expected/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..ecbad2700 --- /dev/null +++ b/test/integration/push/expected/.git_keep/FETCH_HEAD @@ -0,0 +1 @@ +547f41a06ebd3bee30fbba3f43631810fa24f1bb branch 'master' of ../actual_remote diff --git a/test/integration/push/expected/.git_keep/HEAD b/test/integration/push/expected/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/push/expected/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/push/expected/.git_keep/config b/test/integration/push/expected/.git_keep/config new file mode 100644 index 000000000..821803a3e --- /dev/null +++ b/test/integration/push/expected/.git_keep/config @@ -0,0 +1,16 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[remote "origin"] + url = ../actual_remote + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master diff --git a/test/integration/push/expected/.git_keep/description b/test/integration/push/expected/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/push/expected/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/push/expected/.git_keep/index b/test/integration/push/expected/.git_keep/index new file mode 100644 index 000000000..7d490a7c8 Binary files /dev/null and b/test/integration/push/expected/.git_keep/index differ diff --git a/test/integration/push/expected/.git_keep/info/exclude b/test/integration/push/expected/.git_keep/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/push/expected/.git_keep/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/push/expected/.git_keep/logs/HEAD b/test/integration/push/expected/.git_keep/logs/HEAD new file mode 100644 index 000000000..6c2301554 --- /dev/null +++ b/test/integration/push/expected/.git_keep/logs/HEAD @@ -0,0 +1,4 @@ +0000000000000000000000000000000000000000 eb831bc1251f71f602159d98f4550e380007ca4f CI 1634897746 +1100 commit (initial): myfile1 +eb831bc1251f71f602159d98f4550e380007ca4f 547f41a06ebd3bee30fbba3f43631810fa24f1bb CI 1634897746 +1100 commit: myfile2 +547f41a06ebd3bee30fbba3f43631810fa24f1bb a09547e07257ed0456f498fde1b8214152427384 CI 1634897746 +1100 commit: myfile3 +a09547e07257ed0456f498fde1b8214152427384 a6e580c7c3c4ea40bc311466d57a946bb3f77541 CI 1634897746 +1100 commit: myfile4 diff --git a/test/integration/push/expected/.git_keep/logs/refs/heads/master b/test/integration/push/expected/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..6c2301554 --- /dev/null +++ b/test/integration/push/expected/.git_keep/logs/refs/heads/master @@ -0,0 +1,4 @@ +0000000000000000000000000000000000000000 eb831bc1251f71f602159d98f4550e380007ca4f CI 1634897746 +1100 commit (initial): myfile1 +eb831bc1251f71f602159d98f4550e380007ca4f 547f41a06ebd3bee30fbba3f43631810fa24f1bb CI 1634897746 +1100 commit: myfile2 +547f41a06ebd3bee30fbba3f43631810fa24f1bb a09547e07257ed0456f498fde1b8214152427384 CI 1634897746 +1100 commit: myfile3 +a09547e07257ed0456f498fde1b8214152427384 a6e580c7c3c4ea40bc311466d57a946bb3f77541 CI 1634897746 +1100 commit: myfile4 diff --git a/test/integration/push/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/push/expected/.git_keep/logs/refs/remotes/origin/master new file mode 100644 index 000000000..a82757c78 --- /dev/null +++ b/test/integration/push/expected/.git_keep/logs/refs/remotes/origin/master @@ -0,0 +1,2 @@ +0000000000000000000000000000000000000000 547f41a06ebd3bee30fbba3f43631810fa24f1bb CI 1634897746 +1100 fetch origin: storing head +547f41a06ebd3bee30fbba3f43631810fa24f1bb a6e580c7c3c4ea40bc311466d57a946bb3f77541 CI 1634897748 +1100 update by push diff --git a/test/integration/push/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/push/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/push/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/push/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/push/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/push/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/push/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/push/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/push/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/push/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/push/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/push/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/push/expected/.git_keep/objects/54/7f41a06ebd3bee30fbba3f43631810fa24f1bb b/test/integration/push/expected/.git_keep/objects/54/7f41a06ebd3bee30fbba3f43631810fa24f1bb new file mode 100644 index 000000000..419d9ecdf Binary files /dev/null and b/test/integration/push/expected/.git_keep/objects/54/7f41a06ebd3bee30fbba3f43631810fa24f1bb differ diff --git a/test/integration/push/expected/.git_keep/objects/a0/9547e07257ed0456f498fde1b8214152427384 b/test/integration/push/expected/.git_keep/objects/a0/9547e07257ed0456f498fde1b8214152427384 new file mode 100644 index 000000000..02e8b627c --- /dev/null +++ b/test/integration/push/expected/.git_keep/objects/a0/9547e07257ed0456f498fde1b8214152427384 @@ -0,0 +1,2 @@ +xA +0E] L"BW=L:ƖAoo=y+et)lhLh3 to|#UfU &∐ wd ].@џBpSU]ڲ*`L;W \ No newline at end of file diff --git a/test/integration/push/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/push/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/push/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/push/expected/.git_keep/objects/a6/e580c7c3c4ea40bc311466d57a946bb3f77541 b/test/integration/push/expected/.git_keep/objects/a6/e580c7c3c4ea40bc311466d57a946bb3f77541 new file mode 100644 index 000000000..e50d53ba1 --- /dev/null +++ b/test/integration/push/expected/.git_keep/objects/a6/e580c7c3c4ea40bc311466d57a946bb3f77541 @@ -0,0 +1,4 @@ +xM +0@a9E$󓀈H -%^-޴t}7 +*CL@1UE8b*"O3@fR 6TʩΆc +HȁD}mpwiN.%Rʪ$~7Oڧ.#Z7 \ No newline at end of file diff --git a/test/integration/push/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/push/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/push/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/push/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/push/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/push/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/push/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/push/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/push/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/push/expected/.git_keep/objects/eb/831bc1251f71f602159d98f4550e380007ca4f b/test/integration/push/expected/.git_keep/objects/eb/831bc1251f71f602159d98f4550e380007ca4f new file mode 100644 index 000000000..4acb8b3ca --- /dev/null +++ b/test/integration/push/expected/.git_keep/objects/eb/831bc1251f71f602159d98f4550e380007ca4f @@ -0,0 +1,2 @@ +xA +0@ѮsJF<ƘL")#tyS5[ SK4f"9b'X-g"9Wa1ͣ~ޛR' ;9i'w+6, \ No newline at end of file diff --git a/test/integration/push/expected/.git_keep/refs/heads/master b/test/integration/push/expected/.git_keep/refs/heads/master new file mode 100644 index 000000000..ccbf04e76 --- /dev/null +++ b/test/integration/push/expected/.git_keep/refs/heads/master @@ -0,0 +1 @@ +a6e580c7c3c4ea40bc311466d57a946bb3f77541 diff --git a/test/integration/push/expected/.git_keep/refs/remotes/origin/master b/test/integration/push/expected/.git_keep/refs/remotes/origin/master new file mode 100644 index 000000000..ccbf04e76 --- /dev/null +++ b/test/integration/push/expected/.git_keep/refs/remotes/origin/master @@ -0,0 +1 @@ +a6e580c7c3c4ea40bc311466d57a946bb3f77541 diff --git a/test/integration/push/expected/myfile1 b/test/integration/push/expected/myfile1 new file mode 100644 index 000000000..a5bce3fd2 --- /dev/null +++ b/test/integration/push/expected/myfile1 @@ -0,0 +1 @@ +test1 diff --git a/test/integration/push/expected/myfile2 b/test/integration/push/expected/myfile2 new file mode 100644 index 000000000..180cf8328 --- /dev/null +++ b/test/integration/push/expected/myfile2 @@ -0,0 +1 @@ +test2 diff --git a/test/integration/push/expected/myfile3 b/test/integration/push/expected/myfile3 new file mode 100644 index 000000000..df6b0d2bc --- /dev/null +++ b/test/integration/push/expected/myfile3 @@ -0,0 +1 @@ +test3 diff --git a/test/integration/push/expected/myfile4 b/test/integration/push/expected/myfile4 new file mode 100644 index 000000000..d234c5e05 --- /dev/null +++ b/test/integration/push/expected/myfile4 @@ -0,0 +1 @@ +test4 diff --git a/test/integration/push/expected_remote/HEAD b/test/integration/push/expected_remote/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/push/expected_remote/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/push/expected_remote/config b/test/integration/push/expected_remote/config new file mode 100644 index 000000000..26275994b --- /dev/null +++ b/test/integration/push/expected_remote/config @@ -0,0 +1,8 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true + ignorecase = true + precomposeunicode = true +[remote "origin"] + url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/push/./actual diff --git a/test/integration/push/expected_remote/description b/test/integration/push/expected_remote/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/push/expected_remote/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/push/expected_remote/info/exclude b/test/integration/push/expected_remote/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/push/expected_remote/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/push/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/push/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/push/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/push/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/push/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/push/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/push/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/push/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/push/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/push/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/push/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/push/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/push/expected_remote/objects/54/7f41a06ebd3bee30fbba3f43631810fa24f1bb b/test/integration/push/expected_remote/objects/54/7f41a06ebd3bee30fbba3f43631810fa24f1bb new file mode 100644 index 000000000..419d9ecdf Binary files /dev/null and b/test/integration/push/expected_remote/objects/54/7f41a06ebd3bee30fbba3f43631810fa24f1bb differ diff --git a/test/integration/push/expected_remote/objects/a0/9547e07257ed0456f498fde1b8214152427384 b/test/integration/push/expected_remote/objects/a0/9547e07257ed0456f498fde1b8214152427384 new file mode 100644 index 000000000..02e8b627c --- /dev/null +++ b/test/integration/push/expected_remote/objects/a0/9547e07257ed0456f498fde1b8214152427384 @@ -0,0 +1,2 @@ +xA +0E] L"BW=L:ƖAoo=y+et)lhLh3 to|#UfU &∐ wd ].@џBpSU]ڲ*`L;W \ No newline at end of file diff --git a/test/integration/push/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/push/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/push/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/push/expected_remote/objects/a6/e580c7c3c4ea40bc311466d57a946bb3f77541 b/test/integration/push/expected_remote/objects/a6/e580c7c3c4ea40bc311466d57a946bb3f77541 new file mode 100644 index 000000000..e50d53ba1 --- /dev/null +++ b/test/integration/push/expected_remote/objects/a6/e580c7c3c4ea40bc311466d57a946bb3f77541 @@ -0,0 +1,4 @@ +xM +0@a9E$󓀈H -%^-޴t}7 +*CL@1UE8b*"O3@fR 6TʩΆc +HȁD}mpwiN.%Rʪ$~7Oڧ.#Z7 \ No newline at end of file diff --git a/test/integration/push/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/push/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/push/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/push/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/push/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/push/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/push/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/push/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/push/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/push/expected_remote/objects/eb/831bc1251f71f602159d98f4550e380007ca4f b/test/integration/push/expected_remote/objects/eb/831bc1251f71f602159d98f4550e380007ca4f new file mode 100644 index 000000000..4acb8b3ca --- /dev/null +++ b/test/integration/push/expected_remote/objects/eb/831bc1251f71f602159d98f4550e380007ca4f @@ -0,0 +1,2 @@ +xA +0@ѮsJF<ƘL")#tyS5[ SK4f"9b'X-g"9Wa1ͣ~ޛR' ;9i'w+6, \ No newline at end of file diff --git a/test/integration/push/expected_remote/packed-refs b/test/integration/push/expected_remote/packed-refs new file mode 100644 index 000000000..0c4bde9c0 --- /dev/null +++ b/test/integration/push/expected_remote/packed-refs @@ -0,0 +1,2 @@ +# pack-refs with: peeled fully-peeled sorted +547f41a06ebd3bee30fbba3f43631810fa24f1bb refs/heads/master diff --git a/test/integration/push/expected_remote/refs/heads/master b/test/integration/push/expected_remote/refs/heads/master new file mode 100644 index 000000000..ccbf04e76 --- /dev/null +++ b/test/integration/push/expected_remote/refs/heads/master @@ -0,0 +1 @@ +a6e580c7c3c4ea40bc311466d57a946bb3f77541 diff --git a/test/integration/push/recording.json b/test/integration/push/recording.json new file mode 100644 index 000000000..62b3bfb86 --- /dev/null +++ b/test/integration/push/recording.json @@ -0,0 +1 @@ +{"KeyEvents":[{"Timestamp":916,"Mod":0,"Key":256,"Ch":80},{"Timestamp":2131,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/push/setup.sh b/test/integration/push/setup.sh new file mode 100644 index 000000000..7d137b349 --- /dev/null +++ b/test/integration/push/setup.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +set -e + +cd $1 + +git init + +git config user.email "CI@example.com" +git config user.name "CI" + +echo test1 > myfile1 +git add . +git commit -am "myfile1" +echo test2 > myfile2 +git add . +git commit -am "myfile2" + +cd .. +git clone --bare ./actual actual_remote + +cd actual + +echo test3 > myfile3 +git add . +git commit -am "myfile3" +echo test4 > myfile4 +git add . +git commit -am "myfile4" + +git remote add origin ../actual_remote +git fetch origin +git branch --set-upstream-to=origin/master master diff --git a/test/integration/push/test.json b/test/integration/push/test.json new file mode 100644 index 000000000..bcf197ae6 --- /dev/null +++ b/test/integration/push/test.json @@ -0,0 +1 @@ +{ "description": "push changes to the remote", "speed": 10 } diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/COMMIT_EDITMSG b/test/integration/pushAndSetUpstream/expected/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..51be8ec3d --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +myfile4 diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/FETCH_HEAD b/test/integration/pushAndSetUpstream/expected/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..989da164a --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/.git_keep/FETCH_HEAD @@ -0,0 +1 @@ +dab77371cf53420955fc9baeb84303414f7e4a60 not-for-merge branch 'master' of ../actual_remote diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/HEAD b/test/integration/pushAndSetUpstream/expected/.git_keep/HEAD new file mode 100644 index 000000000..cea9d05ed --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/test diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/config b/test/integration/pushAndSetUpstream/expected/.git_keep/config new file mode 100644 index 000000000..7b5eaec7c --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/.git_keep/config @@ -0,0 +1,18 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[remote "origin"] + url = ../actual_remote + fetch = +refs/heads/*:refs/remotes/origin/* +[push] + default = nothing +[branch "test"] + remote = origin + merge = refs/heads/test diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/description b/test/integration/pushAndSetUpstream/expected/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/index b/test/integration/pushAndSetUpstream/expected/.git_keep/index new file mode 100644 index 000000000..b9df8bc71 Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected/.git_keep/index differ diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/info/exclude b/test/integration/pushAndSetUpstream/expected/.git_keep/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/.git_keep/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/logs/HEAD b/test/integration/pushAndSetUpstream/expected/.git_keep/logs/HEAD new file mode 100644 index 000000000..ab1e651fb --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/.git_keep/logs/HEAD @@ -0,0 +1,5 @@ +0000000000000000000000000000000000000000 65c52315dc238c164b914369f49bd70882cc1d85 CI 1634897751 +1100 commit (initial): myfile1 +65c52315dc238c164b914369f49bd70882cc1d85 dab77371cf53420955fc9baeb84303414f7e4a60 CI 1634897751 +1100 commit: myfile2 +dab77371cf53420955fc9baeb84303414f7e4a60 dbd679941d871665b7ff70fffe6116725e56e270 CI 1634897751 +1100 commit: myfile3 +dbd679941d871665b7ff70fffe6116725e56e270 707a2a0835c897496934849bf6e0815593b140b3 CI 1634897751 +1100 commit: myfile4 +707a2a0835c897496934849bf6e0815593b140b3 707a2a0835c897496934849bf6e0815593b140b3 CI 1634897753 +1100 checkout: moving from master to test diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/logs/refs/heads/master b/test/integration/pushAndSetUpstream/expected/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..0efb79581 --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/.git_keep/logs/refs/heads/master @@ -0,0 +1,4 @@ +0000000000000000000000000000000000000000 65c52315dc238c164b914369f49bd70882cc1d85 CI 1634897751 +1100 commit (initial): myfile1 +65c52315dc238c164b914369f49bd70882cc1d85 dab77371cf53420955fc9baeb84303414f7e4a60 CI 1634897751 +1100 commit: myfile2 +dab77371cf53420955fc9baeb84303414f7e4a60 dbd679941d871665b7ff70fffe6116725e56e270 CI 1634897751 +1100 commit: myfile3 +dbd679941d871665b7ff70fffe6116725e56e270 707a2a0835c897496934849bf6e0815593b140b3 CI 1634897751 +1100 commit: myfile4 diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/logs/refs/heads/test b/test/integration/pushAndSetUpstream/expected/.git_keep/logs/refs/heads/test new file mode 100644 index 000000000..c22f24f3c --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/.git_keep/logs/refs/heads/test @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 707a2a0835c897496934849bf6e0815593b140b3 CI 1634897753 +1100 branch: Created from master diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/pushAndSetUpstream/expected/.git_keep/logs/refs/remotes/origin/master new file mode 100644 index 000000000..2b03e0efd --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/.git_keep/logs/refs/remotes/origin/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 dab77371cf53420955fc9baeb84303414f7e4a60 CI 1634897751 +1100 fetch origin: storing head diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/logs/refs/remotes/origin/test b/test/integration/pushAndSetUpstream/expected/.git_keep/logs/refs/remotes/origin/test new file mode 100644 index 000000000..1e7209170 --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/.git_keep/logs/refs/remotes/origin/test @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 707a2a0835c897496934849bf6e0815593b140b3 CI 1634897754 +1100 update by push diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/objects/65/c52315dc238c164b914369f49bd70882cc1d85 b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/65/c52315dc238c164b914369f49bd70882cc1d85 new file mode 100644 index 000000000..9f235e0ed Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/65/c52315dc238c164b914369f49bd70882cc1d85 differ diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/objects/70/7a2a0835c897496934849bf6e0815593b140b3 b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/70/7a2a0835c897496934849bf6e0815593b140b3 new file mode 100644 index 000000000..3556acfa5 Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/70/7a2a0835c897496934849bf6e0815593b140b3 differ diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/objects/da/b77371cf53420955fc9baeb84303414f7e4a60 b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/da/b77371cf53420955fc9baeb84303414f7e4a60 new file mode 100644 index 000000000..fd638ab15 Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/da/b77371cf53420955fc9baeb84303414f7e4a60 differ diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/objects/db/d679941d871665b7ff70fffe6116725e56e270 b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/db/d679941d871665b7ff70fffe6116725e56e270 new file mode 100644 index 000000000..49cc241d7 Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/db/d679941d871665b7ff70fffe6116725e56e270 differ diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/refs/heads/master b/test/integration/pushAndSetUpstream/expected/.git_keep/refs/heads/master new file mode 100644 index 000000000..683d3d319 --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/.git_keep/refs/heads/master @@ -0,0 +1 @@ +707a2a0835c897496934849bf6e0815593b140b3 diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/refs/heads/test b/test/integration/pushAndSetUpstream/expected/.git_keep/refs/heads/test new file mode 100644 index 000000000..683d3d319 --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/.git_keep/refs/heads/test @@ -0,0 +1 @@ +707a2a0835c897496934849bf6e0815593b140b3 diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/refs/remotes/origin/master b/test/integration/pushAndSetUpstream/expected/.git_keep/refs/remotes/origin/master new file mode 100644 index 000000000..874cd1689 --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/.git_keep/refs/remotes/origin/master @@ -0,0 +1 @@ +dab77371cf53420955fc9baeb84303414f7e4a60 diff --git a/test/integration/pushAndSetUpstream/expected/.git_keep/refs/remotes/origin/test b/test/integration/pushAndSetUpstream/expected/.git_keep/refs/remotes/origin/test new file mode 100644 index 000000000..683d3d319 --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/.git_keep/refs/remotes/origin/test @@ -0,0 +1 @@ +707a2a0835c897496934849bf6e0815593b140b3 diff --git a/test/integration/pushAndSetUpstream/expected/myfile1 b/test/integration/pushAndSetUpstream/expected/myfile1 new file mode 100644 index 000000000..a5bce3fd2 --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/myfile1 @@ -0,0 +1 @@ +test1 diff --git a/test/integration/pushAndSetUpstream/expected/myfile2 b/test/integration/pushAndSetUpstream/expected/myfile2 new file mode 100644 index 000000000..180cf8328 --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/myfile2 @@ -0,0 +1 @@ +test2 diff --git a/test/integration/pushAndSetUpstream/expected/myfile3 b/test/integration/pushAndSetUpstream/expected/myfile3 new file mode 100644 index 000000000..df6b0d2bc --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/myfile3 @@ -0,0 +1 @@ +test3 diff --git a/test/integration/pushAndSetUpstream/expected/myfile4 b/test/integration/pushAndSetUpstream/expected/myfile4 new file mode 100644 index 000000000..d234c5e05 --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected/myfile4 @@ -0,0 +1 @@ +test4 diff --git a/test/integration/pushAndSetUpstream/expected_remote/HEAD b/test/integration/pushAndSetUpstream/expected_remote/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected_remote/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pushAndSetUpstream/expected_remote/config b/test/integration/pushAndSetUpstream/expected_remote/config new file mode 100644 index 000000000..de756510f --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected_remote/config @@ -0,0 +1,8 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true + ignorecase = true + precomposeunicode = true +[remote "origin"] + url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/pushAndSetUpstream/./actual diff --git a/test/integration/pushAndSetUpstream/expected_remote/description b/test/integration/pushAndSetUpstream/expected_remote/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected_remote/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pushAndSetUpstream/expected_remote/info/exclude b/test/integration/pushAndSetUpstream/expected_remote/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected_remote/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pushAndSetUpstream/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pushAndSetUpstream/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pushAndSetUpstream/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pushAndSetUpstream/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pushAndSetUpstream/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pushAndSetUpstream/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pushAndSetUpstream/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pushAndSetUpstream/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pushAndSetUpstream/expected_remote/objects/65/c52315dc238c164b914369f49bd70882cc1d85 b/test/integration/pushAndSetUpstream/expected_remote/objects/65/c52315dc238c164b914369f49bd70882cc1d85 new file mode 100644 index 000000000..9f235e0ed Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected_remote/objects/65/c52315dc238c164b914369f49bd70882cc1d85 differ diff --git a/test/integration/pushAndSetUpstream/expected_remote/objects/70/7a2a0835c897496934849bf6e0815593b140b3 b/test/integration/pushAndSetUpstream/expected_remote/objects/70/7a2a0835c897496934849bf6e0815593b140b3 new file mode 100644 index 000000000..3556acfa5 Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected_remote/objects/70/7a2a0835c897496934849bf6e0815593b140b3 differ diff --git a/test/integration/pushAndSetUpstream/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pushAndSetUpstream/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pushAndSetUpstream/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pushAndSetUpstream/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pushAndSetUpstream/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/pushAndSetUpstream/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/pushAndSetUpstream/expected_remote/objects/da/b77371cf53420955fc9baeb84303414f7e4a60 b/test/integration/pushAndSetUpstream/expected_remote/objects/da/b77371cf53420955fc9baeb84303414f7e4a60 new file mode 100644 index 000000000..fd638ab15 Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected_remote/objects/da/b77371cf53420955fc9baeb84303414f7e4a60 differ diff --git a/test/integration/pushAndSetUpstream/expected_remote/objects/db/d679941d871665b7ff70fffe6116725e56e270 b/test/integration/pushAndSetUpstream/expected_remote/objects/db/d679941d871665b7ff70fffe6116725e56e270 new file mode 100644 index 000000000..49cc241d7 Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected_remote/objects/db/d679941d871665b7ff70fffe6116725e56e270 differ diff --git a/test/integration/pushAndSetUpstream/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pushAndSetUpstream/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pushAndSetUpstream/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pushAndSetUpstream/expected_remote/packed-refs b/test/integration/pushAndSetUpstream/expected_remote/packed-refs new file mode 100644 index 000000000..8271e61c9 --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected_remote/packed-refs @@ -0,0 +1,2 @@ +# pack-refs with: peeled fully-peeled sorted +dab77371cf53420955fc9baeb84303414f7e4a60 refs/heads/master diff --git a/test/integration/pushAndSetUpstream/expected_remote/refs/heads/test b/test/integration/pushAndSetUpstream/expected_remote/refs/heads/test new file mode 100644 index 000000000..683d3d319 --- /dev/null +++ b/test/integration/pushAndSetUpstream/expected_remote/refs/heads/test @@ -0,0 +1 @@ +707a2a0835c897496934849bf6e0815593b140b3 diff --git a/test/integration/pushAndSetUpstream/recording.json b/test/integration/pushAndSetUpstream/recording.json new file mode 100644 index 000000000..6b209be21 --- /dev/null +++ b/test/integration/pushAndSetUpstream/recording.json @@ -0,0 +1 @@ +{"KeyEvents":[{"Timestamp":519,"Mod":0,"Key":259,"Ch":0},{"Timestamp":1101,"Mod":0,"Key":256,"Ch":110},{"Timestamp":1286,"Mod":0,"Key":256,"Ch":116},{"Timestamp":1382,"Mod":0,"Key":256,"Ch":101},{"Timestamp":1574,"Mod":0,"Key":256,"Ch":115},{"Timestamp":1613,"Mod":0,"Key":256,"Ch":116},{"Timestamp":1814,"Mod":0,"Key":13,"Ch":13},{"Timestamp":2430,"Mod":0,"Key":256,"Ch":80},{"Timestamp":2910,"Mod":0,"Key":13,"Ch":13},{"Timestamp":4149,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/pushAndSetUpstream/setup.sh b/test/integration/pushAndSetUpstream/setup.sh new file mode 100644 index 000000000..2911a073c --- /dev/null +++ b/test/integration/pushAndSetUpstream/setup.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +set -e + +cd $1 + +git init + +git config user.email "CI@example.com" +git config user.name "CI" + +echo test1 > myfile1 +git add . +git commit -am "myfile1" +echo test2 > myfile2 +git add . +git commit -am "myfile2" + +cd .. +git clone --bare ./actual actual_remote + +cd actual + +echo test3 > myfile3 +git add . +git commit -am "myfile3" +echo test4 > myfile4 +git add . +git commit -am "myfile4" + +git remote add origin ../actual_remote +git fetch origin +git config push.default nothing diff --git a/test/integration/pushAndSetUpstream/test.json b/test/integration/pushAndSetUpstream/test.json new file mode 100644 index 000000000..f417f0ee5 --- /dev/null +++ b/test/integration/pushAndSetUpstream/test.json @@ -0,0 +1 @@ +{ "description": "push changes to the remote, setting upstream", "speed": 10 } diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/COMMIT_EDITMSG b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..51be8ec3d --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +myfile4 diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/FETCH_HEAD b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..adf0b729b --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/FETCH_HEAD @@ -0,0 +1 @@ +dc7117cc68b23798cabb2c388a45036da33c2f10 not-for-merge branch 'master' of ../actual_remote diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/HEAD b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/HEAD new file mode 100644 index 000000000..cea9d05ed --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/test diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/config b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/config new file mode 100644 index 000000000..ec0727bec --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/config @@ -0,0 +1,18 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[remote "origin"] + url = ../actual_remote + fetch = +refs/heads/*:refs/remotes/origin/* +[push] + default = current +[branch "test"] + remote = origin + merge = refs/heads/test diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/description b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/index b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/index new file mode 100644 index 000000000..6bf05e8bb Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/index differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/info/exclude b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/logs/HEAD b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/logs/HEAD new file mode 100644 index 000000000..734f642ab --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/logs/HEAD @@ -0,0 +1,5 @@ +0000000000000000000000000000000000000000 d0e2575d4cdf78f6845db57439c7b526d02dbc7d CI 1634897757 +1100 commit (initial): myfile1 +d0e2575d4cdf78f6845db57439c7b526d02dbc7d dc7117cc68b23798cabb2c388a45036da33c2f10 CI 1634897757 +1100 commit: myfile2 +dc7117cc68b23798cabb2c388a45036da33c2f10 6552acdbb2da7b153b78bbd9f6a564a54fce1ed9 CI 1634897757 +1100 commit: myfile3 +6552acdbb2da7b153b78bbd9f6a564a54fce1ed9 2d0011f18dcd00e21fd13ede01792048ccd09e85 CI 1634897757 +1100 commit: myfile4 +2d0011f18dcd00e21fd13ede01792048ccd09e85 2d0011f18dcd00e21fd13ede01792048ccd09e85 CI 1634897760 +1100 checkout: moving from master to test diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/logs/refs/heads/master b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..00e298ce4 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/logs/refs/heads/master @@ -0,0 +1,4 @@ +0000000000000000000000000000000000000000 d0e2575d4cdf78f6845db57439c7b526d02dbc7d CI 1634897757 +1100 commit (initial): myfile1 +d0e2575d4cdf78f6845db57439c7b526d02dbc7d dc7117cc68b23798cabb2c388a45036da33c2f10 CI 1634897757 +1100 commit: myfile2 +dc7117cc68b23798cabb2c388a45036da33c2f10 6552acdbb2da7b153b78bbd9f6a564a54fce1ed9 CI 1634897757 +1100 commit: myfile3 +6552acdbb2da7b153b78bbd9f6a564a54fce1ed9 2d0011f18dcd00e21fd13ede01792048ccd09e85 CI 1634897757 +1100 commit: myfile4 diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/logs/refs/heads/test b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/logs/refs/heads/test new file mode 100644 index 000000000..26a649f81 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/logs/refs/heads/test @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 2d0011f18dcd00e21fd13ede01792048ccd09e85 CI 1634897760 +1100 branch: Created from master diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/logs/refs/remotes/origin/master new file mode 100644 index 000000000..63ed3051f --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/logs/refs/remotes/origin/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 dc7117cc68b23798cabb2c388a45036da33c2f10 CI 1634897757 +1100 fetch origin: storing head diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/logs/refs/remotes/origin/test b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/logs/refs/remotes/origin/test new file mode 100644 index 000000000..8b11b4981 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/logs/refs/remotes/origin/test @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 2d0011f18dcd00e21fd13ede01792048ccd09e85 CI 1634897761 +1100 update by push diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/2d/0011f18dcd00e21fd13ede01792048ccd09e85 b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/2d/0011f18dcd00e21fd13ede01792048ccd09e85 new file mode 100644 index 000000000..3b028eaf7 Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/2d/0011f18dcd00e21fd13ede01792048ccd09e85 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/65/52acdbb2da7b153b78bbd9f6a564a54fce1ed9 b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/65/52acdbb2da7b153b78bbd9f6a564a54fce1ed9 new file mode 100644 index 000000000..5e637927f Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/65/52acdbb2da7b153b78bbd9f6a564a54fce1ed9 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/d0/e2575d4cdf78f6845db57439c7b526d02dbc7d b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/d0/e2575d4cdf78f6845db57439c7b526d02dbc7d new file mode 100644 index 000000000..d93d894fa --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/d0/e2575d4cdf78f6845db57439c7b526d02dbc7d @@ -0,0 +1,2 @@ +xA +0@ѮsJFǙ\yL#tyS5[ S5d"9`-gйnz4}ozKSE+ٷ7,, \ No newline at end of file diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/dc/7117cc68b23798cabb2c388a45036da33c2f10 b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/dc/7117cc68b23798cabb2c388a45036da33c2f10 new file mode 100644 index 000000000..bd9a3df16 Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/dc/7117cc68b23798cabb2c388a45036da33c2f10 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/refs/heads/master b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/refs/heads/master new file mode 100644 index 000000000..fcd0d8e35 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/refs/heads/master @@ -0,0 +1 @@ +2d0011f18dcd00e21fd13ede01792048ccd09e85 diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/refs/heads/test b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/refs/heads/test new file mode 100644 index 000000000..fcd0d8e35 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/refs/heads/test @@ -0,0 +1 @@ +2d0011f18dcd00e21fd13ede01792048ccd09e85 diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/refs/remotes/origin/master b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/refs/remotes/origin/master new file mode 100644 index 000000000..caea74126 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/refs/remotes/origin/master @@ -0,0 +1 @@ +dc7117cc68b23798cabb2c388a45036da33c2f10 diff --git a/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/refs/remotes/origin/test b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/refs/remotes/origin/test new file mode 100644 index 000000000..fcd0d8e35 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/.git_keep/refs/remotes/origin/test @@ -0,0 +1 @@ +2d0011f18dcd00e21fd13ede01792048ccd09e85 diff --git a/test/integration/pushAndSetUpstreamDefault/expected/myfile1 b/test/integration/pushAndSetUpstreamDefault/expected/myfile1 new file mode 100644 index 000000000..a5bce3fd2 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/myfile1 @@ -0,0 +1 @@ +test1 diff --git a/test/integration/pushAndSetUpstreamDefault/expected/myfile2 b/test/integration/pushAndSetUpstreamDefault/expected/myfile2 new file mode 100644 index 000000000..180cf8328 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/myfile2 @@ -0,0 +1 @@ +test2 diff --git a/test/integration/pushAndSetUpstreamDefault/expected/myfile3 b/test/integration/pushAndSetUpstreamDefault/expected/myfile3 new file mode 100644 index 000000000..df6b0d2bc --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/myfile3 @@ -0,0 +1 @@ +test3 diff --git a/test/integration/pushAndSetUpstreamDefault/expected/myfile4 b/test/integration/pushAndSetUpstreamDefault/expected/myfile4 new file mode 100644 index 000000000..d234c5e05 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected/myfile4 @@ -0,0 +1 @@ +test4 diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/HEAD b/test/integration/pushAndSetUpstreamDefault/expected_remote/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected_remote/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/config b/test/integration/pushAndSetUpstreamDefault/expected_remote/config new file mode 100644 index 000000000..5f4aec3f4 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected_remote/config @@ -0,0 +1,8 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true + ignorecase = true + precomposeunicode = true +[remote "origin"] + url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/pushAndSetUpstreamDefault/./actual diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/description b/test/integration/pushAndSetUpstreamDefault/expected_remote/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected_remote/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/info/exclude b/test/integration/pushAndSetUpstreamDefault/expected_remote/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected_remote/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/2d/0011f18dcd00e21fd13ede01792048ccd09e85 b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/2d/0011f18dcd00e21fd13ede01792048ccd09e85 new file mode 100644 index 000000000..3b028eaf7 Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/2d/0011f18dcd00e21fd13ede01792048ccd09e85 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 new file mode 100644 index 000000000..31ae3f5ba Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/2f/6174050380438f14b16658a356e762435ca591 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/65/52acdbb2da7b153b78bbd9f6a564a54fce1ed9 b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/65/52acdbb2da7b153b78bbd9f6a564a54fce1ed9 new file mode 100644 index 000000000..5e637927f Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/65/52acdbb2da7b153b78bbd9f6a564a54fce1ed9 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/d0/e2575d4cdf78f6845db57439c7b526d02dbc7d b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/d0/e2575d4cdf78f6845db57439c7b526d02dbc7d new file mode 100644 index 000000000..d93d894fa --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/d0/e2575d4cdf78f6845db57439c7b526d02dbc7d @@ -0,0 +1,2 @@ +xA +0@ѮsJFǙ\yL#tyS5[ S5d"9`-gйnz4}ozKSE+ٷ7,, \ No newline at end of file diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/dc/7117cc68b23798cabb2c388a45036da33c2f10 b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/dc/7117cc68b23798cabb2c388a45036da33c2f10 new file mode 100644 index 000000000..bd9a3df16 Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/dc/7117cc68b23798cabb2c388a45036da33c2f10 differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pushAndSetUpstreamDefault/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/packed-refs b/test/integration/pushAndSetUpstreamDefault/expected_remote/packed-refs new file mode 100644 index 000000000..aadce3af8 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected_remote/packed-refs @@ -0,0 +1,2 @@ +# pack-refs with: peeled fully-peeled sorted +dc7117cc68b23798cabb2c388a45036da33c2f10 refs/heads/master diff --git a/test/integration/pushAndSetUpstreamDefault/expected_remote/refs/heads/test b/test/integration/pushAndSetUpstreamDefault/expected_remote/refs/heads/test new file mode 100644 index 000000000..fcd0d8e35 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/expected_remote/refs/heads/test @@ -0,0 +1 @@ +2d0011f18dcd00e21fd13ede01792048ccd09e85 diff --git a/test/integration/pushAndSetUpstreamDefault/recording.json b/test/integration/pushAndSetUpstreamDefault/recording.json new file mode 100644 index 000000000..f3e4e79b1 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/recording.json @@ -0,0 +1 @@ +{"KeyEvents":[{"Timestamp":1523,"Mod":0,"Key":259,"Ch":0},{"Timestamp":1953,"Mod":0,"Key":256,"Ch":110},{"Timestamp":2224,"Mod":0,"Key":256,"Ch":116},{"Timestamp":2289,"Mod":0,"Key":256,"Ch":101},{"Timestamp":2432,"Mod":0,"Key":256,"Ch":115},{"Timestamp":2455,"Mod":0,"Key":256,"Ch":116},{"Timestamp":2633,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3369,"Mod":0,"Key":256,"Ch":80},{"Timestamp":4464,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/pushAndSetUpstreamDefault/setup.sh b/test/integration/pushAndSetUpstreamDefault/setup.sh new file mode 100644 index 000000000..d12f985f6 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/setup.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +set -e + +cd $1 + +git init + +git config user.email "CI@example.com" +git config user.name "CI" + +echo test1 > myfile1 +git add . +git commit -am "myfile1" +echo test2 > myfile2 +git add . +git commit -am "myfile2" + +cd .. +git clone --bare ./actual actual_remote + +cd actual + +echo test3 > myfile3 +git add . +git commit -am "myfile3" +echo test4 > myfile4 +git add . +git commit -am "myfile4" + +git remote add origin ../actual_remote +git fetch origin +git config push.default current diff --git a/test/integration/pushAndSetUpstreamDefault/test.json b/test/integration/pushAndSetUpstreamDefault/test.json new file mode 100644 index 000000000..5b9f43bd3 --- /dev/null +++ b/test/integration/pushAndSetUpstreamDefault/test.json @@ -0,0 +1 @@ +{ "description": "push changes to the remote, setting upstream automatically based on config", "speed": 10 } diff --git a/test/integration/pushFollowTags/expected/.git_keep/COMMIT_EDITMSG b/test/integration/pushFollowTags/expected/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..c23aa0355 --- /dev/null +++ b/test/integration/pushFollowTags/expected/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +myfile3 diff --git a/test/integration/pushFollowTags/expected/.git_keep/FETCH_HEAD b/test/integration/pushFollowTags/expected/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..eb26084cc --- /dev/null +++ b/test/integration/pushFollowTags/expected/.git_keep/FETCH_HEAD @@ -0,0 +1 @@ +d0d3bfe09c1a5a9631f3041a184d6b9c6d927c83 branch 'master' of ../actual_remote diff --git a/test/integration/pushFollowTags/expected/.git_keep/HEAD b/test/integration/pushFollowTags/expected/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pushFollowTags/expected/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pushFollowTags/expected/.git_keep/config b/test/integration/pushFollowTags/expected/.git_keep/config new file mode 100644 index 000000000..190f2591c --- /dev/null +++ b/test/integration/pushFollowTags/expected/.git_keep/config @@ -0,0 +1,18 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[remote "origin"] + url = ../actual_remote + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master +[push] + followTags = true diff --git a/test/integration/pushFollowTags/expected/.git_keep/description b/test/integration/pushFollowTags/expected/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pushFollowTags/expected/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pushFollowTags/expected/.git_keep/index b/test/integration/pushFollowTags/expected/.git_keep/index new file mode 100644 index 000000000..f23548c75 Binary files /dev/null and b/test/integration/pushFollowTags/expected/.git_keep/index differ diff --git a/test/integration/pushFollowTags/expected/.git_keep/info/exclude b/test/integration/pushFollowTags/expected/.git_keep/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pushFollowTags/expected/.git_keep/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pushFollowTags/expected/.git_keep/logs/HEAD b/test/integration/pushFollowTags/expected/.git_keep/logs/HEAD new file mode 100644 index 000000000..263e15735 --- /dev/null +++ b/test/integration/pushFollowTags/expected/.git_keep/logs/HEAD @@ -0,0 +1,3 @@ +0000000000000000000000000000000000000000 f27af92910b10e6ddf592fae975337355579464b CI 1634944096 +1100 commit (initial): myfile1 +f27af92910b10e6ddf592fae975337355579464b d0d3bfe09c1a5a9631f3041a184d6b9c6d927c83 CI 1634944096 +1100 commit: myfile2 +d0d3bfe09c1a5a9631f3041a184d6b9c6d927c83 aea6b2960cc3e7a2453ce3490ca09d090d7ce223 CI 1634944096 +1100 commit: myfile3 diff --git a/test/integration/pushFollowTags/expected/.git_keep/logs/refs/heads/master b/test/integration/pushFollowTags/expected/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..263e15735 --- /dev/null +++ b/test/integration/pushFollowTags/expected/.git_keep/logs/refs/heads/master @@ -0,0 +1,3 @@ +0000000000000000000000000000000000000000 f27af92910b10e6ddf592fae975337355579464b CI 1634944096 +1100 commit (initial): myfile1 +f27af92910b10e6ddf592fae975337355579464b d0d3bfe09c1a5a9631f3041a184d6b9c6d927c83 CI 1634944096 +1100 commit: myfile2 +d0d3bfe09c1a5a9631f3041a184d6b9c6d927c83 aea6b2960cc3e7a2453ce3490ca09d090d7ce223 CI 1634944096 +1100 commit: myfile3 diff --git a/test/integration/pushFollowTags/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/pushFollowTags/expected/.git_keep/logs/refs/remotes/origin/master new file mode 100644 index 000000000..36306f3d0 --- /dev/null +++ b/test/integration/pushFollowTags/expected/.git_keep/logs/refs/remotes/origin/master @@ -0,0 +1,2 @@ +0000000000000000000000000000000000000000 d0d3bfe09c1a5a9631f3041a184d6b9c6d927c83 CI 1634944096 +1100 fetch origin: storing head +d0d3bfe09c1a5a9631f3041a184d6b9c6d927c83 aea6b2960cc3e7a2453ce3490ca09d090d7ce223 CI 1634944097 +1100 update by push diff --git a/test/integration/pushFollowTags/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pushFollowTags/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pushFollowTags/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pushFollowTags/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pushFollowTags/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pushFollowTags/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pushFollowTags/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pushFollowTags/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pushFollowTags/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pushFollowTags/expected/.git_keep/objects/34/10e6811881ccede9ff762c875f9b99a3e6eaef b/test/integration/pushFollowTags/expected/.git_keep/objects/34/10e6811881ccede9ff762c875f9b99a3e6eaef new file mode 100644 index 000000000..63ae5ead6 Binary files /dev/null and b/test/integration/pushFollowTags/expected/.git_keep/objects/34/10e6811881ccede9ff762c875f9b99a3e6eaef differ diff --git a/test/integration/pushFollowTags/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pushFollowTags/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pushFollowTags/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pushFollowTags/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pushFollowTags/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pushFollowTags/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pushFollowTags/expected/.git_keep/objects/ae/a6b2960cc3e7a2453ce3490ca09d090d7ce223 b/test/integration/pushFollowTags/expected/.git_keep/objects/ae/a6b2960cc3e7a2453ce3490ca09d090d7ce223 new file mode 100644 index 000000000..23f4eb7e8 Binary files /dev/null and b/test/integration/pushFollowTags/expected/.git_keep/objects/ae/a6b2960cc3e7a2453ce3490ca09d090d7ce223 differ diff --git a/test/integration/pushFollowTags/expected/.git_keep/objects/d0/d3bfe09c1a5a9631f3041a184d6b9c6d927c83 b/test/integration/pushFollowTags/expected/.git_keep/objects/d0/d3bfe09c1a5a9631f3041a184d6b9c6d927c83 new file mode 100644 index 000000000..dbbef8c24 --- /dev/null +++ b/test/integration/pushFollowTags/expected/.git_keep/objects/d0/d3bfe09c1a5a9631f3041a184d6b9c6d927c83 @@ -0,0 +1,4 @@ +xA +0@Q9Ed#ifR"~Okksx껈) jQ&b-ꉪũG ]^ݪOY3NV5 B +1HXL~aa|'m˴ +Ȉɞ3G=M꼈7?S9 \ No newline at end of file diff --git a/test/integration/pushFollowTags/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pushFollowTags/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pushFollowTags/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pushFollowTags/expected/.git_keep/objects/f2/7af92910b10e6ddf592fae975337355579464b b/test/integration/pushFollowTags/expected/.git_keep/objects/f2/7af92910b10e6ddf592fae975337355579464b new file mode 100644 index 000000000..b2353a7c3 --- /dev/null +++ b/test/integration/pushFollowTags/expected/.git_keep/objects/f2/7af92910b10e6ddf592fae975337355579464b @@ -0,0 +1,2 @@ +xA +0@ѮsʌNJ\yL")#tyS5[˥*`e3쩋T^%{⧽ i-U{Iρѝ4;uSr3m, \ No newline at end of file diff --git a/test/integration/pushFollowTags/expected/.git_keep/refs/heads/master b/test/integration/pushFollowTags/expected/.git_keep/refs/heads/master new file mode 100644 index 000000000..04b4caa25 --- /dev/null +++ b/test/integration/pushFollowTags/expected/.git_keep/refs/heads/master @@ -0,0 +1 @@ +aea6b2960cc3e7a2453ce3490ca09d090d7ce223 diff --git a/test/integration/pushFollowTags/expected/.git_keep/refs/remotes/origin/master b/test/integration/pushFollowTags/expected/.git_keep/refs/remotes/origin/master new file mode 100644 index 000000000..04b4caa25 --- /dev/null +++ b/test/integration/pushFollowTags/expected/.git_keep/refs/remotes/origin/master @@ -0,0 +1 @@ +aea6b2960cc3e7a2453ce3490ca09d090d7ce223 diff --git a/test/integration/pushFollowTags/expected/.git_keep/refs/tags/v1.0 b/test/integration/pushFollowTags/expected/.git_keep/refs/tags/v1.0 new file mode 100644 index 000000000..9e7dd44c2 --- /dev/null +++ b/test/integration/pushFollowTags/expected/.git_keep/refs/tags/v1.0 @@ -0,0 +1 @@ +3410e6811881ccede9ff762c875f9b99a3e6eaef diff --git a/test/integration/pushFollowTags/expected/myfile1 b/test/integration/pushFollowTags/expected/myfile1 new file mode 100644 index 000000000..a5bce3fd2 --- /dev/null +++ b/test/integration/pushFollowTags/expected/myfile1 @@ -0,0 +1 @@ +test1 diff --git a/test/integration/pushFollowTags/expected/myfile2 b/test/integration/pushFollowTags/expected/myfile2 new file mode 100644 index 000000000..180cf8328 --- /dev/null +++ b/test/integration/pushFollowTags/expected/myfile2 @@ -0,0 +1 @@ +test2 diff --git a/test/integration/pushFollowTags/expected/myfile3 b/test/integration/pushFollowTags/expected/myfile3 new file mode 100644 index 000000000..df6b0d2bc --- /dev/null +++ b/test/integration/pushFollowTags/expected/myfile3 @@ -0,0 +1 @@ +test3 diff --git a/test/integration/pushFollowTags/expected_remote/HEAD b/test/integration/pushFollowTags/expected_remote/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pushFollowTags/expected_remote/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pushFollowTags/expected_remote/config b/test/integration/pushFollowTags/expected_remote/config new file mode 100644 index 000000000..a23b4ec0a --- /dev/null +++ b/test/integration/pushFollowTags/expected_remote/config @@ -0,0 +1,8 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true + ignorecase = true + precomposeunicode = true +[remote "origin"] + url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/pushFollowTags/./actual diff --git a/test/integration/pushFollowTags/expected_remote/description b/test/integration/pushFollowTags/expected_remote/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pushFollowTags/expected_remote/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pushFollowTags/expected_remote/info/exclude b/test/integration/pushFollowTags/expected_remote/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pushFollowTags/expected_remote/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pushFollowTags/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pushFollowTags/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pushFollowTags/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pushFollowTags/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pushFollowTags/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pushFollowTags/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pushFollowTags/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pushFollowTags/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pushFollowTags/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pushFollowTags/expected_remote/objects/34/10e6811881ccede9ff762c875f9b99a3e6eaef b/test/integration/pushFollowTags/expected_remote/objects/34/10e6811881ccede9ff762c875f9b99a3e6eaef new file mode 100644 index 000000000..63ae5ead6 Binary files /dev/null and b/test/integration/pushFollowTags/expected_remote/objects/34/10e6811881ccede9ff762c875f9b99a3e6eaef differ diff --git a/test/integration/pushFollowTags/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pushFollowTags/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pushFollowTags/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pushFollowTags/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pushFollowTags/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pushFollowTags/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pushFollowTags/expected_remote/objects/ae/a6b2960cc3e7a2453ce3490ca09d090d7ce223 b/test/integration/pushFollowTags/expected_remote/objects/ae/a6b2960cc3e7a2453ce3490ca09d090d7ce223 new file mode 100644 index 000000000..23f4eb7e8 Binary files /dev/null and b/test/integration/pushFollowTags/expected_remote/objects/ae/a6b2960cc3e7a2453ce3490ca09d090d7ce223 differ diff --git a/test/integration/pushFollowTags/expected_remote/objects/d0/d3bfe09c1a5a9631f3041a184d6b9c6d927c83 b/test/integration/pushFollowTags/expected_remote/objects/d0/d3bfe09c1a5a9631f3041a184d6b9c6d927c83 new file mode 100644 index 000000000..dbbef8c24 --- /dev/null +++ b/test/integration/pushFollowTags/expected_remote/objects/d0/d3bfe09c1a5a9631f3041a184d6b9c6d927c83 @@ -0,0 +1,4 @@ +xA +0@Q9Ed#ifR"~Okksx껈) jQ&b-ꉪũG ]^ݪOY3NV5 B +1HXL~aa|'m˴ +Ȉɞ3G=M꼈7?S9 \ No newline at end of file diff --git a/test/integration/pushFollowTags/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pushFollowTags/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pushFollowTags/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pushFollowTags/expected_remote/objects/f2/7af92910b10e6ddf592fae975337355579464b b/test/integration/pushFollowTags/expected_remote/objects/f2/7af92910b10e6ddf592fae975337355579464b new file mode 100644 index 000000000..b2353a7c3 --- /dev/null +++ b/test/integration/pushFollowTags/expected_remote/objects/f2/7af92910b10e6ddf592fae975337355579464b @@ -0,0 +1,2 @@ +xA +0@ѮsʌNJ\yL")#tyS5[˥*`e3쩋T^%{⧽ i-U{Iρѝ4;uSr3m, \ No newline at end of file diff --git a/test/integration/pushFollowTags/expected_remote/packed-refs b/test/integration/pushFollowTags/expected_remote/packed-refs new file mode 100644 index 000000000..51ac4766d --- /dev/null +++ b/test/integration/pushFollowTags/expected_remote/packed-refs @@ -0,0 +1,2 @@ +# pack-refs with: peeled fully-peeled sorted +d0d3bfe09c1a5a9631f3041a184d6b9c6d927c83 refs/heads/master diff --git a/test/integration/pushFollowTags/expected_remote/refs/heads/master b/test/integration/pushFollowTags/expected_remote/refs/heads/master new file mode 100644 index 000000000..04b4caa25 --- /dev/null +++ b/test/integration/pushFollowTags/expected_remote/refs/heads/master @@ -0,0 +1 @@ +aea6b2960cc3e7a2453ce3490ca09d090d7ce223 diff --git a/test/integration/pushFollowTags/expected_remote/refs/tags/v1.0 b/test/integration/pushFollowTags/expected_remote/refs/tags/v1.0 new file mode 100644 index 000000000..9e7dd44c2 --- /dev/null +++ b/test/integration/pushFollowTags/expected_remote/refs/tags/v1.0 @@ -0,0 +1 @@ +3410e6811881ccede9ff762c875f9b99a3e6eaef diff --git a/test/integration/pushFollowTags/recording.json b/test/integration/pushFollowTags/recording.json new file mode 100644 index 000000000..43fd3fa5b --- /dev/null +++ b/test/integration/pushFollowTags/recording.json @@ -0,0 +1 @@ +{"KeyEvents":[{"Timestamp":682,"Mod":0,"Key":256,"Ch":80},{"Timestamp":1641,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/pushFollowTags/setup.sh b/test/integration/pushFollowTags/setup.sh new file mode 100644 index 000000000..2da0cbf18 --- /dev/null +++ b/test/integration/pushFollowTags/setup.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +set -e + +cd $1 + +git init + +git config user.email "CI@example.com" +git config user.name "CI" + +echo test1 > myfile1 +git add . +git commit -am "myfile1" +echo test2 > myfile2 +git add . +git commit -am "myfile2" + +cd .. +git clone --bare ./actual actual_remote + +cd actual + +echo test3 > myfile3 +git add . +git commit -am "myfile3" + +git remote add origin ../actual_remote +git fetch origin +git branch --set-upstream-to=origin/master master +git config push.followTags true +git tag -a v1.0 -m "my version 1.0" diff --git a/test/integration/pushFollowTags/test.json b/test/integration/pushFollowTags/test.json new file mode 100644 index 000000000..1c8b13c9f --- /dev/null +++ b/test/integration/pushFollowTags/test.json @@ -0,0 +1 @@ +{ "description": "push changes to the remote, when --follow-tags is configured", "speed": 10 } diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/COMMIT_EDITMSG b/test/integration/pushNoFollowTags/expected/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..c23aa0355 --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +myfile3 diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/FETCH_HEAD b/test/integration/pushNoFollowTags/expected/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..ce7bd7286 --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/.git_keep/FETCH_HEAD @@ -0,0 +1 @@ +8f99b05bf3462e1a797335475bff5fabe3ae9ec5 branch 'master' of ../actual_remote diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/HEAD b/test/integration/pushNoFollowTags/expected/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/config b/test/integration/pushNoFollowTags/expected/.git_keep/config new file mode 100644 index 000000000..821803a3e --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/.git_keep/config @@ -0,0 +1,16 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[remote "origin"] + url = ../actual_remote + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/description b/test/integration/pushNoFollowTags/expected/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/index b/test/integration/pushNoFollowTags/expected/.git_keep/index new file mode 100644 index 000000000..818799f5d Binary files /dev/null and b/test/integration/pushNoFollowTags/expected/.git_keep/index differ diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/info/exclude b/test/integration/pushNoFollowTags/expected/.git_keep/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/.git_keep/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/logs/HEAD b/test/integration/pushNoFollowTags/expected/.git_keep/logs/HEAD new file mode 100644 index 000000000..429f8a7fc --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/.git_keep/logs/HEAD @@ -0,0 +1,3 @@ +0000000000000000000000000000000000000000 fb20b9e96648c61699f9faf3a4383340fefd5f91 CI 1634944114 +1100 commit (initial): myfile1 +fb20b9e96648c61699f9faf3a4383340fefd5f91 8f99b05bf3462e1a797335475bff5fabe3ae9ec5 CI 1634944114 +1100 commit: myfile2 +8f99b05bf3462e1a797335475bff5fabe3ae9ec5 03009ca2af4be2a9bb49206974ce9c97eaa2da23 CI 1634944114 +1100 commit: myfile3 diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/logs/refs/heads/master b/test/integration/pushNoFollowTags/expected/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..429f8a7fc --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/.git_keep/logs/refs/heads/master @@ -0,0 +1,3 @@ +0000000000000000000000000000000000000000 fb20b9e96648c61699f9faf3a4383340fefd5f91 CI 1634944114 +1100 commit (initial): myfile1 +fb20b9e96648c61699f9faf3a4383340fefd5f91 8f99b05bf3462e1a797335475bff5fabe3ae9ec5 CI 1634944114 +1100 commit: myfile2 +8f99b05bf3462e1a797335475bff5fabe3ae9ec5 03009ca2af4be2a9bb49206974ce9c97eaa2da23 CI 1634944114 +1100 commit: myfile3 diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/pushNoFollowTags/expected/.git_keep/logs/refs/remotes/origin/master new file mode 100644 index 000000000..42331700f --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/.git_keep/logs/refs/remotes/origin/master @@ -0,0 +1,2 @@ +0000000000000000000000000000000000000000 8f99b05bf3462e1a797335475bff5fabe3ae9ec5 CI 1634944115 +1100 fetch origin: storing head +8f99b05bf3462e1a797335475bff5fabe3ae9ec5 03009ca2af4be2a9bb49206974ce9c97eaa2da23 CI 1634944115 +1100 update by push diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/objects/03/009ca2af4be2a9bb49206974ce9c97eaa2da23 b/test/integration/pushNoFollowTags/expected/.git_keep/objects/03/009ca2af4be2a9bb49206974ce9c97eaa2da23 new file mode 100644 index 000000000..4a4d1b682 Binary files /dev/null and b/test/integration/pushNoFollowTags/expected/.git_keep/objects/03/009ca2af4be2a9bb49206974ce9c97eaa2da23 differ diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pushNoFollowTags/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pushNoFollowTags/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pushNoFollowTags/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pushNoFollowTags/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pushNoFollowTags/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pushNoFollowTags/expected/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/objects/8f/99b05bf3462e1a797335475bff5fabe3ae9ec5 b/test/integration/pushNoFollowTags/expected/.git_keep/objects/8f/99b05bf3462e1a797335475bff5fabe3ae9ec5 new file mode 100644 index 000000000..1e525bf69 --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/.git_keep/objects/8f/99b05bf3462e1a797335475bff5fabe3ae9ec5 @@ -0,0 +1,3 @@ +xA +0@Q9$ӱ"BW=F`D#şZ(tj*k$L/EՄEY,s>0@nKX> +3#X(17ҙK\wF C?n^9!wG=]ڼhp?:: \ No newline at end of file diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pushNoFollowTags/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pushNoFollowTags/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pushNoFollowTags/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pushNoFollowTags/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pushNoFollowTags/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pushNoFollowTags/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/objects/e1/9bd88e6b3a0d7e4ffc1de39b34d5a312fb9b77 b/test/integration/pushNoFollowTags/expected/.git_keep/objects/e1/9bd88e6b3a0d7e4ffc1de39b34d5a312fb9b77 new file mode 100644 index 000000000..33f59a1d3 Binary files /dev/null and b/test/integration/pushNoFollowTags/expected/.git_keep/objects/e1/9bd88e6b3a0d7e4ffc1de39b34d5a312fb9b77 differ diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/objects/fb/20b9e96648c61699f9faf3a4383340fefd5f91 b/test/integration/pushNoFollowTags/expected/.git_keep/objects/fb/20b9e96648c61699f9faf3a4383340fefd5f91 new file mode 100644 index 000000000..8160387e5 --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/.git_keep/objects/fb/20b9e96648c61699f9faf3a4383340fefd5f91 @@ -0,0 +1,3 @@ +xA +0Fa9ߎDz4`CD#}|R5[vU*(0j̊ 9(/gӵsݞui4?%U`:޻rg߲n +0, \ No newline at end of file diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/refs/heads/master b/test/integration/pushNoFollowTags/expected/.git_keep/refs/heads/master new file mode 100644 index 000000000..c5beb70f7 --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/.git_keep/refs/heads/master @@ -0,0 +1 @@ +03009ca2af4be2a9bb49206974ce9c97eaa2da23 diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/refs/remotes/origin/master b/test/integration/pushNoFollowTags/expected/.git_keep/refs/remotes/origin/master new file mode 100644 index 000000000..c5beb70f7 --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/.git_keep/refs/remotes/origin/master @@ -0,0 +1 @@ +03009ca2af4be2a9bb49206974ce9c97eaa2da23 diff --git a/test/integration/pushNoFollowTags/expected/.git_keep/refs/tags/v1.0 b/test/integration/pushNoFollowTags/expected/.git_keep/refs/tags/v1.0 new file mode 100644 index 000000000..b4c9b638f --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/.git_keep/refs/tags/v1.0 @@ -0,0 +1 @@ +e19bd88e6b3a0d7e4ffc1de39b34d5a312fb9b77 diff --git a/test/integration/pushNoFollowTags/expected/myfile1 b/test/integration/pushNoFollowTags/expected/myfile1 new file mode 100644 index 000000000..a5bce3fd2 --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/myfile1 @@ -0,0 +1 @@ +test1 diff --git a/test/integration/pushNoFollowTags/expected/myfile2 b/test/integration/pushNoFollowTags/expected/myfile2 new file mode 100644 index 000000000..180cf8328 --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/myfile2 @@ -0,0 +1 @@ +test2 diff --git a/test/integration/pushNoFollowTags/expected/myfile3 b/test/integration/pushNoFollowTags/expected/myfile3 new file mode 100644 index 000000000..df6b0d2bc --- /dev/null +++ b/test/integration/pushNoFollowTags/expected/myfile3 @@ -0,0 +1 @@ +test3 diff --git a/test/integration/pushNoFollowTags/expected_remote/HEAD b/test/integration/pushNoFollowTags/expected_remote/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pushNoFollowTags/expected_remote/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pushNoFollowTags/expected_remote/config b/test/integration/pushNoFollowTags/expected_remote/config new file mode 100644 index 000000000..01095ff3a --- /dev/null +++ b/test/integration/pushNoFollowTags/expected_remote/config @@ -0,0 +1,8 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true + ignorecase = true + precomposeunicode = true +[remote "origin"] + url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/pushNoFollowTags/./actual diff --git a/test/integration/pushNoFollowTags/expected_remote/description b/test/integration/pushNoFollowTags/expected_remote/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pushNoFollowTags/expected_remote/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pushNoFollowTags/expected_remote/info/exclude b/test/integration/pushNoFollowTags/expected_remote/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pushNoFollowTags/expected_remote/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pushNoFollowTags/expected_remote/objects/03/009ca2af4be2a9bb49206974ce9c97eaa2da23 b/test/integration/pushNoFollowTags/expected_remote/objects/03/009ca2af4be2a9bb49206974ce9c97eaa2da23 new file mode 100644 index 000000000..4a4d1b682 Binary files /dev/null and b/test/integration/pushNoFollowTags/expected_remote/objects/03/009ca2af4be2a9bb49206974ce9c97eaa2da23 differ diff --git a/test/integration/pushNoFollowTags/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pushNoFollowTags/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pushNoFollowTags/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pushNoFollowTags/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pushNoFollowTags/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pushNoFollowTags/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pushNoFollowTags/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/pushNoFollowTags/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce new file mode 100644 index 000000000..0a734f981 Binary files /dev/null and b/test/integration/pushNoFollowTags/expected_remote/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ diff --git a/test/integration/pushNoFollowTags/expected_remote/objects/8f/99b05bf3462e1a797335475bff5fabe3ae9ec5 b/test/integration/pushNoFollowTags/expected_remote/objects/8f/99b05bf3462e1a797335475bff5fabe3ae9ec5 new file mode 100644 index 000000000..1e525bf69 --- /dev/null +++ b/test/integration/pushNoFollowTags/expected_remote/objects/8f/99b05bf3462e1a797335475bff5fabe3ae9ec5 @@ -0,0 +1,3 @@ +xA +0@Q9$ӱ"BW=F`D#şZ(tj*k$L/EՄEY,s>0@nKX> +3#X(17ҙK\wF C?n^9!wG=]ڼhp?:: \ No newline at end of file diff --git a/test/integration/pushNoFollowTags/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pushNoFollowTags/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pushNoFollowTags/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pushNoFollowTags/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pushNoFollowTags/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pushNoFollowTags/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pushNoFollowTags/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/pushNoFollowTags/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/pushNoFollowTags/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/pushNoFollowTags/expected_remote/objects/fb/20b9e96648c61699f9faf3a4383340fefd5f91 b/test/integration/pushNoFollowTags/expected_remote/objects/fb/20b9e96648c61699f9faf3a4383340fefd5f91 new file mode 100644 index 000000000..8160387e5 --- /dev/null +++ b/test/integration/pushNoFollowTags/expected_remote/objects/fb/20b9e96648c61699f9faf3a4383340fefd5f91 @@ -0,0 +1,3 @@ +xA +0Fa9ߎDz4`CD#}|R5[vU*(0j̊ 9(/gӵsݞui4?%U`:޻rg߲n +0, \ No newline at end of file diff --git a/test/integration/pushNoFollowTags/expected_remote/packed-refs b/test/integration/pushNoFollowTags/expected_remote/packed-refs new file mode 100644 index 000000000..cb3f85f2e --- /dev/null +++ b/test/integration/pushNoFollowTags/expected_remote/packed-refs @@ -0,0 +1,2 @@ +# pack-refs with: peeled fully-peeled sorted +8f99b05bf3462e1a797335475bff5fabe3ae9ec5 refs/heads/master diff --git a/test/integration/pushNoFollowTags/expected_remote/refs/heads/master b/test/integration/pushNoFollowTags/expected_remote/refs/heads/master new file mode 100644 index 000000000..c5beb70f7 --- /dev/null +++ b/test/integration/pushNoFollowTags/expected_remote/refs/heads/master @@ -0,0 +1 @@ +03009ca2af4be2a9bb49206974ce9c97eaa2da23 diff --git a/test/integration/pushNoFollowTags/recording.json b/test/integration/pushNoFollowTags/recording.json new file mode 100644 index 000000000..428f83f07 --- /dev/null +++ b/test/integration/pushNoFollowTags/recording.json @@ -0,0 +1 @@ +{"KeyEvents":[{"Timestamp":636,"Mod":0,"Key":256,"Ch":80},{"Timestamp":1563,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/pushNoFollowTags/setup.sh b/test/integration/pushNoFollowTags/setup.sh new file mode 100644 index 000000000..304dcd9e9 --- /dev/null +++ b/test/integration/pushNoFollowTags/setup.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +set -e + +cd $1 + +git init + +git config user.email "CI@example.com" +git config user.name "CI" + +echo test1 > myfile1 +git add . +git commit -am "myfile1" +echo test2 > myfile2 +git add . +git commit -am "myfile2" + +cd .. +git clone --bare ./actual actual_remote + +cd actual + +echo test3 > myfile3 +git add . +git commit -am "myfile3" + +git remote add origin ../actual_remote +git fetch origin +git branch --set-upstream-to=origin/master master +git tag -a v1.0 -m "my version 1.0" diff --git a/test/integration/pushNoFollowTags/test.json b/test/integration/pushNoFollowTags/test.json new file mode 100644 index 000000000..65f6b3409 --- /dev/null +++ b/test/integration/pushNoFollowTags/test.json @@ -0,0 +1 @@ +{ "description": "push changes to the remote, when --follow-tags is not configured", "speed": 10 } diff --git a/test/integration/pushTag/expected/.git_keep/COMMIT_EDITMSG b/test/integration/pushTag/expected/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..f4b7a0e26 --- /dev/null +++ b/test/integration/pushTag/expected/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +myfile2 diff --git a/test/integration/pushTag/expected/.git_keep/FETCH_HEAD b/test/integration/pushTag/expected/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..fb3f085ba --- /dev/null +++ b/test/integration/pushTag/expected/.git_keep/FETCH_HEAD @@ -0,0 +1 @@ +9639a47a7955a338919b090835305898ea516c66 branch 'master' of ../actual_remote diff --git a/test/integration/pushTag/expected/.git_keep/HEAD b/test/integration/pushTag/expected/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pushTag/expected/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pushTag/expected/.git_keep/config b/test/integration/pushTag/expected/.git_keep/config new file mode 100644 index 000000000..821803a3e --- /dev/null +++ b/test/integration/pushTag/expected/.git_keep/config @@ -0,0 +1,16 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[remote "origin"] + url = ../actual_remote + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master diff --git a/test/integration/pushTag/expected/.git_keep/description b/test/integration/pushTag/expected/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pushTag/expected/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pushTag/expected/.git_keep/index b/test/integration/pushTag/expected/.git_keep/index new file mode 100644 index 000000000..b9d835e98 Binary files /dev/null and b/test/integration/pushTag/expected/.git_keep/index differ diff --git a/test/integration/pushTag/expected/.git_keep/info/exclude b/test/integration/pushTag/expected/.git_keep/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pushTag/expected/.git_keep/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pushTag/expected/.git_keep/logs/HEAD b/test/integration/pushTag/expected/.git_keep/logs/HEAD new file mode 100644 index 000000000..406014feb --- /dev/null +++ b/test/integration/pushTag/expected/.git_keep/logs/HEAD @@ -0,0 +1,2 @@ +0000000000000000000000000000000000000000 905961711d3f0898c003c7e4da636a4c683f7934 CI 1634944441 +1100 commit (initial): myfile1 +905961711d3f0898c003c7e4da636a4c683f7934 9639a47a7955a338919b090835305898ea516c66 CI 1634944441 +1100 commit: myfile2 diff --git a/test/integration/pushTag/expected/.git_keep/logs/refs/heads/master b/test/integration/pushTag/expected/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..406014feb --- /dev/null +++ b/test/integration/pushTag/expected/.git_keep/logs/refs/heads/master @@ -0,0 +1,2 @@ +0000000000000000000000000000000000000000 905961711d3f0898c003c7e4da636a4c683f7934 CI 1634944441 +1100 commit (initial): myfile1 +905961711d3f0898c003c7e4da636a4c683f7934 9639a47a7955a338919b090835305898ea516c66 CI 1634944441 +1100 commit: myfile2 diff --git a/test/integration/pushTag/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/pushTag/expected/.git_keep/logs/refs/remotes/origin/master new file mode 100644 index 000000000..a2798f571 --- /dev/null +++ b/test/integration/pushTag/expected/.git_keep/logs/refs/remotes/origin/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 9639a47a7955a338919b090835305898ea516c66 CI 1634944442 +1100 fetch origin: storing head diff --git a/test/integration/pushTag/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pushTag/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pushTag/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pushTag/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pushTag/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pushTag/expected/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pushTag/expected/.git_keep/objects/90/5961711d3f0898c003c7e4da636a4c683f7934 b/test/integration/pushTag/expected/.git_keep/objects/90/5961711d3f0898c003c7e4da636a4c683f7934 new file mode 100644 index 000000000..f060761fd Binary files /dev/null and b/test/integration/pushTag/expected/.git_keep/objects/90/5961711d3f0898c003c7e4da636a4c683f7934 differ diff --git a/test/integration/pushTag/expected/.git_keep/objects/96/39a47a7955a338919b090835305898ea516c66 b/test/integration/pushTag/expected/.git_keep/objects/96/39a47a7955a338919b090835305898ea516c66 new file mode 100644 index 000000000..243780783 Binary files /dev/null and b/test/integration/pushTag/expected/.git_keep/objects/96/39a47a7955a338919b090835305898ea516c66 differ diff --git a/test/integration/pushTag/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pushTag/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pushTag/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pushTag/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pushTag/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pushTag/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pushTag/expected/.git_keep/refs/heads/master b/test/integration/pushTag/expected/.git_keep/refs/heads/master new file mode 100644 index 000000000..442efe33e --- /dev/null +++ b/test/integration/pushTag/expected/.git_keep/refs/heads/master @@ -0,0 +1 @@ +9639a47a7955a338919b090835305898ea516c66 diff --git a/test/integration/pushTag/expected/.git_keep/refs/remotes/origin/master b/test/integration/pushTag/expected/.git_keep/refs/remotes/origin/master new file mode 100644 index 000000000..442efe33e --- /dev/null +++ b/test/integration/pushTag/expected/.git_keep/refs/remotes/origin/master @@ -0,0 +1 @@ +9639a47a7955a338919b090835305898ea516c66 diff --git a/test/integration/pushTag/expected/.git_keep/refs/tags/v1.0 b/test/integration/pushTag/expected/.git_keep/refs/tags/v1.0 new file mode 100644 index 000000000..442efe33e --- /dev/null +++ b/test/integration/pushTag/expected/.git_keep/refs/tags/v1.0 @@ -0,0 +1 @@ +9639a47a7955a338919b090835305898ea516c66 diff --git a/test/integration/pushTag/expected/myfile1 b/test/integration/pushTag/expected/myfile1 new file mode 100644 index 000000000..a5bce3fd2 --- /dev/null +++ b/test/integration/pushTag/expected/myfile1 @@ -0,0 +1 @@ +test1 diff --git a/test/integration/pushTag/expected/myfile2 b/test/integration/pushTag/expected/myfile2 new file mode 100644 index 000000000..180cf8328 --- /dev/null +++ b/test/integration/pushTag/expected/myfile2 @@ -0,0 +1 @@ +test2 diff --git a/test/integration/pushTag/expected_remote/HEAD b/test/integration/pushTag/expected_remote/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/pushTag/expected_remote/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/pushTag/expected_remote/config b/test/integration/pushTag/expected_remote/config new file mode 100644 index 000000000..6b41174e6 --- /dev/null +++ b/test/integration/pushTag/expected_remote/config @@ -0,0 +1,8 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true + ignorecase = true + precomposeunicode = true +[remote "origin"] + url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/pushTag/./actual diff --git a/test/integration/pushTag/expected_remote/description b/test/integration/pushTag/expected_remote/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/pushTag/expected_remote/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/pushTag/expected_remote/info/exclude b/test/integration/pushTag/expected_remote/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/pushTag/expected_remote/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/pushTag/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/pushTag/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/pushTag/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/pushTag/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/pushTag/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 new file mode 100644 index 000000000..f74bf2335 Binary files /dev/null and b/test/integration/pushTag/expected_remote/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ diff --git a/test/integration/pushTag/expected_remote/objects/90/5961711d3f0898c003c7e4da636a4c683f7934 b/test/integration/pushTag/expected_remote/objects/90/5961711d3f0898c003c7e4da636a4c683f7934 new file mode 100644 index 000000000..f060761fd Binary files /dev/null and b/test/integration/pushTag/expected_remote/objects/90/5961711d3f0898c003c7e4da636a4c683f7934 differ diff --git a/test/integration/pushTag/expected_remote/objects/96/39a47a7955a338919b090835305898ea516c66 b/test/integration/pushTag/expected_remote/objects/96/39a47a7955a338919b090835305898ea516c66 new file mode 100644 index 000000000..243780783 Binary files /dev/null and b/test/integration/pushTag/expected_remote/objects/96/39a47a7955a338919b090835305898ea516c66 differ diff --git a/test/integration/pushTag/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/pushTag/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/pushTag/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/pushTag/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/pushTag/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/pushTag/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/pushTag/expected_remote/packed-refs b/test/integration/pushTag/expected_remote/packed-refs new file mode 100644 index 000000000..31565c279 --- /dev/null +++ b/test/integration/pushTag/expected_remote/packed-refs @@ -0,0 +1,2 @@ +# pack-refs with: peeled fully-peeled sorted +9639a47a7955a338919b090835305898ea516c66 refs/heads/master diff --git a/test/integration/pushTag/expected_remote/refs/tags/v1.0 b/test/integration/pushTag/expected_remote/refs/tags/v1.0 new file mode 100644 index 000000000..442efe33e --- /dev/null +++ b/test/integration/pushTag/expected_remote/refs/tags/v1.0 @@ -0,0 +1 @@ +9639a47a7955a338919b090835305898ea516c66 diff --git a/test/integration/pushTag/recording.json b/test/integration/pushTag/recording.json new file mode 100644 index 000000000..7f2006f35 --- /dev/null +++ b/test/integration/pushTag/recording.json @@ -0,0 +1 @@ +{"KeyEvents":[{"Timestamp":1037,"Mod":0,"Key":259,"Ch":0},{"Timestamp":1596,"Mod":0,"Key":256,"Ch":93},{"Timestamp":1709,"Mod":0,"Key":256,"Ch":93},{"Timestamp":2117,"Mod":0,"Key":256,"Ch":110},{"Timestamp":2411,"Mod":0,"Key":256,"Ch":118},{"Timestamp":2757,"Mod":0,"Key":256,"Ch":49},{"Timestamp":2932,"Mod":0,"Key":256,"Ch":46},{"Timestamp":3109,"Mod":0,"Key":256,"Ch":48},{"Timestamp":3373,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3988,"Mod":0,"Key":256,"Ch":80},{"Timestamp":4516,"Mod":0,"Key":13,"Ch":13},{"Timestamp":5309,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/pushTag/setup.sh b/test/integration/pushTag/setup.sh new file mode 100644 index 000000000..5e09ed4ea --- /dev/null +++ b/test/integration/pushTag/setup.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +set -e + +cd $1 + +git init + +git config user.email "CI@example.com" +git config user.name "CI" + +echo test1 > myfile1 +git add . +git commit -am "myfile1" +echo test2 > myfile2 +git add . +git commit -am "myfile2" + +cd .. +git clone --bare ./actual actual_remote + +cd actual + +git remote add origin ../actual_remote +git fetch origin +git branch --set-upstream-to=origin/master master diff --git a/test/integration/pushTag/test.json b/test/integration/pushTag/test.json new file mode 100644 index 000000000..2e194536b --- /dev/null +++ b/test/integration/pushTag/test.json @@ -0,0 +1 @@ +{ "description": "create and push tag to remote", "speed": 10 } diff --git a/test/integration/setUpstream/expected/.git_keep/COMMIT_EDITMSG b/test/integration/setUpstream/expected/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..51be8ec3d --- /dev/null +++ b/test/integration/setUpstream/expected/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +myfile4 diff --git a/test/integration/setUpstream/expected/.git_keep/FETCH_HEAD b/test/integration/setUpstream/expected/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..865fc1191 --- /dev/null +++ b/test/integration/setUpstream/expected/.git_keep/FETCH_HEAD @@ -0,0 +1 @@ +148a38f7ce513079d6cd40e4a02f11e46ea2ba6b branch 'master' of ../actual_remote diff --git a/test/integration/setUpstream/expected/.git_keep/HEAD b/test/integration/setUpstream/expected/.git_keep/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/setUpstream/expected/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/setUpstream/expected/.git_keep/ORIG_HEAD b/test/integration/setUpstream/expected/.git_keep/ORIG_HEAD new file mode 100644 index 000000000..131e55236 --- /dev/null +++ b/test/integration/setUpstream/expected/.git_keep/ORIG_HEAD @@ -0,0 +1 @@ +058c8904c25889dd77ee3e817325fd1a28134037 diff --git a/test/integration/setUpstream/expected/.git_keep/config b/test/integration/setUpstream/expected/.git_keep/config new file mode 100644 index 000000000..821803a3e --- /dev/null +++ b/test/integration/setUpstream/expected/.git_keep/config @@ -0,0 +1,16 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[remote "origin"] + url = ../actual_remote + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master diff --git a/test/integration/setUpstream/expected/.git_keep/description b/test/integration/setUpstream/expected/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/setUpstream/expected/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/setUpstream/expected/.git_keep/index b/test/integration/setUpstream/expected/.git_keep/index new file mode 100644 index 000000000..9c34edeae Binary files /dev/null and b/test/integration/setUpstream/expected/.git_keep/index differ diff --git a/test/integration/setUpstream/expected/.git_keep/info/exclude b/test/integration/setUpstream/expected/.git_keep/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/setUpstream/expected/.git_keep/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/setUpstream/expected/.git_keep/logs/HEAD b/test/integration/setUpstream/expected/.git_keep/logs/HEAD new file mode 100644 index 000000000..0a0706f6a --- /dev/null +++ b/test/integration/setUpstream/expected/.git_keep/logs/HEAD @@ -0,0 +1,6 @@ +0000000000000000000000000000000000000000 7d7da1f440cca8d28eaf4b46e63f207993562b84 CI 1634898072 +1100 commit (initial): myfile1 +7d7da1f440cca8d28eaf4b46e63f207993562b84 058c8904c25889dd77ee3e817325fd1a28134037 CI 1634898072 +1100 commit: myfile2 +058c8904c25889dd77ee3e817325fd1a28134037 409dd039b9ec270067678ae23b710c8e4c49c458 CI 1634898072 +1100 commit: myfile3 +409dd039b9ec270067678ae23b710c8e4c49c458 148a38f7ce513079d6cd40e4a02f11e46ea2ba6b CI 1634898072 +1100 commit: myfile4 +148a38f7ce513079d6cd40e4a02f11e46ea2ba6b 058c8904c25889dd77ee3e817325fd1a28134037 CI 1634898072 +1100 reset: moving to HEAD~2 +058c8904c25889dd77ee3e817325fd1a28134037 148a38f7ce513079d6cd40e4a02f11e46ea2ba6b CI 1634898082 +1100 pull --no-edit: Fast-forward diff --git a/test/integration/setUpstream/expected/.git_keep/logs/refs/heads/master b/test/integration/setUpstream/expected/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..0a0706f6a --- /dev/null +++ b/test/integration/setUpstream/expected/.git_keep/logs/refs/heads/master @@ -0,0 +1,6 @@ +0000000000000000000000000000000000000000 7d7da1f440cca8d28eaf4b46e63f207993562b84 CI 1634898072 +1100 commit (initial): myfile1 +7d7da1f440cca8d28eaf4b46e63f207993562b84 058c8904c25889dd77ee3e817325fd1a28134037 CI 1634898072 +1100 commit: myfile2 +058c8904c25889dd77ee3e817325fd1a28134037 409dd039b9ec270067678ae23b710c8e4c49c458 CI 1634898072 +1100 commit: myfile3 +409dd039b9ec270067678ae23b710c8e4c49c458 148a38f7ce513079d6cd40e4a02f11e46ea2ba6b CI 1634898072 +1100 commit: myfile4 +148a38f7ce513079d6cd40e4a02f11e46ea2ba6b 058c8904c25889dd77ee3e817325fd1a28134037 CI 1634898072 +1100 reset: moving to HEAD~2 +058c8904c25889dd77ee3e817325fd1a28134037 148a38f7ce513079d6cd40e4a02f11e46ea2ba6b CI 1634898082 +1100 pull --no-edit: Fast-forward diff --git a/test/integration/setUpstream/expected/.git_keep/logs/refs/remotes/origin/master b/test/integration/setUpstream/expected/.git_keep/logs/refs/remotes/origin/master new file mode 100644 index 000000000..10925c1eb --- /dev/null +++ b/test/integration/setUpstream/expected/.git_keep/logs/refs/remotes/origin/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 148a38f7ce513079d6cd40e4a02f11e46ea2ba6b CI 1634898079 +1100 fetch origin: storing head diff --git a/test/integration/setUpstream/expected/.git_keep/objects/05/8c8904c25889dd77ee3e817325fd1a28134037 b/test/integration/setUpstream/expected/.git_keep/objects/05/8c8904c25889dd77ee3e817325fd1a28134037 new file mode 100644 index 000000000..ae34bb7c1 --- /dev/null +++ b/test/integration/setUpstream/expected/.git_keep/objects/05/8c8904c25889dd77ee3e817325fd1a28134037 @@ -0,0 +1,2 @@ +xA +0@Q9E$$"BW=Ƥ`R"~kkKwU+1+E2L*'ɮncE|Et,@RB@yǺqqG˼0qr{QrӾuy*ݜ:< \ No newline at end of file diff --git a/test/integration/setUpstream/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/setUpstream/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/setUpstream/expected/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/setUpstream/expected/.git_keep/objects/14/8a38f7ce513079d6cd40e4a02f11e46ea2ba6b b/test/integration/setUpstream/expected/.git_keep/objects/14/8a38f7ce513079d6cd40e4a02f11e46ea2ba6b new file mode 100644 index 000000000..9d94a934d --- /dev/null +++ b/test/integration/setUpstream/expected/.git_keep/objects/14/8a38f7ce513079d6cd40e4a02f11e46ea2ba6b @@ -0,0 +1,3 @@ +xA +0@Ѯs e&L& c8RT#ty_Zf1ѥ͌  /3҈APrHh|Y4MӘdu~E +BAL~v~]?ﵮMCtvh@@rq%9,%eBiA#jxbƱD1DPG/%@g0nӬi~'ca@GL +`괟j귬9 \ No newline at end of file diff --git a/test/integration/setUpstream/expected/.git_keep/objects/7d/7da1f440cca8d28eaf4b46e63f207993562b84 b/test/integration/setUpstream/expected/.git_keep/objects/7d/7da1f440cca8d28eaf4b46e63f207993562b84 new file mode 100644 index 000000000..54afb1c5a --- /dev/null +++ b/test/integration/setUpstream/expected/.git_keep/objects/7d/7da1f440cca8d28eaf4b46e63f207993562b84 @@ -0,0 +1,3 @@ +xA +0@Q9ɤd +"BW=4`!R"~j]; fSKM2p %BCf*? i~GkKj(>8#zzL]u3t?4A, \ No newline at end of file diff --git a/test/integration/setUpstream/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/setUpstream/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/setUpstream/expected/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/setUpstream/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/setUpstream/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/setUpstream/expected/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/setUpstream/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/setUpstream/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/setUpstream/expected/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/setUpstream/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/setUpstream/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/setUpstream/expected/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/setUpstream/expected/.git_keep/refs/heads/master b/test/integration/setUpstream/expected/.git_keep/refs/heads/master new file mode 100644 index 000000000..25aa18f55 --- /dev/null +++ b/test/integration/setUpstream/expected/.git_keep/refs/heads/master @@ -0,0 +1 @@ +148a38f7ce513079d6cd40e4a02f11e46ea2ba6b diff --git a/test/integration/setUpstream/expected/.git_keep/refs/remotes/origin/master b/test/integration/setUpstream/expected/.git_keep/refs/remotes/origin/master new file mode 100644 index 000000000..25aa18f55 --- /dev/null +++ b/test/integration/setUpstream/expected/.git_keep/refs/remotes/origin/master @@ -0,0 +1 @@ +148a38f7ce513079d6cd40e4a02f11e46ea2ba6b diff --git a/test/integration/setUpstream/expected/myfile1 b/test/integration/setUpstream/expected/myfile1 new file mode 100644 index 000000000..a5bce3fd2 --- /dev/null +++ b/test/integration/setUpstream/expected/myfile1 @@ -0,0 +1 @@ +test1 diff --git a/test/integration/setUpstream/expected/myfile2 b/test/integration/setUpstream/expected/myfile2 new file mode 100644 index 000000000..180cf8328 --- /dev/null +++ b/test/integration/setUpstream/expected/myfile2 @@ -0,0 +1 @@ +test2 diff --git a/test/integration/setUpstream/expected/myfile3 b/test/integration/setUpstream/expected/myfile3 new file mode 100644 index 000000000..df6b0d2bc --- /dev/null +++ b/test/integration/setUpstream/expected/myfile3 @@ -0,0 +1 @@ +test3 diff --git a/test/integration/setUpstream/expected/myfile4 b/test/integration/setUpstream/expected/myfile4 new file mode 100644 index 000000000..d234c5e05 --- /dev/null +++ b/test/integration/setUpstream/expected/myfile4 @@ -0,0 +1 @@ +test4 diff --git a/test/integration/setUpstream/expected_remote/HEAD b/test/integration/setUpstream/expected_remote/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/test/integration/setUpstream/expected_remote/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/test/integration/setUpstream/expected_remote/config b/test/integration/setUpstream/expected_remote/config new file mode 100644 index 000000000..1a0f699c7 --- /dev/null +++ b/test/integration/setUpstream/expected_remote/config @@ -0,0 +1,8 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true + ignorecase = true + precomposeunicode = true +[remote "origin"] + url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/setUpstream/./actual diff --git a/test/integration/setUpstream/expected_remote/description b/test/integration/setUpstream/expected_remote/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration/setUpstream/expected_remote/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration/setUpstream/expected_remote/info/exclude b/test/integration/setUpstream/expected_remote/info/exclude new file mode 100644 index 000000000..8e9f2071f --- /dev/null +++ b/test/integration/setUpstream/expected_remote/info/exclude @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +.DS_Store diff --git a/test/integration/setUpstream/expected_remote/objects/05/8c8904c25889dd77ee3e817325fd1a28134037 b/test/integration/setUpstream/expected_remote/objects/05/8c8904c25889dd77ee3e817325fd1a28134037 new file mode 100644 index 000000000..ae34bb7c1 --- /dev/null +++ b/test/integration/setUpstream/expected_remote/objects/05/8c8904c25889dd77ee3e817325fd1a28134037 @@ -0,0 +1,2 @@ +xA +0@Q9E$$"BW=Ƥ`R"~kkKwU+1+E2L*'ɮncE|Et,@RB@yǺqqG˼0qr{QrӾuy*ݜ:< \ No newline at end of file diff --git a/test/integration/setUpstream/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/setUpstream/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 new file mode 100644 index 000000000..7f2ebf4ee Binary files /dev/null and b/test/integration/setUpstream/expected_remote/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ diff --git a/test/integration/setUpstream/expected_remote/objects/14/8a38f7ce513079d6cd40e4a02f11e46ea2ba6b b/test/integration/setUpstream/expected_remote/objects/14/8a38f7ce513079d6cd40e4a02f11e46ea2ba6b new file mode 100644 index 000000000..9d94a934d --- /dev/null +++ b/test/integration/setUpstream/expected_remote/objects/14/8a38f7ce513079d6cd40e4a02f11e46ea2ba6b @@ -0,0 +1,3 @@ +xA +0@Ѯs e&L& c8RT#ty_Zf1ѥ͌  /3҈APrHh|Y4MӘdu~E +BAL~v~]?ﵮMCtvh@@rq%9,%eBiA#jxbƱD1DPG/%@g0nӬi~'ca@GL +`괟j귬9 \ No newline at end of file diff --git a/test/integration/setUpstream/expected_remote/objects/7d/7da1f440cca8d28eaf4b46e63f207993562b84 b/test/integration/setUpstream/expected_remote/objects/7d/7da1f440cca8d28eaf4b46e63f207993562b84 new file mode 100644 index 000000000..54afb1c5a --- /dev/null +++ b/test/integration/setUpstream/expected_remote/objects/7d/7da1f440cca8d28eaf4b46e63f207993562b84 @@ -0,0 +1,3 @@ +xA +0@Q9ɤd +"BW=4`!R"~j]; fSKM2p %BCf*? i~GkKj(>8#zzL]u3t?4A, \ No newline at end of file diff --git a/test/integration/setUpstream/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/setUpstream/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 new file mode 100644 index 000000000..285df3e5f Binary files /dev/null and b/test/integration/setUpstream/expected_remote/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ diff --git a/test/integration/setUpstream/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/setUpstream/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 new file mode 100644 index 000000000..96d2e71a6 Binary files /dev/null and b/test/integration/setUpstream/expected_remote/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ diff --git a/test/integration/setUpstream/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/setUpstream/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 new file mode 100644 index 000000000..d39fa7d2f Binary files /dev/null and b/test/integration/setUpstream/expected_remote/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ diff --git a/test/integration/setUpstream/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/setUpstream/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b new file mode 100644 index 000000000..9b771fc2f Binary files /dev/null and b/test/integration/setUpstream/expected_remote/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ diff --git a/test/integration/setUpstream/expected_remote/packed-refs b/test/integration/setUpstream/expected_remote/packed-refs new file mode 100644 index 000000000..a5eca4e4d --- /dev/null +++ b/test/integration/setUpstream/expected_remote/packed-refs @@ -0,0 +1,2 @@ +# pack-refs with: peeled fully-peeled sorted +148a38f7ce513079d6cd40e4a02f11e46ea2ba6b refs/heads/master diff --git a/test/integration/setUpstream/recording.json b/test/integration/setUpstream/recording.json new file mode 100644 index 000000000..d4983d00b --- /dev/null +++ b/test/integration/setUpstream/recording.json @@ -0,0 +1 @@ +{"KeyEvents":[{"Timestamp":555,"Mod":0,"Key":259,"Ch":0},{"Timestamp":1226,"Mod":0,"Key":256,"Ch":93},{"Timestamp":1731,"Mod":0,"Key":256,"Ch":110},{"Timestamp":1971,"Mod":0,"Key":256,"Ch":111},{"Timestamp":2131,"Mod":0,"Key":256,"Ch":114},{"Timestamp":2219,"Mod":0,"Key":256,"Ch":105},{"Timestamp":2274,"Mod":0,"Key":256,"Ch":103},{"Timestamp":2338,"Mod":0,"Key":256,"Ch":105},{"Timestamp":2418,"Mod":0,"Key":256,"Ch":110},{"Timestamp":2843,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3379,"Mod":0,"Key":256,"Ch":46},{"Timestamp":3522,"Mod":0,"Key":256,"Ch":46},{"Timestamp":3690,"Mod":0,"Key":256,"Ch":47},{"Timestamp":3947,"Mod":0,"Key":256,"Ch":97},{"Timestamp":4105,"Mod":0,"Key":256,"Ch":99},{"Timestamp":4266,"Mod":0,"Key":256,"Ch":116},{"Timestamp":4338,"Mod":0,"Key":256,"Ch":117},{"Timestamp":4442,"Mod":0,"Key":256,"Ch":97},{"Timestamp":4530,"Mod":0,"Key":256,"Ch":108},{"Timestamp":4731,"Mod":0,"Key":256,"Ch":95},{"Timestamp":4915,"Mod":0,"Key":256,"Ch":114},{"Timestamp":4962,"Mod":0,"Key":256,"Ch":101},{"Timestamp":5041,"Mod":0,"Key":256,"Ch":109},{"Timestamp":5090,"Mod":0,"Key":256,"Ch":111},{"Timestamp":5146,"Mod":0,"Key":256,"Ch":116},{"Timestamp":5170,"Mod":0,"Key":256,"Ch":101},{"Timestamp":5443,"Mod":0,"Key":13,"Ch":13},{"Timestamp":6313,"Mod":0,"Key":256,"Ch":102},{"Timestamp":7171,"Mod":0,"Key":13,"Ch":13},{"Timestamp":7883,"Mod":0,"Key":256,"Ch":117},{"Timestamp":8459,"Mod":0,"Key":13,"Ch":13},{"Timestamp":9411,"Mod":0,"Key":256,"Ch":112},{"Timestamp":10298,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]} \ No newline at end of file diff --git a/test/integration/setUpstream/setup.sh b/test/integration/setUpstream/setup.sh new file mode 100644 index 000000000..6a2b91419 --- /dev/null +++ b/test/integration/setUpstream/setup.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +set -e + +cd $1 + +git init + +git config user.email "CI@example.com" +git config user.name "CI" + +echo test1 > myfile1 +git add . +git commit -am "myfile1" +echo test2 > myfile2 +git add . +git commit -am "myfile2" +echo test3 > myfile3 +git add . +git commit -am "myfile3" +echo test4 > myfile4 +git add . +git commit -am "myfile4" + +cd .. +git clone --bare ./actual actual_remote + +cd actual + +git reset --hard HEAD~2 diff --git a/test/integration/setUpstream/test.json b/test/integration/setUpstream/test.json new file mode 100644 index 000000000..32b4b9d64 --- /dev/null +++ b/test/integration/setUpstream/test.json @@ -0,0 +1 @@ +{ "description": "allow setting the upstream of the current branch", "speed": 10 } diff --git a/test/lazyintegration/main.go b/test/lazyintegration/main.go index f7ad91414..c86442417 100644 --- a/test/lazyintegration/main.go +++ b/test/lazyintegration/main.go @@ -7,8 +7,8 @@ import ( "os/exec" "path/filepath" - "github.com/fatih/color" "github.com/jesseduffield/gocui" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/integration" "github.com/jesseduffield/lazygit/pkg/secureexec" ) @@ -287,7 +287,7 @@ func (app *App) runSubprocess(cmd *exec.Cmd) { cmd.Stderr = nil cmd.Stdout = nil - fmt.Fprintf(os.Stdout, "\n%s", coloredString("press enter to return", color.FgGreen)) + fmt.Fprintf(os.Stdout, "\n%s", style.FgGreen.Sprint("press enter to return")) fmt.Scanln() // wait for enter press if err := gocui.Screen.Resume(); err != nil { @@ -382,14 +382,3 @@ func (app *App) layout(g *gocui.Gui) error { func quit(g *gocui.Gui, v *gocui.View) error { return gocui.ErrQuit } - -func coloredString(str string, colorAttributes ...color.Attribute) string { - colour := color.New(colorAttributes...) - return coloredStringDirect(str, colour) -} - -// coloredStringDirect used for aggregating a few color attributes rather than -// just sending a single one -func coloredStringDirect(str string, colour *color.Color) string { - return colour.SprintFunc()(fmt.Sprint(str)) -} diff --git a/test/runner/main.go b/test/runner/main.go index 585f26546..b122568fe 100644 --- a/test/runner/main.go +++ b/test/runner/main.go @@ -40,8 +40,8 @@ func main() { updateSnapshots, record, speedEnv, - func(_t *testing.T, expected string, actual string) { - assert.Equal(MockTestingT{}, expected, actual, fmt.Sprintf("expected:\n%s\nactual:\n%s\n", expected, actual)) + func(_t *testing.T, expected string, actual string, prefix string) { + assert.Equal(MockTestingT{}, expected, actual, fmt.Sprintf("Unexpected %s. Expected:\n%s\nActual:\n%s\n", prefix, expected, actual)) }, includeSkipped, ) diff --git a/vendor/github.com/gdamore/tcell/v2/CHANGESv2.adoc b/vendor/github.com/gdamore/tcell/v2/CHANGESv2.md similarity index 83% rename from vendor/github.com/gdamore/tcell/v2/CHANGESv2.adoc rename to vendor/github.com/gdamore/tcell/v2/CHANGESv2.md index 65d154873..ad97c11b5 100644 --- a/vendor/github.com/gdamore/tcell/v2/CHANGESv2.adoc +++ b/vendor/github.com/gdamore/tcell/v2/CHANGESv2.md @@ -1,18 +1,18 @@ -== Breaking Changes in _Tcell_ v2 +## Breaking Changes in _Tcell_ v2 -A number of changes were made to _Tcell_ for version two, and some of these -are breaking. +A number of changes were made to _Tcell_ for version two, and some of these are breaking. -=== Import Path +### Import Path The import path for tcell has changed to `github.com/gdamore/tcell/v2` to reflect a new major version. -=== Style Is Not Numeric +### Style Is Not Numeric -The type `Style` has changed to a structure, to allow us to add additional data such as flags for color setting, more attribute bits, and so forth. +The type `Style` has changed to a structure, to allow us to add additional data such as flags for color setting, +more attribute bits, and so forth. Applications that relied on this being a number will need to be updated to use the accessor methods. -=== Mouse Event Changes +### Mouse Event Changes The middle mouse button was reported as button 2 on Linux, but as button 3 on Windows, and the right mouse button was reported the reverse way. @@ -23,12 +23,12 @@ To help make this clearer, new symbols `ButtonPrimary`, `ButtonSecondary`, and Usually the left button will be considered the Primary, and the right will be the Secondary.) Applications may need to adjust their handling of mouse buttons 2 and 3 accordingly. -=== Terminals Removed +### Terminals Removed A number of terminals have been removed. These are mostly ancient definitions unlikely to be used by anyone, such as `adm3a`. -=== High Number Function Keys +### High Number Function Keys Historically terminfo reported function keys with modifiers set as a different function key altogether. For example, Shift-F1 was reported as F13 on XTerm. @@ -36,44 +36,44 @@ _Tcell_ now prefers to report these using the base key (such as F1) with modifie This works on XTerm and VTE based emulators, but some emulators may not support this. The new behavior more closely aligns with behavior on Windows platforms. -== New Features in _Tcell_ v2 +## New Features in _Tcell_ v2 These features are not breaking, but are introduced in version 2. -=== Improved Modifier Support +### Improved Modifier Support For terminals that appear to behave like the venerable XTerm, _tcell_ automatically adds modifier reporting for ALT, CTRL, SHIFT, and META keys when the terminal reports them. -=== Better Support for Palettes (Themes) +### Better Support for Palettes (Themes) When using a color by its name or palette entry, _Tcell_ now tries to -use that palette entry as is; this should avoid some inconsistency and undesirable -overriding of colors where colors would override settings made in the terminal. +use that palette entry as is; this should avoid some inconsistency and respect +terminal themes correctly. When true fidelity to RGB values is needed, the new `TrueColor()` API can be used to create a direct color, which bypasses the palette altogether. -=== Automatic TrueColor Detection +### Automatic TrueColor Detection For some terminals, if the `Tc` or `RGB` properties are present in terminfo, _Tcell_ will automatically assume the terminal supports 24-bit color. -=== ColorReset +### ColorReset A new color value, `ColorReset` can be used on the foreground or background to reset the color the default used by the terminal. -=== tmux Support +### tmux Support _Tcell_ now has improved support for tmux, when the `$TERM` variable is set to "tmux". -=== Strikethrough Support +### Strikethrough Support _Tcell_ has support for strikethrough when the terminal supports it, using the new `StrikeThrough()` API. -=== Bracketed Paste Support +### Bracketed Paste Support _Tcell_ provides the long requested capability to discriminate paste event by using the bracketed-paste capability present in some terminals. This is automatically available on diff --git a/vendor/github.com/gdamore/tcell/v2/README.adoc b/vendor/github.com/gdamore/tcell/v2/README.md similarity index 51% rename from vendor/github.com/gdamore/tcell/v2/README.adoc rename to vendor/github.com/gdamore/tcell/v2/README.md index b9d650b48..b7727e081 100644 --- a/vendor/github.com/gdamore/tcell/v2/README.adoc +++ b/vendor/github.com/gdamore/tcell/v2/README.md @@ -1,88 +1,85 @@ -= tcell +# ![Tcell](logos/tcell.png) -image:https://img.shields.io/travis/gdamore/tcell.svg?label=linux[Linux Status,link="https://travis-ci.org/gdamore/tcell"] -image:https://img.shields.io/appveyor/ci/gdamore/tcell.svg?label=windows[Windows Status,link="https://ci.appveyor.com/project/gdamore/tcell"] -image:https://img.shields.io/badge/license-APACHE2-blue.svg[Apache License,link="https://github.com/gdamore/tcell/blob/master/LICENSE"] -image:https://img.shields.io/badge/godoc-reference-blue.svg[GoDoc,link="https://godoc.org/github.com/gdamore/tcell"] -image:https://goreportcard.com/badge/gdamore/tcell[Go Report Card,link="http://goreportcard.com/report/gdamore/tcell"] -image:https://img.shields.io/discord/639503822733180969?label=discord[Discord,link="https://discord.gg/urTTxDN"] -image:https://codecov.io/gh/gdamore/tcell/branch/master/graph/badge.svg[codecov,link="https://codecov.io/gh/gdamore/tcell"] - -[cols="2",grid="none"] -|=== -|_Tcell_ is a _Go_ package that provides a cell based view for text terminals, like _XTerm_. +_Tcell_ is a _Go_ package that provides a cell based view for text terminals, like _XTerm_. It was inspired by _termbox_, but includes many additional improvements. -a|[.right] -image::logos/tcell.png[float="right"] -|=== + +[![Linux Status](https://img.shields.io/travis/gdamore/tcell.svg?label=linux)](https://travis-ci.org/gdamore/tcell) +[![Windows Status](https://img.shields.io/appveyor/ci/gdamore/tcell.svg?label=windows)](https://ci.appveyor.com/project/gdamore/tcell) +[![Apache License](https://img.shields.io/badge/license-APACHE2-blue.svg)](https://github.com/gdamore/tcell/blob/master/LICENSE) +[![Documentation](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/gdamore/tcell/v2) +[![Report Card](https://goreportcard.com/badge/gdamore/tcell)](http://goreportcard.com/report/gdamore/tcell/v2) +[![Discord](https://img.shields.io/discord/639503822733180969?label=discord)](https://discord.gg/urTTxDN) +[![Coverage](https://codecov.io/gh/gdamore/tcell/branch/master/graph/badge.svg)](https://codecov.io/gh/gdamore/tcell) + NOTE: This is version 2 of _Tcell_. There are breaking changes relative to version 1. Version 1.x remains available using the import `github.com/gdamore/tcell`. -== Examples +## Tutorial -* https://github.com/gdamore/proxima5[proxima5] - space shooter (https://youtu.be/jNxKTCmY_bQ[video]) -* https://github.com/gdamore/govisor[govisor] - service management UI (http://2.bp.blogspot.com/--OsvnfzSNow/Vf7aqMw3zXI/AAAAAAAAARo/uOMtOvw4Sbg/s1600/Screen%2BShot%2B2015-09-20%2Bat%2B9.08.41%2BAM.png[screenshot]) -* mouse demo - included mouse test (http://2.bp.blogspot.com/-fWvW5opT0es/VhIdItdKqJI/AAAAAAAAATE/7Ojc0L1SpB0/s1600/Screen%2BShot%2B2015-10-04%2Bat%2B11.47.13%2BPM.png[screenshot]) -* https://github.com/gdamore/gomatrix[gomatrix] - converted from Termbox -* https://github.com/zyedidia/micro/[micro] - lightweight text editor with syntax-highlighting and themes -* https://github.com/viktomas/godu[godu] - simple golang utility helping to discover large files/folders. -* https://github.com/rivo/tview/[tview] - rich interactive widgets for terminal UIs -* https://github.com/awesome-gocui/gocui[awesome gocui] - Go Console User Interface -* https://github.com/rgm3/gomandelbrot[gomandelbrot] - Mandelbrot! -* https://github.com/senorprogrammer/wtf[WTF]- Personal information dashboard for your terminal -* https://github.com/browsh-org/browsh[browsh] - A fully-modern text-based browser, rendering to TTY and browsers (https://www.youtube.com/watch?v=HZq86XfBoRo[video]) -* https://github.com/sachaos/go-life[go-life] - Conway's Game of Life. -* https://github.com/gcla/gowid[gowid] - compositional widgets for terminal UIs, inspired by urwid -* https://termshark.io[termshark] - a terminal UI for tshark, inspired by Wireshark, built on gowid -* https://github.com/MichaelS11/go-tetris[go-tetris] - Go Tetris with AI option -* https://github.com/junegunn/fzf[fzf] - A command-line fuzzy finder -* https://github.com/esimov/ascii-fluid[ascii-fluid] - A terminal based ASCII fluid simulation controlled by webcam -* https://gitlab.com/tslocum/cbind[cbind] - Provides key event encoding, decoding and handling -* https://github.com/spinzed/tpong[tpong] - The old-school Pong remade in terminal -* https://git.sr.ht/~sircmpwn/aerc[aerc] - An email client for your terminal. -* https://github.com/ezeoleaf/tblogs[tblogs] - A terminal based development blogs reader -* https://github.com/lallassu/spinc[spinc] - An irssi inspired terminal chat application for Cisco Spark/WebEx -* https://github.com/lallassu/gorss[gorss] - A RSS/Atom feed reader for your terminal -* https://github.com/Bios-Marcel/memoryalike[memoryalike] - A game where you have to memorize runes and hit their respective keys -* https://github.com/gokcehan/lf[lf] - Terminal file manager -* https://github.com/bunyk/gokeybr[gokeybr] - program that helps to deliberately practice your typing. -* https://github.com/jbaramidze/gonano[gonano] - CLI test editor -* https://github.com/tmountain/uchess[uchess] - A UCI chess client for your terminal -* https://github.com/a-h/min[min] - A Gemini browser -* https://github.com/noborus/ov[ov] - Terminal pager -* https://github.com/gcla/tmux-wormhole[tmux-wormhole] - A tmux plugin to transfer files with magic wormhole -* https://github.com/anaseto/gruid-tcell[gruid-tcell] - A tcell driver for the grid based UI and game framework gruid. -* https://github.com/aretext/aretext[aretext] - Minimalist text editor with vim key bindings. +A brief, and still somewhat rough, [tutorial](TUTORIAL.md) is available. +## Examples -== Pure Go Terminfo Database +* [proxima5](https://github.com/gdamore/proxima5) - space shooter ([video](https://youtu.be/jNxKTCmY_bQ)) +* [govisor](https://github.com/gdamore/govisor) - service management UI ([screenshot](http://2.bp.blogspot.com/--OsvnfzSNow/Vf7aqMw3zXI/AAAAAAAAARo/uOMtOvw4Sbg/s1600/Screen%2BShot%2B2015-09-20%2Bat%2B9.08.41%2BAM.png)) +* mouse demo - included mouse test ([screenshot](http://2.bp.blogspot.com/-fWvW5opT0es/VhIdItdKqJI/AAAAAAAAATE/7Ojc0L1SpB0/s1600/Screen%2BShot%2B2015-10-04%2Bat%2B11.47.13%2BPM.png)) +* [gomatrix](https://github.com/gdamore/gomatrix) - converted from Termbox +* [micro](https://github.com/zyedidia/micro/) - lightweight text editor with syntax-highlighting and themes +* [godu](https://github.com/viktomas/godu) - utility to discover large files/folders +* [tview](https://github.com/rivo/tview/) - rich interactive widgets +* [cview](https://code.rocketnine.space/tslocum/cview) - user interface toolkit (fork of _tview_) +* [awsome gocui](https://github.com/awesome-gocui/gocui) - Go Console User Interface +* [gomandelbrot](https://github.com/rgm3/gomandelbrot) - Mandelbrot! +* [WTF](https://github.com/senorprogrammer/wtf) - personal information dashboard +* [browsh](https://github.com/browsh-org/browsh) - modern web browser ([video](https://www.youtube.com/watch?v=HZq86XfBoRo)) +* [go-life](https://github.com/sachaos/go-life) - Conway's Game of Life +* [gowid](https://github.com/gcla/gowid) - compositional widgets for terminal UIs, inspired by _urwid_ +* [termshark](https://termshark.io) - interface for _tshark_, inspired by Wireshark, built on _gowid_ +* [go-tetris](https://github.com/MichaelS11/go-tetris) - Go Tetris with AI option +* [fzf](https://github.com/junegunn/fzf) - command-line fuzzy finder +* [ascii-fluid](https://github.com/esimov/ascii-fluid) - fluid simulation controlled by webcam +* [cbind](https://code.rocketnine.space/tslocum/cbind) - key event encoding, decoding and handling +* [tpong](https://github.com/spinzed/tpong) - old-school Pong +* [aerc](https://git.sr.ht/~sircmpwn/aerc) - email client +* [tblogs](https://github.com/ezeoleaf/tblogs) - development blogs reader +* [spinc](https://github.com/lallassu/spinc) - _irssi_ inspired chat application for Cisco Spark/WebEx +* [gorss](https://github.com/lallassu/gorss) - RSS/Atom feed reader +* [memoryalike](https://github.com/Bios-Marcel/memoryalike) - memorization game +* [lf](https://github.com/gokcehan/lf) - file manager +* [gokeybr](https://github.com/bunyk/gokeybr) - deliberately practice your typing +* [gonano](https://github.com/jbaramidze/gonano) - editor, mimics _nano_ +* [uchess](https://github.com/tmountain/uchess) - UCI chess client +* [min](https://github.com/a-h/min) - Gemini browser +* [ov](https://github.com/noborus/ov) - file pager +* [tmux-wormhole](https://github.com/gcla/tmux-wormhole) - _tmux_ plugin to transfer files +* [gruid-tcell](https://github.com/anaseto/gruid-tcell) - driver for the grid based UI and game framework +* [aretext](https://github.com/aretext/aretext) - minimalist text editor with _vim_ key bindings + +## Pure Go Terminfo Database _Tcell_ includes a full parser and expander for terminfo capability strings, so that it can avoid hard coding escape strings for formatting. It also favors portability, and includes support for all POSIX systems. -The database is also flexible & extensible, and can modified by either running +The database is also flexible & extensible, and can be modified by either running a program to build the entire database, or an entry for just a single terminal. -== More Portable +## More Portable _Tcell_ is portable to a wide variety of systems, and is pure Go, without any need for CGO. _Tcell_ is believed to work with mainstream systems officially supported by golang. -== No Async IO +## No Async IO _Tcell_ is able to operate without requiring `SIGIO` signals (unlike _termbox_), -or asynchronous I/O, and can instead use standard Go file -objects and Go routines. +or asynchronous I/O, and can instead use standard Go file objects and Go routines. This means it should be safe, especially for -use with programs that use exec, or otherwise need to manipulate the -tty streams. -This model is also much closer to idiomatic Go, leading -to fewer surprises. +use with programs that use exec, or otherwise need to manipulate the tty streams. +This model is also much closer to idiomatic Go, leading to fewer surprises. -== Rich Unicode & non-Unicode support +## Rich Unicode & non-Unicode support _Tcell_ includes enhanced support for Unicode, including wide characters and combining characters, provided your terminal can support them. @@ -91,18 +88,19 @@ Windows terminals generally don't support the full Unicode repertoire. It will also convert to and from Unicode locales, so that the program can work with UTF-8 internally, and get reasonable output in other locales. -_Tcell_ tries hard to convert to native characters on both input and output, and -on output _Tcell_ even makes use of the alternate character set to facilitate +_Tcell_ tries hard to convert to native characters on both input and output. +On output _Tcell_ even makes use of the alternate character set to facilitate drawing certain characters. -== More Function Keys +## More Function Keys -_Tcell_ also has richer support for a larger number of special keys that some terminals can send. +_Tcell_ also has richer support for a larger number of special keys that some +terminals can send. -== Better Color Handling +## Better Color Handling -_Tcell_ will respect your terminal's color space as specified within your terminfo -entries, so that for example attempts to emit color sequences on VT100 terminals +_Tcell_ will respect your terminal's color space as specified within your terminfo entries. +For example attempts to emit color sequences on VT100 terminals won't result in unintended consequences. In legacy Windows mode, _Tcell_ supports 16 colors, bold, dim, and reverse, @@ -113,7 +111,7 @@ Modern Windows 10 can benefit from much richer colors however. _Tcell_ maps 16 colors down to 8, for terminals that need it. (The upper 8 colors are just brighter versions of the lower 8.) -== Better Mouse Support +## Better Mouse Support _Tcell_ supports enhanced mouse tracking mode, so your application can receive regular mouse motion events, and wheel events, if your terminal supports it. @@ -122,51 +120,50 @@ regular mouse motion events, and wheel events, if your terminal supports it. and does not support mouse interaction. The stock Windows 10 console host fired up with cmd.exe or PowerShell works fine however.) -== _Termbox_ Compatibility +## _Termbox_ Compatibility A compatibility layer for _termbox_ is provided in the `compat` directory. To use it, try importing `github.com/gdamore/tcell/termbox` instead. Most _termbox-go_ programs will probably work without further modification. -== Working With Unicode +## Working With Unicode -Internally Tcell uses UTF-8, just like Go. -However, Tcell understands how to +Internally _Tcell_ uses UTF-8, just like Go. +However, _Tcell_ understands how to convert to and from other character sets, using the capabilities of the `golang.org/x/text/encoding packages`. Your application must supply -them, as the full set of the most common ones bloats the program by about 2MB. +them, as the full set of the most common ones bloats the program by about 2 MB. If you're lazy, and want them all anyway, see the `encoding` sub-directory. -== Wide & Combining Characters +## Wide & Combining Characters The `SetContent()` API takes a primary rune, and an optional list of combining runes. If any of the runes is a wide (East Asian) rune occupying two cells, -then the library will skip output from the following cell, but care must be +then the library will skip output from the following cell. Care must be taken in the application to avoid explicitly attempting to set content in the -next cell, otherwise the results are undefined. (Normally wide character +next cell, otherwise the results are undefined. (Normally the wide character is displayed, and the other character is not; do not depend on that behavior.) Older terminal applications (especially on systems like Windows 8) lack support for advanced Unicode, and thus may not fare well. -== Colors +## Colors _Tcell_ assumes the ANSI/XTerm color model, including the 256 color map that XTerm uses when it supports 256 colors. The terminfo guidance will be honored, with respect to the number of colors supported. Also, only terminals which expose ANSI style `setaf` and `setab` will support color; if you have a color terminal that only has `setf` and `setb`, please submit -a ticket; it wouldn't be hard to add that if there is need. +a ticket. -== 24-bit Color +## 24-bit Color -_Tcell_ _supports true color_! (That is, if your terminal can support it, -_Tcell_ can accurately display 24-bit color.) +_Tcell_ _supports 24-bit color!_ (That is, if your terminal can support it.) NOTE: Technically the approach of using 24-bit RGB values for color is more -accurately described as "direct color", but most people use the term "true color", -and so we follow the (inaccurate) common convention. +accurately described as "direct color", but most people use the term "true color". +We follow the (inaccurate) common convention. There are a few ways you can enable (or disable) true color. @@ -175,15 +172,13 @@ includes the `RGB` or `Tc` capabilities (or rather it did when the database was updated.) * You can force this one by setting the `COLORTERM` environment variable to -"24-bit", "truecolor" or "24bit". This is the same method used +`24-bit`, `truecolor` or `24bit`. This is the same method used by most other terminal applications that support 24-bit color. * If you set your `TERM` environment variable to a value with the suffix `-truecolor` -then 24-bit color compatible with XTerm will be assumed (and the terminal will -otherwise use the same escape sequences as the base terminal definition.) - -NOTE: This feature is for compatibility with older _Tcell_ versions. -It is recommended to use one of other methods instead. +then 24-bit color compatible with XTerm and ECMA-48 will be assumed. +(This feature is deprecated. +It is recommended to use one of other methods listed above.) * You can disable 24-bit color by setting `TCELL_TRUECOLOR=disable` in your environment. @@ -195,12 +190,12 @@ than respecting themes. For other cases, such as typical text apps that only use a few colors, its more desirable to respect the themes that the user has established.) -== Performance +## Performance Reasonable attempts have been made to minimize sending data to terminals, avoiding repeated sequences or drawing the same cell on refresh updates. -== Terminfo +## Terminfo (Not relevant for Windows users.) @@ -218,11 +213,11 @@ are not supported. This is unlikely to be a problem; such terminals have not been mass-produced since the early 1970s. -== Mouse Support +## Mouse Support Mouse support is detected via the `kmous` terminfo variable, however, enablement/disablement and decoding mouse events is done using hard coded -sequences based on the XTerm X11 model. As of this writing all popular +sequences based on the XTerm X11 model. All popular terminals with mouse tracking support this model. (Full terminfo support is not possible as terminfo sequences are not defined.) @@ -230,35 +225,36 @@ On Windows, the mouse works normally. Mouse wheel buttons on various terminals are known to work, but the support in terminal emulators, as well as support for various buttons and -live mouse tracking, varies widely. Modern _xterm_, macOS _Terminal_, and _iTerm_ all work well. +live mouse tracking, varies widely. +Modern _xterm_, macOS _Terminal_, and _iTerm_ all work well. -== Bracketed Paste +## Bracketed Paste Terminals that appear to support the XTerm mouse model also can support bracketed paste, for applications that opt-in. See `EnablePaste()` for details. -== Testability +## Testability There is a `SimulationScreen`, that can be used to simulate a real screen for automated testing. The supplied tests do this. The simulation contains event delivery, screen resizing support, and capabilities to inject events and examine "`physical`" screen contents. -== Platforms +## Platforms -=== POSIX (Linux, FreeBSD, macOS, Solaris, etc.) +### POSIX (Linux, FreeBSD, macOS, Solaris, etc.) Everything works using pure Go on mainstream platforms. Some more esoteric -platforms (e.g. AIX) may need to be added. Pull requests are welcome! +platforms (e.g., AIX) may need to be added. Pull requests are welcome! -=== Windows +### Windows Windows console mode applications are supported. Modern console applications like ConEmu and the Windows 10 terminal, support all the good features (resize, mouse tracking, etc.) -=== Plan9, WASM, and others +### Plan9, WASM, and others These platforms won't work, but compilation stubs are supplied for folks that want to include parts of this in software for those @@ -268,18 +264,9 @@ allocate a real screen object on those platforms, `NewScreen()` will fail. If anyone has wisdom about how to improve support for these, please let me know. PRs are especially welcome. -=== Commercial Support +### Commercial Support _Tcell_ is absolutely free, but if you want to obtain commercial, professional support, there are options. -[cols="2",align="center",frame="none", grid="none"] -|=== -^.^| -image:logos/tidelift.png[100,100] -a| -https://tidelift.com/[Tidelift] subscriptions include support for _Tcell_, as well as many other open source packages. - -^.^| -image:logos/staysail.png[100,100] -a| -mailto:info@staysail.tech[Staysail Systems, Inc.] offers direct support, and custom development around _Tcell_ on an hourly basis. +* [TideLift](https://tidelift.com/) subscriptions include support for _Tcell_, as well as many other open source packages. +* [Staysail Systems Inc.](mailto:info@staysail.tech) offers direct support, and custom development around _Tcell_ on an hourly basis. diff --git a/vendor/github.com/gdamore/tcell/v2/TUTORIAL.adoc b/vendor/github.com/gdamore/tcell/v2/TUTORIAL.md similarity index 82% rename from vendor/github.com/gdamore/tcell/v2/TUTORIAL.adoc rename to vendor/github.com/gdamore/tcell/v2/TUTORIAL.md index c5d6a1a2d..8d14f3311 100644 --- a/vendor/github.com/gdamore/tcell/v2/TUTORIAL.adoc +++ b/vendor/github.com/gdamore/tcell/v2/TUTORIAL.md @@ -1,30 +1,32 @@ -= tcell tutorial +# _Tcell_ Tutorial -tcell provides a low-level, portable API for building terminal-based programs. -A https://en.wikipedia.org/wiki/Terminal_emulator[terminal emulator] is used to -interact with such a program. +_Tcell_ provides a low-level, portable API for building terminal-based programs. +A [terminal emulator](https://en.wikipedia.org/wiki/Terminal_emulator) +(or a real terminal such as a DEC VT-220) is used to interact with such a program. -Applications typically initialize a screen and enter an event loop, then -finalize the screen before exiting. +_Tcell_'s interface is fairly low-level. +While it provides a reasonably portable way of dealing with all the usual terminal +features, it may be easier to utilize a higher level framework. +A number of such frameworks are listed on the _Tcell_ main [README](README.md). -Application frameworks such as https://github.com/rivo/tview[tview] and -https://gitlab.com/tslocum/cview[cview] provide widgets and additional features. +This tutorial provides the details of _Tcell_, and is appropriate for developers +wishing to create their own application frameworks or needing more direct access +to the terminal capabilities. -== Resize events +## Resize events Applications receive an event of type `EventResize` when they are first initialized and each time the terminal is resized. The new size is available as `Size`. -[source,go] ----- +```golang switch ev := ev.(type) { case *tcell.EventResize: w, h := ev.Size() logMessage(fmt.Sprintf("Resized to %dx%d", w, h)) } ----- +``` -== Key events +## Key events When a key is pressed, applications receive an event of type `EventKey`. This event describes the modifier keys pressed (if any) and the pressed key or rune. @@ -33,16 +35,15 @@ When a rune key is pressed, an event with its `Key` set to `KeyRune` is dispatch When a non-rune key is pressed, it is available as the `Key` of the event. -[source,go] ----- +```golang switch ev := ev.(type) { case *tcell.EventKey: mod, key, ch := ev.Mod(), ev.Key(), ev.Rune() logMessage(fmt.Sprintf("EventKey Modifiers: %d Key: %d Rune: %d", mod, key, ch)) } ----- +``` -=== Key event restrictions +### Key event restrictions Terminal-based programs have less visibility into keyboard activity than graphical applications. @@ -53,12 +54,7 @@ Key release events are not available. It is not possible to distinguish runes typed while holding shift and runes typed using caps lock. Capital letters are reported without the Shift modifier. -=== Key event handling library - -https://gitlab.com/tslocum/cbind[cbind] provides key event encoding and decoding -to and from human-readable strings. It also provides keybinding-based input handling. - -== Mouse events +## Mouse events Applications receive an event of type `EventMouse` when the mouse moves, or a mouse button is pressed or released. Mouse events are only delivered if @@ -66,8 +62,7 @@ Mouse events are only delivered if The mouse buttons being pressed (if any) are available as `Buttons`, and the position of the mouse is available as `Position`. -[source,go] ----- +```golang switch ev := ev.(type) { case *tcell.EventMouse: mod := ev.Modifiers() @@ -75,46 +70,23 @@ case *tcell.EventMouse: x, y := ev.Position() logMessage(fmt.Sprintf("EventMouse Modifiers: %d Buttons: %d Position: %d,%d", mod, btns, x, y)) } ----- +``` -=== Mouse buttons +### Mouse buttons -[cols=3*,options=header] -|=== +Identifier | Alias | Description +-----------|-----------------|----------- +Button1 | ButtonPrimary | Left button +Button2 | ButtonSecondary | Right button +Button3 | ButtonMiddle | Middle button +Button4 | | Side button (thumb/next) +Button5 | | Side button (thumb/prev) -|Identifier -|Alias -|Description - -|Button1 -|ButtonPrimary -|Left button - -|Button2 -|ButtonSecondary -|Right button - -|Button3 -|ButtonMiddle -|Middle button - -|Button4 -| -|Side button (thumb/next) - -|Button5 -| -|Side button (thumb/prev) - -|=== - -== Usage +## Usage To create a tcell application, first initialize a screen to hold it. -[source,go] ----- -// Initialize screen +```golang s, err := tcell.NewScreen() if err != nil { log.Fatalf("%+v", err) @@ -129,21 +101,19 @@ s.SetStyle(defStyle) // Clear screen s.Clear() ----- +``` Text may be drawn on the screen using `SetContent`. -[source,go] ----- +```golang s.SetContent(0, 0, 'H', nil, defStyle) s.SetContent(1, 0, 'i', nil, defStyle) s.SetContent(2, 0, '!', nil, defStyle) ----- +``` To draw text more easily, define a render function. -[source,go] ----- +```golang func drawText(s tcell.Screen, x1, y1, x2, y2 int, style tcell.Style, text string) { row := y1 col := x1 @@ -159,12 +129,11 @@ func drawText(s tcell.Screen, x1, y1, x2, y2 int, style tcell.Style, text string } } } ----- +``` Lastly, define an event loop to handle user input and update application state. -[source,go] ----- +```golang quit := func() { s.Fini() os.Exit(0) @@ -186,14 +155,13 @@ for { } } } ----- +``` -== Demo application +## Demo application The following demonstrates how to initialize a screen, draw text/graphics and handle user input. -[source,go] ----- +```golang package main import ( @@ -322,4 +290,4 @@ func main() { } } } ----- +``` diff --git a/vendor/github.com/gdamore/tcell/v2/console_win.go b/vendor/github.com/gdamore/tcell/v2/console_win.go index 7c5716039..a901a1255 100644 --- a/vendor/github.com/gdamore/tcell/v2/console_win.go +++ b/vendor/github.com/gdamore/tcell/v2/console_win.go @@ -343,6 +343,26 @@ func (s *cScreen) PostEvent(ev Event) error { } } +func (s *cScreen) ChannelEvents(ch chan<- Event, quit <-chan struct{}) { + defer close(ch) + for { + select { + case <-quit: + return + case <-s.stopQ: + return + case ev := <-s.evch: + select { + case <-quit: + return + case <-s.stopQ: + return + case ch <- ev: + } + } + } +} + func (s *cScreen) PollEvent() Event { select { case <-s.stopQ: diff --git a/vendor/github.com/gdamore/tcell/v2/screen.go b/vendor/github.com/gdamore/tcell/v2/screen.go index 2d9a9ad98..cbe505f9e 100644 --- a/vendor/github.com/gdamore/tcell/v2/screen.go +++ b/vendor/github.com/gdamore/tcell/v2/screen.go @@ -78,6 +78,17 @@ type Screen interface { // response to a call to Clear or Flush. Size() (int, int) + // ChannelEvents is an infinite loop that waits for an event and + // channels it into the user provided channel ch. Closing the + // quit channel and calling the Fini method are cancellation + // signals. When a cancellation signal is received the method + // returns after closing ch. + // + // This method should be used as a goroutine. + // + // NOTE: PollEvent should not be called while this method is running. + ChannelEvents(ch chan<- Event, quit <-chan struct{}) + // PollEvent waits for events to arrive. Main application loops // must spin on this to prevent the application from stalling. // Furthermore, this will return nil if the Screen is finalized. diff --git a/vendor/github.com/gdamore/tcell/v2/simulation.go b/vendor/github.com/gdamore/tcell/v2/simulation.go index 468aeebf7..451460be2 100644 --- a/vendor/github.com/gdamore/tcell/v2/simulation.go +++ b/vendor/github.com/gdamore/tcell/v2/simulation.go @@ -351,6 +351,26 @@ func (s *simscreen) Colors() int { return 256 } +func (s *simscreen) ChannelEvents(ch chan<- Event, quit <-chan struct{}) { + defer close(ch) + for { + select { + case <-quit: + return + case <-s.quit: + return + case ev := <-s.evch: + select { + case <-quit: + return + case <-s.quit: + return + case ch <- ev: + } + } + } +} + func (s *simscreen) PollEvent() Event { select { case <-s.quit: @@ -531,4 +551,4 @@ func (s *simscreen) Suspend() error { func (s *simscreen) Resume() error { return nil -} \ No newline at end of file +} diff --git a/vendor/github.com/gdamore/tcell/v2/tscreen.go b/vendor/github.com/gdamore/tcell/v2/tscreen.go index 49aacf14c..ebd61a258 100644 --- a/vendor/github.com/gdamore/tcell/v2/tscreen.go +++ b/vendor/github.com/gdamore/tcell/v2/tscreen.go @@ -638,7 +638,7 @@ func (t *tScreen) drawCell(x, y int) int { t.TPuts(ti.TGoto(x-1, y)) t.TPuts(ti.InsertChar) t.cy = y - t.cx = x-1 + t.cx = x - 1 t.cells.SetDirty(x-1, y, true) _ = t.drawCell(x-1, y) t.TPuts(t.ti.TGoto(0, 0)) @@ -941,6 +941,26 @@ func (t *tScreen) nColors() int { return t.ti.Colors } +func (t *tScreen) ChannelEvents(ch chan<- Event, quit <-chan struct{}) { + defer close(ch) + for { + select { + case <-quit: + return + case <-t.quit: + return + case ev := <-t.evch: + select { + case <-quit: + return + case <-t.quit: + return + case ch <- ev: + } + } + } +} + func (t *tScreen) PollEvent() Event { select { case <-t.quit: diff --git a/vendor/github.com/go-errors/errors/README.md b/vendor/github.com/go-errors/errors/README.md index d03882f1b..2ee13f117 100644 --- a/vendor/github.com/go-errors/errors/README.md +++ b/vendor/github.com/go-errors/errors/README.md @@ -78,3 +78,4 @@ This package is licensed under the MIT license, see LICENSE.MIT for details. >. errors.AsError(errors.Wrap(err)).ErrorStack() > ``` * v1.4.0 *BREAKING* v1.4.0 reverted all changes from v1.3.0 and is identical to v1.2.0 +* v1.4.1 no code change, but now without an unnecessary cover.out file. diff --git a/vendor/github.com/go-errors/errors/cover.out b/vendor/github.com/go-errors/errors/cover.out deleted file mode 100644 index ab18b0519..000000000 --- a/vendor/github.com/go-errors/errors/cover.out +++ /dev/null @@ -1,89 +0,0 @@ -mode: set -github.com/go-errors/errors/stackframe.go:27.51,30.25 2 1 -github.com/go-errors/errors/stackframe.go:33.2,38.8 3 1 -github.com/go-errors/errors/stackframe.go:30.25,32.3 1 0 -github.com/go-errors/errors/stackframe.go:43.47,44.31 1 1 -github.com/go-errors/errors/stackframe.go:47.2,47.48 1 1 -github.com/go-errors/errors/stackframe.go:44.31,46.3 1 1 -github.com/go-errors/errors/stackframe.go:52.42,56.16 3 1 -github.com/go-errors/errors/stackframe.go:60.2,60.60 1 1 -github.com/go-errors/errors/stackframe.go:56.16,58.3 1 0 -github.com/go-errors/errors/stackframe.go:64.55,67.16 2 1 -github.com/go-errors/errors/stackframe.go:71.2,72.61 2 1 -github.com/go-errors/errors/stackframe.go:76.2,76.66 1 1 -github.com/go-errors/errors/stackframe.go:67.16,69.3 1 0 -github.com/go-errors/errors/stackframe.go:72.61,74.3 1 0 -github.com/go-errors/errors/stackframe.go:79.56,91.63 3 1 -github.com/go-errors/errors/stackframe.go:95.2,95.53 1 1 -github.com/go-errors/errors/stackframe.go:100.2,101.18 2 1 -github.com/go-errors/errors/stackframe.go:91.63,94.3 2 1 -github.com/go-errors/errors/stackframe.go:95.53,98.3 2 1 -github.com/go-errors/errors/error.go:70.32,73.23 2 1 -github.com/go-errors/errors/error.go:80.2,85.3 3 1 -github.com/go-errors/errors/error.go:74.2,75.10 1 1 -github.com/go-errors/errors/error.go:76.2,77.28 1 1 -github.com/go-errors/errors/error.go:92.43,95.23 2 1 -github.com/go-errors/errors/error.go:104.2,109.3 3 1 -github.com/go-errors/errors/error.go:96.2,97.11 1 1 -github.com/go-errors/errors/error.go:98.2,99.10 1 1 -github.com/go-errors/errors/error.go:100.2,101.28 1 1 -github.com/go-errors/errors/error.go:115.39,117.19 1 1 -github.com/go-errors/errors/error.go:121.2,121.29 1 1 -github.com/go-errors/errors/error.go:125.2,125.43 1 1 -github.com/go-errors/errors/error.go:129.2,129.14 1 1 -github.com/go-errors/errors/error.go:117.19,119.3 1 1 -github.com/go-errors/errors/error.go:121.29,123.3 1 1 -github.com/go-errors/errors/error.go:125.43,127.3 1 1 -github.com/go-errors/errors/error.go:135.53,137.2 1 1 -github.com/go-errors/errors/error.go:140.34,142.2 1 1 -github.com/go-errors/errors/error.go:146.34,149.42 2 1 -github.com/go-errors/errors/error.go:153.2,153.20 1 1 -github.com/go-errors/errors/error.go:149.42,151.3 1 1 -github.com/go-errors/errors/error.go:158.39,160.2 1 1 -github.com/go-errors/errors/error.go:164.46,165.23 1 1 -github.com/go-errors/errors/error.go:173.2,173.19 1 1 -github.com/go-errors/errors/error.go:165.23,168.32 2 1 -github.com/go-errors/errors/error.go:168.32,170.4 1 1 -github.com/go-errors/errors/error.go:177.37,178.42 1 1 -github.com/go-errors/errors/error.go:181.2,181.41 1 1 -github.com/go-errors/errors/error.go:178.42,180.3 1 1 -github.com/go-errors/errors/parse_panic.go:10.39,12.2 1 1 -github.com/go-errors/errors/parse_panic.go:16.46,24.34 5 1 -github.com/go-errors/errors/parse_panic.go:70.2,70.43 1 1 -github.com/go-errors/errors/parse_panic.go:73.2,73.55 1 0 -github.com/go-errors/errors/parse_panic.go:24.34,27.23 2 1 -github.com/go-errors/errors/parse_panic.go:27.23,28.42 1 1 -github.com/go-errors/errors/parse_panic.go:28.42,31.5 2 1 -github.com/go-errors/errors/parse_panic.go:31.6,33.5 1 0 -github.com/go-errors/errors/parse_panic.go:35.5,35.29 1 1 -github.com/go-errors/errors/parse_panic.go:35.29,36.86 1 1 -github.com/go-errors/errors/parse_panic.go:36.86,38.5 1 1 -github.com/go-errors/errors/parse_panic.go:40.5,40.32 1 1 -github.com/go-errors/errors/parse_panic.go:40.32,41.18 1 1 -github.com/go-errors/errors/parse_panic.go:45.4,46.46 2 1 -github.com/go-errors/errors/parse_panic.go:51.4,53.23 2 1 -github.com/go-errors/errors/parse_panic.go:57.4,58.18 2 1 -github.com/go-errors/errors/parse_panic.go:62.4,63.17 2 1 -github.com/go-errors/errors/parse_panic.go:41.18,43.10 2 1 -github.com/go-errors/errors/parse_panic.go:46.46,49.5 2 1 -github.com/go-errors/errors/parse_panic.go:53.23,55.5 1 0 -github.com/go-errors/errors/parse_panic.go:58.18,60.5 1 0 -github.com/go-errors/errors/parse_panic.go:63.17,65.10 2 1 -github.com/go-errors/errors/parse_panic.go:70.43,72.3 1 1 -github.com/go-errors/errors/parse_panic.go:80.85,82.29 2 1 -github.com/go-errors/errors/parse_panic.go:85.2,85.15 1 1 -github.com/go-errors/errors/parse_panic.go:88.2,90.63 2 1 -github.com/go-errors/errors/parse_panic.go:94.2,94.53 1 1 -github.com/go-errors/errors/parse_panic.go:99.2,101.36 2 1 -github.com/go-errors/errors/parse_panic.go:105.2,106.15 2 1 -github.com/go-errors/errors/parse_panic.go:109.2,112.49 3 1 -github.com/go-errors/errors/parse_panic.go:116.2,117.16 2 1 -github.com/go-errors/errors/parse_panic.go:121.2,126.8 1 1 -github.com/go-errors/errors/parse_panic.go:82.29,84.3 1 0 -github.com/go-errors/errors/parse_panic.go:85.15,87.3 1 1 -github.com/go-errors/errors/parse_panic.go:90.63,93.3 2 1 -github.com/go-errors/errors/parse_panic.go:94.53,97.3 2 1 -github.com/go-errors/errors/parse_panic.go:101.36,103.3 1 0 -github.com/go-errors/errors/parse_panic.go:106.15,108.3 1 0 -github.com/go-errors/errors/parse_panic.go:112.49,114.3 1 1 -github.com/go-errors/errors/parse_panic.go:117.16,119.3 1 0 diff --git a/vendor/github.com/gobwas/glob/.gitignore b/vendor/github.com/gobwas/glob/.gitignore new file mode 100644 index 000000000..b4ae623be --- /dev/null +++ b/vendor/github.com/gobwas/glob/.gitignore @@ -0,0 +1,8 @@ +glob.iml +.idea +*.cpu +*.mem +*.test +*.dot +*.png +*.svg diff --git a/vendor/github.com/gobwas/glob/LICENSE b/vendor/github.com/gobwas/glob/LICENSE new file mode 100644 index 000000000..9d4735cad --- /dev/null +++ b/vendor/github.com/gobwas/glob/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Sergey Kamardin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/gobwas/glob/bench.sh b/vendor/github.com/gobwas/glob/bench.sh new file mode 100644 index 000000000..804cf22e6 --- /dev/null +++ b/vendor/github.com/gobwas/glob/bench.sh @@ -0,0 +1,26 @@ +#! /bin/bash + +bench() { + filename="/tmp/$1-$2.bench" + if test -e "${filename}"; + then + echo "Already exists ${filename}" + else + backup=`git rev-parse --abbrev-ref HEAD` + git checkout $1 + echo -n "Creating ${filename}... " + go test ./... -run=NONE -bench=$2 > "${filename}" -benchmem + echo "OK" + git checkout ${backup} + sleep 5 + fi +} + + +to=$1 +current=`git rev-parse --abbrev-ref HEAD` + +bench ${to} $2 +bench ${current} $2 + +benchcmp $3 "/tmp/${to}-$2.bench" "/tmp/${current}-$2.bench" diff --git a/vendor/github.com/gobwas/glob/compiler/compiler.go b/vendor/github.com/gobwas/glob/compiler/compiler.go new file mode 100644 index 000000000..02e7de80a --- /dev/null +++ b/vendor/github.com/gobwas/glob/compiler/compiler.go @@ -0,0 +1,525 @@ +package compiler + +// TODO use constructor with all matchers, and to their structs private +// TODO glue multiple Text nodes (like after QuoteMeta) + +import ( + "fmt" + "reflect" + + "github.com/gobwas/glob/match" + "github.com/gobwas/glob/syntax/ast" + "github.com/gobwas/glob/util/runes" +) + +func optimizeMatcher(matcher match.Matcher) match.Matcher { + switch m := matcher.(type) { + + case match.Any: + if len(m.Separators) == 0 { + return match.NewSuper() + } + + case match.AnyOf: + if len(m.Matchers) == 1 { + return m.Matchers[0] + } + + return m + + case match.List: + if m.Not == false && len(m.List) == 1 { + return match.NewText(string(m.List)) + } + + return m + + case match.BTree: + m.Left = optimizeMatcher(m.Left) + m.Right = optimizeMatcher(m.Right) + + r, ok := m.Value.(match.Text) + if !ok { + return m + } + + var ( + leftNil = m.Left == nil + rightNil = m.Right == nil + ) + if leftNil && rightNil { + return match.NewText(r.Str) + } + + _, leftSuper := m.Left.(match.Super) + lp, leftPrefix := m.Left.(match.Prefix) + la, leftAny := m.Left.(match.Any) + + _, rightSuper := m.Right.(match.Super) + rs, rightSuffix := m.Right.(match.Suffix) + ra, rightAny := m.Right.(match.Any) + + switch { + case leftSuper && rightSuper: + return match.NewContains(r.Str, false) + + case leftSuper && rightNil: + return match.NewSuffix(r.Str) + + case rightSuper && leftNil: + return match.NewPrefix(r.Str) + + case leftNil && rightSuffix: + return match.NewPrefixSuffix(r.Str, rs.Suffix) + + case rightNil && leftPrefix: + return match.NewPrefixSuffix(lp.Prefix, r.Str) + + case rightNil && leftAny: + return match.NewSuffixAny(r.Str, la.Separators) + + case leftNil && rightAny: + return match.NewPrefixAny(r.Str, ra.Separators) + } + + return m + } + + return matcher +} + +func compileMatchers(matchers []match.Matcher) (match.Matcher, error) { + if len(matchers) == 0 { + return nil, fmt.Errorf("compile error: need at least one matcher") + } + if len(matchers) == 1 { + return matchers[0], nil + } + if m := glueMatchers(matchers); m != nil { + return m, nil + } + + idx := -1 + maxLen := -1 + var val match.Matcher + for i, matcher := range matchers { + if l := matcher.Len(); l != -1 && l >= maxLen { + maxLen = l + idx = i + val = matcher + } + } + + if val == nil { // not found matcher with static length + r, err := compileMatchers(matchers[1:]) + if err != nil { + return nil, err + } + return match.NewBTree(matchers[0], nil, r), nil + } + + left := matchers[:idx] + var right []match.Matcher + if len(matchers) > idx+1 { + right = matchers[idx+1:] + } + + var l, r match.Matcher + var err error + if len(left) > 0 { + l, err = compileMatchers(left) + if err != nil { + return nil, err + } + } + + if len(right) > 0 { + r, err = compileMatchers(right) + if err != nil { + return nil, err + } + } + + return match.NewBTree(val, l, r), nil +} + +func glueMatchers(matchers []match.Matcher) match.Matcher { + if m := glueMatchersAsEvery(matchers); m != nil { + return m + } + if m := glueMatchersAsRow(matchers); m != nil { + return m + } + return nil +} + +func glueMatchersAsRow(matchers []match.Matcher) match.Matcher { + if len(matchers) <= 1 { + return nil + } + + var ( + c []match.Matcher + l int + ) + for _, matcher := range matchers { + if ml := matcher.Len(); ml == -1 { + return nil + } else { + c = append(c, matcher) + l += ml + } + } + return match.NewRow(l, c...) +} + +func glueMatchersAsEvery(matchers []match.Matcher) match.Matcher { + if len(matchers) <= 1 { + return nil + } + + var ( + hasAny bool + hasSuper bool + hasSingle bool + min int + separator []rune + ) + + for i, matcher := range matchers { + var sep []rune + + switch m := matcher.(type) { + case match.Super: + sep = []rune{} + hasSuper = true + + case match.Any: + sep = m.Separators + hasAny = true + + case match.Single: + sep = m.Separators + hasSingle = true + min++ + + case match.List: + if !m.Not { + return nil + } + sep = m.List + hasSingle = true + min++ + + default: + return nil + } + + // initialize + if i == 0 { + separator = sep + } + + if runes.Equal(sep, separator) { + continue + } + + return nil + } + + if hasSuper && !hasAny && !hasSingle { + return match.NewSuper() + } + + if hasAny && !hasSuper && !hasSingle { + return match.NewAny(separator) + } + + if (hasAny || hasSuper) && min > 0 && len(separator) == 0 { + return match.NewMin(min) + } + + every := match.NewEveryOf() + + if min > 0 { + every.Add(match.NewMin(min)) + + if !hasAny && !hasSuper { + every.Add(match.NewMax(min)) + } + } + + if len(separator) > 0 { + every.Add(match.NewContains(string(separator), true)) + } + + return every +} + +func minimizeMatchers(matchers []match.Matcher) []match.Matcher { + var done match.Matcher + var left, right, count int + + for l := 0; l < len(matchers); l++ { + for r := len(matchers); r > l; r-- { + if glued := glueMatchers(matchers[l:r]); glued != nil { + var swap bool + + if done == nil { + swap = true + } else { + cl, gl := done.Len(), glued.Len() + swap = cl > -1 && gl > -1 && gl > cl + swap = swap || count < r-l + } + + if swap { + done = glued + left = l + right = r + count = r - l + } + } + } + } + + if done == nil { + return matchers + } + + next := append(append([]match.Matcher{}, matchers[:left]...), done) + if right < len(matchers) { + next = append(next, matchers[right:]...) + } + + if len(next) == len(matchers) { + return next + } + + return minimizeMatchers(next) +} + +// minimizeAnyOf tries to apply some heuristics to minimize number of nodes in given tree +func minimizeTree(tree *ast.Node) *ast.Node { + switch tree.Kind { + case ast.KindAnyOf: + return minimizeTreeAnyOf(tree) + default: + return nil + } +} + +// minimizeAnyOf tries to find common children of given node of AnyOf pattern +// it searches for common children from left and from right +// if any common children are found – then it returns new optimized ast tree +// else it returns nil +func minimizeTreeAnyOf(tree *ast.Node) *ast.Node { + if !areOfSameKind(tree.Children, ast.KindPattern) { + return nil + } + + commonLeft, commonRight := commonChildren(tree.Children) + commonLeftCount, commonRightCount := len(commonLeft), len(commonRight) + if commonLeftCount == 0 && commonRightCount == 0 { // there are no common parts + return nil + } + + var result []*ast.Node + if commonLeftCount > 0 { + result = append(result, ast.NewNode(ast.KindPattern, nil, commonLeft...)) + } + + var anyOf []*ast.Node + for _, child := range tree.Children { + reuse := child.Children[commonLeftCount : len(child.Children)-commonRightCount] + var node *ast.Node + if len(reuse) == 0 { + // this pattern is completely reduced by commonLeft and commonRight patterns + // so it become nothing + node = ast.NewNode(ast.KindNothing, nil) + } else { + node = ast.NewNode(ast.KindPattern, nil, reuse...) + } + anyOf = appendIfUnique(anyOf, node) + } + switch { + case len(anyOf) == 1 && anyOf[0].Kind != ast.KindNothing: + result = append(result, anyOf[0]) + case len(anyOf) > 1: + result = append(result, ast.NewNode(ast.KindAnyOf, nil, anyOf...)) + } + + if commonRightCount > 0 { + result = append(result, ast.NewNode(ast.KindPattern, nil, commonRight...)) + } + + return ast.NewNode(ast.KindPattern, nil, result...) +} + +func commonChildren(nodes []*ast.Node) (commonLeft, commonRight []*ast.Node) { + if len(nodes) <= 1 { + return + } + + // find node that has least number of children + idx := leastChildren(nodes) + if idx == -1 { + return + } + tree := nodes[idx] + treeLength := len(tree.Children) + + // allocate max able size for rightCommon slice + // to get ability insert elements in reverse order (from end to start) + // without sorting + commonRight = make([]*ast.Node, treeLength) + lastRight := treeLength // will use this to get results as commonRight[lastRight:] + + var ( + breakLeft bool + breakRight bool + commonTotal int + ) + for i, j := 0, treeLength-1; commonTotal < treeLength && j >= 0 && !(breakLeft && breakRight); i, j = i+1, j-1 { + treeLeft := tree.Children[i] + treeRight := tree.Children[j] + + for k := 0; k < len(nodes) && !(breakLeft && breakRight); k++ { + // skip least children node + if k == idx { + continue + } + + restLeft := nodes[k].Children[i] + restRight := nodes[k].Children[j+len(nodes[k].Children)-treeLength] + + breakLeft = breakLeft || !treeLeft.Equal(restLeft) + + // disable searching for right common parts, if left part is already overlapping + breakRight = breakRight || (!breakLeft && j <= i) + breakRight = breakRight || !treeRight.Equal(restRight) + } + + if !breakLeft { + commonTotal++ + commonLeft = append(commonLeft, treeLeft) + } + if !breakRight { + commonTotal++ + lastRight = j + commonRight[j] = treeRight + } + } + + commonRight = commonRight[lastRight:] + + return +} + +func appendIfUnique(target []*ast.Node, val *ast.Node) []*ast.Node { + for _, n := range target { + if reflect.DeepEqual(n, val) { + return target + } + } + return append(target, val) +} + +func areOfSameKind(nodes []*ast.Node, kind ast.Kind) bool { + for _, n := range nodes { + if n.Kind != kind { + return false + } + } + return true +} + +func leastChildren(nodes []*ast.Node) int { + min := -1 + idx := -1 + for i, n := range nodes { + if idx == -1 || (len(n.Children) < min) { + min = len(n.Children) + idx = i + } + } + return idx +} + +func compileTreeChildren(tree *ast.Node, sep []rune) ([]match.Matcher, error) { + var matchers []match.Matcher + for _, desc := range tree.Children { + m, err := compile(desc, sep) + if err != nil { + return nil, err + } + matchers = append(matchers, optimizeMatcher(m)) + } + return matchers, nil +} + +func compile(tree *ast.Node, sep []rune) (m match.Matcher, err error) { + switch tree.Kind { + case ast.KindAnyOf: + // todo this could be faster on pattern_alternatives_combine_lite (see glob_test.go) + if n := minimizeTree(tree); n != nil { + return compile(n, sep) + } + matchers, err := compileTreeChildren(tree, sep) + if err != nil { + return nil, err + } + return match.NewAnyOf(matchers...), nil + + case ast.KindPattern: + if len(tree.Children) == 0 { + return match.NewNothing(), nil + } + matchers, err := compileTreeChildren(tree, sep) + if err != nil { + return nil, err + } + m, err = compileMatchers(minimizeMatchers(matchers)) + if err != nil { + return nil, err + } + + case ast.KindAny: + m = match.NewAny(sep) + + case ast.KindSuper: + m = match.NewSuper() + + case ast.KindSingle: + m = match.NewSingle(sep) + + case ast.KindNothing: + m = match.NewNothing() + + case ast.KindList: + l := tree.Value.(ast.List) + m = match.NewList([]rune(l.Chars), l.Not) + + case ast.KindRange: + r := tree.Value.(ast.Range) + m = match.NewRange(r.Lo, r.Hi, r.Not) + + case ast.KindText: + t := tree.Value.(ast.Text) + m = match.NewText(t.Text) + + default: + return nil, fmt.Errorf("could not compile tree: unknown node type") + } + + return optimizeMatcher(m), nil +} + +func Compile(tree *ast.Node, sep []rune) (match.Matcher, error) { + m, err := compile(tree, sep) + if err != nil { + return nil, err + } + + return m, nil +} diff --git a/vendor/github.com/gobwas/glob/glob.go b/vendor/github.com/gobwas/glob/glob.go new file mode 100644 index 000000000..2afde343a --- /dev/null +++ b/vendor/github.com/gobwas/glob/glob.go @@ -0,0 +1,80 @@ +package glob + +import ( + "github.com/gobwas/glob/compiler" + "github.com/gobwas/glob/syntax" +) + +// Glob represents compiled glob pattern. +type Glob interface { + Match(string) bool +} + +// Compile creates Glob for given pattern and strings (if any present after pattern) as separators. +// The pattern syntax is: +// +// pattern: +// { term } +// +// term: +// `*` matches any sequence of non-separator characters +// `**` matches any sequence of characters +// `?` matches any single non-separator character +// `[` [ `!` ] { character-range } `]` +// character class (must be non-empty) +// `{` pattern-list `}` +// pattern alternatives +// c matches character c (c != `*`, `**`, `?`, `\`, `[`, `{`, `}`) +// `\` c matches character c +// +// character-range: +// c matches character c (c != `\\`, `-`, `]`) +// `\` c matches character c +// lo `-` hi matches character c for lo <= c <= hi +// +// pattern-list: +// pattern { `,` pattern } +// comma-separated (without spaces) patterns +// +func Compile(pattern string, separators ...rune) (Glob, error) { + ast, err := syntax.Parse(pattern) + if err != nil { + return nil, err + } + + matcher, err := compiler.Compile(ast, separators) + if err != nil { + return nil, err + } + + return matcher, nil +} + +// MustCompile is the same as Compile, except that if Compile returns error, this will panic +func MustCompile(pattern string, separators ...rune) Glob { + g, err := Compile(pattern, separators...) + if err != nil { + panic(err) + } + + return g +} + +// QuoteMeta returns a string that quotes all glob pattern meta characters +// inside the argument text; For example, QuoteMeta(`{foo*}`) returns `\[foo\*\]`. +func QuoteMeta(s string) string { + b := make([]byte, 2*len(s)) + + // a byte loop is correct because all meta characters are ASCII + j := 0 + for i := 0; i < len(s); i++ { + if syntax.Special(s[i]) { + b[j] = '\\' + j++ + } + b[j] = s[i] + j++ + } + + return string(b[0:j]) +} diff --git a/vendor/github.com/gobwas/glob/match/any.go b/vendor/github.com/gobwas/glob/match/any.go new file mode 100644 index 000000000..514a9a5c4 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/any.go @@ -0,0 +1,45 @@ +package match + +import ( + "fmt" + "github.com/gobwas/glob/util/strings" +) + +type Any struct { + Separators []rune +} + +func NewAny(s []rune) Any { + return Any{s} +} + +func (self Any) Match(s string) bool { + return strings.IndexAnyRunes(s, self.Separators) == -1 +} + +func (self Any) Index(s string) (int, []int) { + found := strings.IndexAnyRunes(s, self.Separators) + switch found { + case -1: + case 0: + return 0, segments0 + default: + s = s[:found] + } + + segments := acquireSegments(len(s)) + for i := range s { + segments = append(segments, i) + } + segments = append(segments, len(s)) + + return 0, segments +} + +func (self Any) Len() int { + return lenNo +} + +func (self Any) String() string { + return fmt.Sprintf("", string(self.Separators)) +} diff --git a/vendor/github.com/gobwas/glob/match/any_of.go b/vendor/github.com/gobwas/glob/match/any_of.go new file mode 100644 index 000000000..8e65356cd --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/any_of.go @@ -0,0 +1,82 @@ +package match + +import "fmt" + +type AnyOf struct { + Matchers Matchers +} + +func NewAnyOf(m ...Matcher) AnyOf { + return AnyOf{Matchers(m)} +} + +func (self *AnyOf) Add(m Matcher) error { + self.Matchers = append(self.Matchers, m) + return nil +} + +func (self AnyOf) Match(s string) bool { + for _, m := range self.Matchers { + if m.Match(s) { + return true + } + } + + return false +} + +func (self AnyOf) Index(s string) (int, []int) { + index := -1 + + segments := acquireSegments(len(s)) + for _, m := range self.Matchers { + idx, seg := m.Index(s) + if idx == -1 { + continue + } + + if index == -1 || idx < index { + index = idx + segments = append(segments[:0], seg...) + continue + } + + if idx > index { + continue + } + + // here idx == index + segments = appendMerge(segments, seg) + } + + if index == -1 { + releaseSegments(segments) + return -1, nil + } + + return index, segments +} + +func (self AnyOf) Len() (l int) { + l = -1 + for _, m := range self.Matchers { + ml := m.Len() + switch { + case l == -1: + l = ml + continue + + case ml == -1: + return -1 + + case l != ml: + return -1 + } + } + + return +} + +func (self AnyOf) String() string { + return fmt.Sprintf("", self.Matchers) +} diff --git a/vendor/github.com/gobwas/glob/match/btree.go b/vendor/github.com/gobwas/glob/match/btree.go new file mode 100644 index 000000000..a8130e93e --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/btree.go @@ -0,0 +1,146 @@ +package match + +import ( + "fmt" + "unicode/utf8" +) + +type BTree struct { + Value Matcher + Left Matcher + Right Matcher + ValueLengthRunes int + LeftLengthRunes int + RightLengthRunes int + LengthRunes int +} + +func NewBTree(Value, Left, Right Matcher) (tree BTree) { + tree.Value = Value + tree.Left = Left + tree.Right = Right + + lenOk := true + if tree.ValueLengthRunes = Value.Len(); tree.ValueLengthRunes == -1 { + lenOk = false + } + + if Left != nil { + if tree.LeftLengthRunes = Left.Len(); tree.LeftLengthRunes == -1 { + lenOk = false + } + } + + if Right != nil { + if tree.RightLengthRunes = Right.Len(); tree.RightLengthRunes == -1 { + lenOk = false + } + } + + if lenOk { + tree.LengthRunes = tree.LeftLengthRunes + tree.ValueLengthRunes + tree.RightLengthRunes + } else { + tree.LengthRunes = -1 + } + + return tree +} + +func (self BTree) Len() int { + return self.LengthRunes +} + +// todo? +func (self BTree) Index(s string) (int, []int) { + return -1, nil +} + +func (self BTree) Match(s string) bool { + inputLen := len(s) + + // self.Length, self.RLen and self.LLen are values meaning the length of runes for each part + // here we manipulating byte length for better optimizations + // but these checks still works, cause minLen of 1-rune string is 1 byte. + if self.LengthRunes != -1 && self.LengthRunes > inputLen { + return false + } + + // try to cut unnecessary parts + // by knowledge of length of right and left part + var offset, limit int + if self.LeftLengthRunes >= 0 { + offset = self.LeftLengthRunes + } + if self.RightLengthRunes >= 0 { + limit = inputLen - self.RightLengthRunes + } else { + limit = inputLen + } + + for offset < limit { + // search for matching part in substring + index, segments := self.Value.Index(s[offset:limit]) + if index == -1 { + releaseSegments(segments) + return false + } + + l := s[:offset+index] + var left bool + if self.Left != nil { + left = self.Left.Match(l) + } else { + left = l == "" + } + + if left { + for i := len(segments) - 1; i >= 0; i-- { + length := segments[i] + + var right bool + var r string + // if there is no string for the right branch + if inputLen <= offset+index+length { + r = "" + } else { + r = s[offset+index+length:] + } + + if self.Right != nil { + right = self.Right.Match(r) + } else { + right = r == "" + } + + if right { + releaseSegments(segments) + return true + } + } + } + + _, step := utf8.DecodeRuneInString(s[offset+index:]) + offset += index + step + + releaseSegments(segments) + } + + return false +} + +func (self BTree) String() string { + const n string = "" + var l, r string + if self.Left == nil { + l = n + } else { + l = self.Left.String() + } + if self.Right == nil { + r = n + } else { + r = self.Right.String() + } + + return fmt.Sprintf("%s]>", l, self.Value, r) +} diff --git a/vendor/github.com/gobwas/glob/match/contains.go b/vendor/github.com/gobwas/glob/match/contains.go new file mode 100644 index 000000000..0998e95b0 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/contains.go @@ -0,0 +1,58 @@ +package match + +import ( + "fmt" + "strings" +) + +type Contains struct { + Needle string + Not bool +} + +func NewContains(needle string, not bool) Contains { + return Contains{needle, not} +} + +func (self Contains) Match(s string) bool { + return strings.Contains(s, self.Needle) != self.Not +} + +func (self Contains) Index(s string) (int, []int) { + var offset int + + idx := strings.Index(s, self.Needle) + + if !self.Not { + if idx == -1 { + return -1, nil + } + + offset = idx + len(self.Needle) + if len(s) <= offset { + return 0, []int{offset} + } + s = s[offset:] + } else if idx != -1 { + s = s[:idx] + } + + segments := acquireSegments(len(s) + 1) + for i := range s { + segments = append(segments, offset+i) + } + + return 0, append(segments, offset+len(s)) +} + +func (self Contains) Len() int { + return lenNo +} + +func (self Contains) String() string { + var not string + if self.Not { + not = "!" + } + return fmt.Sprintf("", not, self.Needle) +} diff --git a/vendor/github.com/gobwas/glob/match/every_of.go b/vendor/github.com/gobwas/glob/match/every_of.go new file mode 100644 index 000000000..7c968ee36 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/every_of.go @@ -0,0 +1,99 @@ +package match + +import ( + "fmt" +) + +type EveryOf struct { + Matchers Matchers +} + +func NewEveryOf(m ...Matcher) EveryOf { + return EveryOf{Matchers(m)} +} + +func (self *EveryOf) Add(m Matcher) error { + self.Matchers = append(self.Matchers, m) + return nil +} + +func (self EveryOf) Len() (l int) { + for _, m := range self.Matchers { + if ml := m.Len(); l > 0 { + l += ml + } else { + return -1 + } + } + + return +} + +func (self EveryOf) Index(s string) (int, []int) { + var index int + var offset int + + // make `in` with cap as len(s), + // cause it is the maximum size of output segments values + next := acquireSegments(len(s)) + current := acquireSegments(len(s)) + + sub := s + for i, m := range self.Matchers { + idx, seg := m.Index(sub) + if idx == -1 { + releaseSegments(next) + releaseSegments(current) + return -1, nil + } + + if i == 0 { + // we use copy here instead of `current = seg` + // cause seg is a slice from reusable buffer `in` + // and it could be overwritten in next iteration + current = append(current, seg...) + } else { + // clear the next + next = next[:0] + + delta := index - (idx + offset) + for _, ex := range current { + for _, n := range seg { + if ex+delta == n { + next = append(next, n) + } + } + } + + if len(next) == 0 { + releaseSegments(next) + releaseSegments(current) + return -1, nil + } + + current = append(current[:0], next...) + } + + index = idx + offset + sub = s[index:] + offset += idx + } + + releaseSegments(next) + + return index, current +} + +func (self EveryOf) Match(s string) bool { + for _, m := range self.Matchers { + if !m.Match(s) { + return false + } + } + + return true +} + +func (self EveryOf) String() string { + return fmt.Sprintf("", self.Matchers) +} diff --git a/vendor/github.com/gobwas/glob/match/list.go b/vendor/github.com/gobwas/glob/match/list.go new file mode 100644 index 000000000..7fd763ecd --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/list.go @@ -0,0 +1,49 @@ +package match + +import ( + "fmt" + "github.com/gobwas/glob/util/runes" + "unicode/utf8" +) + +type List struct { + List []rune + Not bool +} + +func NewList(list []rune, not bool) List { + return List{list, not} +} + +func (self List) Match(s string) bool { + r, w := utf8.DecodeRuneInString(s) + if len(s) > w { + return false + } + + inList := runes.IndexRune(self.List, r) != -1 + return inList == !self.Not +} + +func (self List) Len() int { + return lenOne +} + +func (self List) Index(s string) (int, []int) { + for i, r := range s { + if self.Not == (runes.IndexRune(self.List, r) == -1) { + return i, segmentsByRuneLength[utf8.RuneLen(r)] + } + } + + return -1, nil +} + +func (self List) String() string { + var not string + if self.Not { + not = "!" + } + + return fmt.Sprintf("", not, string(self.List)) +} diff --git a/vendor/github.com/gobwas/glob/match/match.go b/vendor/github.com/gobwas/glob/match/match.go new file mode 100644 index 000000000..f80e007fb --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/match.go @@ -0,0 +1,81 @@ +package match + +// todo common table of rune's length + +import ( + "fmt" + "strings" +) + +const lenOne = 1 +const lenZero = 0 +const lenNo = -1 + +type Matcher interface { + Match(string) bool + Index(string) (int, []int) + Len() int + String() string +} + +type Matchers []Matcher + +func (m Matchers) String() string { + var s []string + for _, matcher := range m { + s = append(s, fmt.Sprint(matcher)) + } + + return fmt.Sprintf("%s", strings.Join(s, ",")) +} + +// appendMerge merges and sorts given already SORTED and UNIQUE segments. +func appendMerge(target, sub []int) []int { + lt, ls := len(target), len(sub) + out := make([]int, 0, lt+ls) + + for x, y := 0, 0; x < lt || y < ls; { + if x >= lt { + out = append(out, sub[y:]...) + break + } + + if y >= ls { + out = append(out, target[x:]...) + break + } + + xValue := target[x] + yValue := sub[y] + + switch { + + case xValue == yValue: + out = append(out, xValue) + x++ + y++ + + case xValue < yValue: + out = append(out, xValue) + x++ + + case yValue < xValue: + out = append(out, yValue) + y++ + + } + } + + target = append(target[:0], out...) + + return target +} + +func reverseSegments(input []int) { + l := len(input) + m := l / 2 + + for i := 0; i < m; i++ { + input[i], input[l-i-1] = input[l-i-1], input[i] + } +} diff --git a/vendor/github.com/gobwas/glob/match/max.go b/vendor/github.com/gobwas/glob/match/max.go new file mode 100644 index 000000000..d72f69eff --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/max.go @@ -0,0 +1,49 @@ +package match + +import ( + "fmt" + "unicode/utf8" +) + +type Max struct { + Limit int +} + +func NewMax(l int) Max { + return Max{l} +} + +func (self Max) Match(s string) bool { + var l int + for range s { + l += 1 + if l > self.Limit { + return false + } + } + + return true +} + +func (self Max) Index(s string) (int, []int) { + segments := acquireSegments(self.Limit + 1) + segments = append(segments, 0) + var count int + for i, r := range s { + count++ + if count > self.Limit { + break + } + segments = append(segments, i+utf8.RuneLen(r)) + } + + return 0, segments +} + +func (self Max) Len() int { + return lenNo +} + +func (self Max) String() string { + return fmt.Sprintf("", self.Limit) +} diff --git a/vendor/github.com/gobwas/glob/match/min.go b/vendor/github.com/gobwas/glob/match/min.go new file mode 100644 index 000000000..db57ac8eb --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/min.go @@ -0,0 +1,57 @@ +package match + +import ( + "fmt" + "unicode/utf8" +) + +type Min struct { + Limit int +} + +func NewMin(l int) Min { + return Min{l} +} + +func (self Min) Match(s string) bool { + var l int + for range s { + l += 1 + if l >= self.Limit { + return true + } + } + + return false +} + +func (self Min) Index(s string) (int, []int) { + var count int + + c := len(s) - self.Limit + 1 + if c <= 0 { + return -1, nil + } + + segments := acquireSegments(c) + for i, r := range s { + count++ + if count >= self.Limit { + segments = append(segments, i+utf8.RuneLen(r)) + } + } + + if len(segments) == 0 { + return -1, nil + } + + return 0, segments +} + +func (self Min) Len() int { + return lenNo +} + +func (self Min) String() string { + return fmt.Sprintf("", self.Limit) +} diff --git a/vendor/github.com/gobwas/glob/match/nothing.go b/vendor/github.com/gobwas/glob/match/nothing.go new file mode 100644 index 000000000..0d4ecd36b --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/nothing.go @@ -0,0 +1,27 @@ +package match + +import ( + "fmt" +) + +type Nothing struct{} + +func NewNothing() Nothing { + return Nothing{} +} + +func (self Nothing) Match(s string) bool { + return len(s) == 0 +} + +func (self Nothing) Index(s string) (int, []int) { + return 0, segments0 +} + +func (self Nothing) Len() int { + return lenZero +} + +func (self Nothing) String() string { + return fmt.Sprintf("") +} diff --git a/vendor/github.com/gobwas/glob/match/prefix.go b/vendor/github.com/gobwas/glob/match/prefix.go new file mode 100644 index 000000000..a7347250e --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/prefix.go @@ -0,0 +1,50 @@ +package match + +import ( + "fmt" + "strings" + "unicode/utf8" +) + +type Prefix struct { + Prefix string +} + +func NewPrefix(p string) Prefix { + return Prefix{p} +} + +func (self Prefix) Index(s string) (int, []int) { + idx := strings.Index(s, self.Prefix) + if idx == -1 { + return -1, nil + } + + length := len(self.Prefix) + var sub string + if len(s) > idx+length { + sub = s[idx+length:] + } else { + sub = "" + } + + segments := acquireSegments(len(sub) + 1) + segments = append(segments, length) + for i, r := range sub { + segments = append(segments, length+i+utf8.RuneLen(r)) + } + + return idx, segments +} + +func (self Prefix) Len() int { + return lenNo +} + +func (self Prefix) Match(s string) bool { + return strings.HasPrefix(s, self.Prefix) +} + +func (self Prefix) String() string { + return fmt.Sprintf("", self.Prefix) +} diff --git a/vendor/github.com/gobwas/glob/match/prefix_any.go b/vendor/github.com/gobwas/glob/match/prefix_any.go new file mode 100644 index 000000000..8ee58fe1b --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/prefix_any.go @@ -0,0 +1,55 @@ +package match + +import ( + "fmt" + "strings" + "unicode/utf8" + + sutil "github.com/gobwas/glob/util/strings" +) + +type PrefixAny struct { + Prefix string + Separators []rune +} + +func NewPrefixAny(s string, sep []rune) PrefixAny { + return PrefixAny{s, sep} +} + +func (self PrefixAny) Index(s string) (int, []int) { + idx := strings.Index(s, self.Prefix) + if idx == -1 { + return -1, nil + } + + n := len(self.Prefix) + sub := s[idx+n:] + i := sutil.IndexAnyRunes(sub, self.Separators) + if i > -1 { + sub = sub[:i] + } + + seg := acquireSegments(len(sub) + 1) + seg = append(seg, n) + for i, r := range sub { + seg = append(seg, n+i+utf8.RuneLen(r)) + } + + return idx, seg +} + +func (self PrefixAny) Len() int { + return lenNo +} + +func (self PrefixAny) Match(s string) bool { + if !strings.HasPrefix(s, self.Prefix) { + return false + } + return sutil.IndexAnyRunes(s[len(self.Prefix):], self.Separators) == -1 +} + +func (self PrefixAny) String() string { + return fmt.Sprintf("", self.Prefix, string(self.Separators)) +} diff --git a/vendor/github.com/gobwas/glob/match/prefix_suffix.go b/vendor/github.com/gobwas/glob/match/prefix_suffix.go new file mode 100644 index 000000000..8208085a1 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/prefix_suffix.go @@ -0,0 +1,62 @@ +package match + +import ( + "fmt" + "strings" +) + +type PrefixSuffix struct { + Prefix, Suffix string +} + +func NewPrefixSuffix(p, s string) PrefixSuffix { + return PrefixSuffix{p, s} +} + +func (self PrefixSuffix) Index(s string) (int, []int) { + prefixIdx := strings.Index(s, self.Prefix) + if prefixIdx == -1 { + return -1, nil + } + + suffixLen := len(self.Suffix) + if suffixLen <= 0 { + return prefixIdx, []int{len(s) - prefixIdx} + } + + if (len(s) - prefixIdx) <= 0 { + return -1, nil + } + + segments := acquireSegments(len(s) - prefixIdx) + for sub := s[prefixIdx:]; ; { + suffixIdx := strings.LastIndex(sub, self.Suffix) + if suffixIdx == -1 { + break + } + + segments = append(segments, suffixIdx+suffixLen) + sub = sub[:suffixIdx] + } + + if len(segments) == 0 { + releaseSegments(segments) + return -1, nil + } + + reverseSegments(segments) + + return prefixIdx, segments +} + +func (self PrefixSuffix) Len() int { + return lenNo +} + +func (self PrefixSuffix) Match(s string) bool { + return strings.HasPrefix(s, self.Prefix) && strings.HasSuffix(s, self.Suffix) +} + +func (self PrefixSuffix) String() string { + return fmt.Sprintf("", self.Prefix, self.Suffix) +} diff --git a/vendor/github.com/gobwas/glob/match/range.go b/vendor/github.com/gobwas/glob/match/range.go new file mode 100644 index 000000000..ce30245a4 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/range.go @@ -0,0 +1,48 @@ +package match + +import ( + "fmt" + "unicode/utf8" +) + +type Range struct { + Lo, Hi rune + Not bool +} + +func NewRange(lo, hi rune, not bool) Range { + return Range{lo, hi, not} +} + +func (self Range) Len() int { + return lenOne +} + +func (self Range) Match(s string) bool { + r, w := utf8.DecodeRuneInString(s) + if len(s) > w { + return false + } + + inRange := r >= self.Lo && r <= self.Hi + + return inRange == !self.Not +} + +func (self Range) Index(s string) (int, []int) { + for i, r := range s { + if self.Not != (r >= self.Lo && r <= self.Hi) { + return i, segmentsByRuneLength[utf8.RuneLen(r)] + } + } + + return -1, nil +} + +func (self Range) String() string { + var not string + if self.Not { + not = "!" + } + return fmt.Sprintf("", not, string(self.Lo), string(self.Hi)) +} diff --git a/vendor/github.com/gobwas/glob/match/row.go b/vendor/github.com/gobwas/glob/match/row.go new file mode 100644 index 000000000..4379042e4 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/row.go @@ -0,0 +1,77 @@ +package match + +import ( + "fmt" +) + +type Row struct { + Matchers Matchers + RunesLength int + Segments []int +} + +func NewRow(len int, m ...Matcher) Row { + return Row{ + Matchers: Matchers(m), + RunesLength: len, + Segments: []int{len}, + } +} + +func (self Row) matchAll(s string) bool { + var idx int + for _, m := range self.Matchers { + length := m.Len() + + var next, i int + for next = range s[idx:] { + i++ + if i == length { + break + } + } + + if i < length || !m.Match(s[idx:idx+next+1]) { + return false + } + + idx += next + 1 + } + + return true +} + +func (self Row) lenOk(s string) bool { + var i int + for range s { + i++ + if i > self.RunesLength { + return false + } + } + return self.RunesLength == i +} + +func (self Row) Match(s string) bool { + return self.lenOk(s) && self.matchAll(s) +} + +func (self Row) Len() (l int) { + return self.RunesLength +} + +func (self Row) Index(s string) (int, []int) { + for i := range s { + if len(s[i:]) < self.RunesLength { + break + } + if self.matchAll(s[i:]) { + return i, self.Segments + } + } + return -1, nil +} + +func (self Row) String() string { + return fmt.Sprintf("", self.RunesLength, self.Matchers) +} diff --git a/vendor/github.com/gobwas/glob/match/segments.go b/vendor/github.com/gobwas/glob/match/segments.go new file mode 100644 index 000000000..9ea6f3094 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/segments.go @@ -0,0 +1,91 @@ +package match + +import ( + "sync" +) + +type SomePool interface { + Get() []int + Put([]int) +} + +var segmentsPools [1024]sync.Pool + +func toPowerOfTwo(v int) int { + v-- + v |= v >> 1 + v |= v >> 2 + v |= v >> 4 + v |= v >> 8 + v |= v >> 16 + v++ + + return v +} + +const ( + cacheFrom = 16 + cacheToAndHigher = 1024 + cacheFromIndex = 15 + cacheToAndHigherIndex = 1023 +) + +var ( + segments0 = []int{0} + segments1 = []int{1} + segments2 = []int{2} + segments3 = []int{3} + segments4 = []int{4} +) + +var segmentsByRuneLength [5][]int = [5][]int{ + 0: segments0, + 1: segments1, + 2: segments2, + 3: segments3, + 4: segments4, +} + +func init() { + for i := cacheToAndHigher; i >= cacheFrom; i >>= 1 { + func(i int) { + segmentsPools[i-1] = sync.Pool{New: func() interface{} { + return make([]int, 0, i) + }} + }(i) + } +} + +func getTableIndex(c int) int { + p := toPowerOfTwo(c) + switch { + case p >= cacheToAndHigher: + return cacheToAndHigherIndex + case p <= cacheFrom: + return cacheFromIndex + default: + return p - 1 + } +} + +func acquireSegments(c int) []int { + // make []int with less capacity than cacheFrom + // is faster than acquiring it from pool + if c < cacheFrom { + return make([]int, 0, c) + } + + return segmentsPools[getTableIndex(c)].Get().([]int)[:0] +} + +func releaseSegments(s []int) { + c := cap(s) + + // make []int with less capacity than cacheFrom + // is faster than acquiring it from pool + if c < cacheFrom { + return + } + + segmentsPools[getTableIndex(c)].Put(s) +} diff --git a/vendor/github.com/gobwas/glob/match/single.go b/vendor/github.com/gobwas/glob/match/single.go new file mode 100644 index 000000000..ee6e3954c --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/single.go @@ -0,0 +1,43 @@ +package match + +import ( + "fmt" + "github.com/gobwas/glob/util/runes" + "unicode/utf8" +) + +// single represents ? +type Single struct { + Separators []rune +} + +func NewSingle(s []rune) Single { + return Single{s} +} + +func (self Single) Match(s string) bool { + r, w := utf8.DecodeRuneInString(s) + if len(s) > w { + return false + } + + return runes.IndexRune(self.Separators, r) == -1 +} + +func (self Single) Len() int { + return lenOne +} + +func (self Single) Index(s string) (int, []int) { + for i, r := range s { + if runes.IndexRune(self.Separators, r) == -1 { + return i, segmentsByRuneLength[utf8.RuneLen(r)] + } + } + + return -1, nil +} + +func (self Single) String() string { + return fmt.Sprintf("", string(self.Separators)) +} diff --git a/vendor/github.com/gobwas/glob/match/suffix.go b/vendor/github.com/gobwas/glob/match/suffix.go new file mode 100644 index 000000000..85bea8c68 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/suffix.go @@ -0,0 +1,35 @@ +package match + +import ( + "fmt" + "strings" +) + +type Suffix struct { + Suffix string +} + +func NewSuffix(s string) Suffix { + return Suffix{s} +} + +func (self Suffix) Len() int { + return lenNo +} + +func (self Suffix) Match(s string) bool { + return strings.HasSuffix(s, self.Suffix) +} + +func (self Suffix) Index(s string) (int, []int) { + idx := strings.Index(s, self.Suffix) + if idx == -1 { + return -1, nil + } + + return 0, []int{idx + len(self.Suffix)} +} + +func (self Suffix) String() string { + return fmt.Sprintf("", self.Suffix) +} diff --git a/vendor/github.com/gobwas/glob/match/suffix_any.go b/vendor/github.com/gobwas/glob/match/suffix_any.go new file mode 100644 index 000000000..c5106f819 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/suffix_any.go @@ -0,0 +1,43 @@ +package match + +import ( + "fmt" + "strings" + + sutil "github.com/gobwas/glob/util/strings" +) + +type SuffixAny struct { + Suffix string + Separators []rune +} + +func NewSuffixAny(s string, sep []rune) SuffixAny { + return SuffixAny{s, sep} +} + +func (self SuffixAny) Index(s string) (int, []int) { + idx := strings.Index(s, self.Suffix) + if idx == -1 { + return -1, nil + } + + i := sutil.LastIndexAnyRunes(s[:idx], self.Separators) + 1 + + return i, []int{idx + len(self.Suffix) - i} +} + +func (self SuffixAny) Len() int { + return lenNo +} + +func (self SuffixAny) Match(s string) bool { + if !strings.HasSuffix(s, self.Suffix) { + return false + } + return sutil.IndexAnyRunes(s[:len(s)-len(self.Suffix)], self.Separators) == -1 +} + +func (self SuffixAny) String() string { + return fmt.Sprintf("", string(self.Separators), self.Suffix) +} diff --git a/vendor/github.com/gobwas/glob/match/super.go b/vendor/github.com/gobwas/glob/match/super.go new file mode 100644 index 000000000..3875950bb --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/super.go @@ -0,0 +1,33 @@ +package match + +import ( + "fmt" +) + +type Super struct{} + +func NewSuper() Super { + return Super{} +} + +func (self Super) Match(s string) bool { + return true +} + +func (self Super) Len() int { + return lenNo +} + +func (self Super) Index(s string) (int, []int) { + segments := acquireSegments(len(s) + 1) + for i := range s { + segments = append(segments, i) + } + segments = append(segments, len(s)) + + return 0, segments +} + +func (self Super) String() string { + return fmt.Sprintf("") +} diff --git a/vendor/github.com/gobwas/glob/match/text.go b/vendor/github.com/gobwas/glob/match/text.go new file mode 100644 index 000000000..0a17616d3 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/text.go @@ -0,0 +1,45 @@ +package match + +import ( + "fmt" + "strings" + "unicode/utf8" +) + +// raw represents raw string to match +type Text struct { + Str string + RunesLength int + BytesLength int + Segments []int +} + +func NewText(s string) Text { + return Text{ + Str: s, + RunesLength: utf8.RuneCountInString(s), + BytesLength: len(s), + Segments: []int{len(s)}, + } +} + +func (self Text) Match(s string) bool { + return self.Str == s +} + +func (self Text) Len() int { + return self.RunesLength +} + +func (self Text) Index(s string) (int, []int) { + index := strings.Index(s, self.Str) + if index == -1 { + return -1, nil + } + + return index, self.Segments +} + +func (self Text) String() string { + return fmt.Sprintf("", self.Str) +} diff --git a/vendor/github.com/gobwas/glob/readme.md b/vendor/github.com/gobwas/glob/readme.md new file mode 100644 index 000000000..f58144e73 --- /dev/null +++ b/vendor/github.com/gobwas/glob/readme.md @@ -0,0 +1,148 @@ +# glob.[go](https://golang.org) + +[![GoDoc][godoc-image]][godoc-url] [![Build Status][travis-image]][travis-url] + +> Go Globbing Library. + +## Install + +```shell + go get github.com/gobwas/glob +``` + +## Example + +```go + +package main + +import "github.com/gobwas/glob" + +func main() { + var g glob.Glob + + // create simple glob + g = glob.MustCompile("*.github.com") + g.Match("api.github.com") // true + + // quote meta characters and then create simple glob + g = glob.MustCompile(glob.QuoteMeta("*.github.com")) + g.Match("*.github.com") // true + + // create new glob with set of delimiters as ["."] + g = glob.MustCompile("api.*.com", '.') + g.Match("api.github.com") // true + g.Match("api.gi.hub.com") // false + + // create new glob with set of delimiters as ["."] + // but now with super wildcard + g = glob.MustCompile("api.**.com", '.') + g.Match("api.github.com") // true + g.Match("api.gi.hub.com") // true + + // create glob with single symbol wildcard + g = glob.MustCompile("?at") + g.Match("cat") // true + g.Match("fat") // true + g.Match("at") // false + + // create glob with single symbol wildcard and delimiters ['f'] + g = glob.MustCompile("?at", 'f') + g.Match("cat") // true + g.Match("fat") // false + g.Match("at") // false + + // create glob with character-list matchers + g = glob.MustCompile("[abc]at") + g.Match("cat") // true + g.Match("bat") // true + g.Match("fat") // false + g.Match("at") // false + + // create glob with character-list matchers + g = glob.MustCompile("[!abc]at") + g.Match("cat") // false + g.Match("bat") // false + g.Match("fat") // true + g.Match("at") // false + + // create glob with character-range matchers + g = glob.MustCompile("[a-c]at") + g.Match("cat") // true + g.Match("bat") // true + g.Match("fat") // false + g.Match("at") // false + + // create glob with character-range matchers + g = glob.MustCompile("[!a-c]at") + g.Match("cat") // false + g.Match("bat") // false + g.Match("fat") // true + g.Match("at") // false + + // create glob with pattern-alternatives list + g = glob.MustCompile("{cat,bat,[fr]at}") + g.Match("cat") // true + g.Match("bat") // true + g.Match("fat") // true + g.Match("rat") // true + g.Match("at") // false + g.Match("zat") // false +} + +``` + +## Performance + +This library is created for compile-once patterns. This means, that compilation could take time, but +strings matching is done faster, than in case when always parsing template. + +If you will not use compiled `glob.Glob` object, and do `g := glob.MustCompile(pattern); g.Match(...)` every time, then your code will be much more slower. + +Run `go test -bench=.` from source root to see the benchmarks: + +Pattern | Fixture | Match | Speed (ns/op) +--------|---------|-------|-------------- +`[a-z][!a-x]*cat*[h][!b]*eyes*` | `my cat has very bright eyes` | `true` | 432 +`[a-z][!a-x]*cat*[h][!b]*eyes*` | `my dog has very bright eyes` | `false` | 199 +`https://*.google.*` | `https://account.google.com` | `true` | 96 +`https://*.google.*` | `https://google.com` | `false` | 66 +`{https://*.google.*,*yandex.*,*yahoo.*,*mail.ru}` | `http://yahoo.com` | `true` | 163 +`{https://*.google.*,*yandex.*,*yahoo.*,*mail.ru}` | `http://google.com` | `false` | 197 +`{https://*gobwas.com,http://exclude.gobwas.com}` | `https://safe.gobwas.com` | `true` | 22 +`{https://*gobwas.com,http://exclude.gobwas.com}` | `http://safe.gobwas.com` | `false` | 24 +`abc*` | `abcdef` | `true` | 8.15 +`abc*` | `af` | `false` | 5.68 +`*def` | `abcdef` | `true` | 8.84 +`*def` | `af` | `false` | 5.74 +`ab*ef` | `abcdef` | `true` | 15.2 +`ab*ef` | `af` | `false` | 10.4 + +The same things with `regexp` package: + +Pattern | Fixture | Match | Speed (ns/op) +--------|---------|-------|-------------- +`^[a-z][^a-x].*cat.*[h][^b].*eyes.*$` | `my cat has very bright eyes` | `true` | 2553 +`^[a-z][^a-x].*cat.*[h][^b].*eyes.*$` | `my dog has very bright eyes` | `false` | 1383 +`^https:\/\/.*\.google\..*$` | `https://account.google.com` | `true` | 1205 +`^https:\/\/.*\.google\..*$` | `https://google.com` | `false` | 767 +`^(https:\/\/.*\.google\..*|.*yandex\..*|.*yahoo\..*|.*mail\.ru)$` | `http://yahoo.com` | `true` | 1435 +`^(https:\/\/.*\.google\..*|.*yandex\..*|.*yahoo\..*|.*mail\.ru)$` | `http://google.com` | `false` | 1674 +`^(https:\/\/.*gobwas\.com|http://exclude.gobwas.com)$` | `https://safe.gobwas.com` | `true` | 1039 +`^(https:\/\/.*gobwas\.com|http://exclude.gobwas.com)$` | `http://safe.gobwas.com` | `false` | 272 +`^abc.*$` | `abcdef` | `true` | 237 +`^abc.*$` | `af` | `false` | 100 +`^.*def$` | `abcdef` | `true` | 464 +`^.*def$` | `af` | `false` | 265 +`^ab.*ef$` | `abcdef` | `true` | 375 +`^ab.*ef$` | `af` | `false` | 145 + +[godoc-image]: https://godoc.org/github.com/gobwas/glob?status.svg +[godoc-url]: https://godoc.org/github.com/gobwas/glob +[travis-image]: https://travis-ci.org/gobwas/glob.svg?branch=master +[travis-url]: https://travis-ci.org/gobwas/glob + +## Syntax + +Syntax is inspired by [standard wildcards](http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm), +except that `**` is aka super-asterisk, that do not sensitive for separators. \ No newline at end of file diff --git a/vendor/github.com/gobwas/glob/syntax/ast/ast.go b/vendor/github.com/gobwas/glob/syntax/ast/ast.go new file mode 100644 index 000000000..3220a694a --- /dev/null +++ b/vendor/github.com/gobwas/glob/syntax/ast/ast.go @@ -0,0 +1,122 @@ +package ast + +import ( + "bytes" + "fmt" +) + +type Node struct { + Parent *Node + Children []*Node + Value interface{} + Kind Kind +} + +func NewNode(k Kind, v interface{}, ch ...*Node) *Node { + n := &Node{ + Kind: k, + Value: v, + } + for _, c := range ch { + Insert(n, c) + } + return n +} + +func (a *Node) Equal(b *Node) bool { + if a.Kind != b.Kind { + return false + } + if a.Value != b.Value { + return false + } + if len(a.Children) != len(b.Children) { + return false + } + for i, c := range a.Children { + if !c.Equal(b.Children[i]) { + return false + } + } + return true +} + +func (a *Node) String() string { + var buf bytes.Buffer + buf.WriteString(a.Kind.String()) + if a.Value != nil { + buf.WriteString(" =") + buf.WriteString(fmt.Sprintf("%v", a.Value)) + } + if len(a.Children) > 0 { + buf.WriteString(" [") + for i, c := range a.Children { + if i > 0 { + buf.WriteString(", ") + } + buf.WriteString(c.String()) + } + buf.WriteString("]") + } + return buf.String() +} + +func Insert(parent *Node, children ...*Node) { + parent.Children = append(parent.Children, children...) + for _, ch := range children { + ch.Parent = parent + } +} + +type List struct { + Not bool + Chars string +} + +type Range struct { + Not bool + Lo, Hi rune +} + +type Text struct { + Text string +} + +type Kind int + +const ( + KindNothing Kind = iota + KindPattern + KindList + KindRange + KindText + KindAny + KindSuper + KindSingle + KindAnyOf +) + +func (k Kind) String() string { + switch k { + case KindNothing: + return "Nothing" + case KindPattern: + return "Pattern" + case KindList: + return "List" + case KindRange: + return "Range" + case KindText: + return "Text" + case KindAny: + return "Any" + case KindSuper: + return "Super" + case KindSingle: + return "Single" + case KindAnyOf: + return "AnyOf" + default: + return "" + } +} diff --git a/vendor/github.com/gobwas/glob/syntax/ast/parser.go b/vendor/github.com/gobwas/glob/syntax/ast/parser.go new file mode 100644 index 000000000..429b40943 --- /dev/null +++ b/vendor/github.com/gobwas/glob/syntax/ast/parser.go @@ -0,0 +1,157 @@ +package ast + +import ( + "errors" + "fmt" + "github.com/gobwas/glob/syntax/lexer" + "unicode/utf8" +) + +type Lexer interface { + Next() lexer.Token +} + +type parseFn func(*Node, Lexer) (parseFn, *Node, error) + +func Parse(lexer Lexer) (*Node, error) { + var parser parseFn + + root := NewNode(KindPattern, nil) + + var ( + tree *Node + err error + ) + for parser, tree = parserMain, root; parser != nil; { + parser, tree, err = parser(tree, lexer) + if err != nil { + return nil, err + } + } + + return root, nil +} + +func parserMain(tree *Node, lex Lexer) (parseFn, *Node, error) { + for { + token := lex.Next() + switch token.Type { + case lexer.EOF: + return nil, tree, nil + + case lexer.Error: + return nil, tree, errors.New(token.Raw) + + case lexer.Text: + Insert(tree, NewNode(KindText, Text{token.Raw})) + return parserMain, tree, nil + + case lexer.Any: + Insert(tree, NewNode(KindAny, nil)) + return parserMain, tree, nil + + case lexer.Super: + Insert(tree, NewNode(KindSuper, nil)) + return parserMain, tree, nil + + case lexer.Single: + Insert(tree, NewNode(KindSingle, nil)) + return parserMain, tree, nil + + case lexer.RangeOpen: + return parserRange, tree, nil + + case lexer.TermsOpen: + a := NewNode(KindAnyOf, nil) + Insert(tree, a) + + p := NewNode(KindPattern, nil) + Insert(a, p) + + return parserMain, p, nil + + case lexer.Separator: + p := NewNode(KindPattern, nil) + Insert(tree.Parent, p) + + return parserMain, p, nil + + case lexer.TermsClose: + return parserMain, tree.Parent.Parent, nil + + default: + return nil, tree, fmt.Errorf("unexpected token: %s", token) + } + } + return nil, tree, fmt.Errorf("unknown error") +} + +func parserRange(tree *Node, lex Lexer) (parseFn, *Node, error) { + var ( + not bool + lo rune + hi rune + chars string + ) + for { + token := lex.Next() + switch token.Type { + case lexer.EOF: + return nil, tree, errors.New("unexpected end") + + case lexer.Error: + return nil, tree, errors.New(token.Raw) + + case lexer.Not: + not = true + + case lexer.RangeLo: + r, w := utf8.DecodeRuneInString(token.Raw) + if len(token.Raw) > w { + return nil, tree, fmt.Errorf("unexpected length of lo character") + } + lo = r + + case lexer.RangeBetween: + // + + case lexer.RangeHi: + r, w := utf8.DecodeRuneInString(token.Raw) + if len(token.Raw) > w { + return nil, tree, fmt.Errorf("unexpected length of lo character") + } + + hi = r + + if hi < lo { + return nil, tree, fmt.Errorf("hi character '%s' should be greater than lo '%s'", string(hi), string(lo)) + } + + case lexer.Text: + chars = token.Raw + + case lexer.RangeClose: + isRange := lo != 0 && hi != 0 + isChars := chars != "" + + if isChars == isRange { + return nil, tree, fmt.Errorf("could not parse range") + } + + if isRange { + Insert(tree, NewNode(KindRange, Range{ + Lo: lo, + Hi: hi, + Not: not, + })) + } else { + Insert(tree, NewNode(KindList, List{ + Chars: chars, + Not: not, + })) + } + + return parserMain, tree, nil + } + } +} diff --git a/vendor/github.com/gobwas/glob/syntax/lexer/lexer.go b/vendor/github.com/gobwas/glob/syntax/lexer/lexer.go new file mode 100644 index 000000000..a1c8d1962 --- /dev/null +++ b/vendor/github.com/gobwas/glob/syntax/lexer/lexer.go @@ -0,0 +1,273 @@ +package lexer + +import ( + "bytes" + "fmt" + "github.com/gobwas/glob/util/runes" + "unicode/utf8" +) + +const ( + char_any = '*' + char_comma = ',' + char_single = '?' + char_escape = '\\' + char_range_open = '[' + char_range_close = ']' + char_terms_open = '{' + char_terms_close = '}' + char_range_not = '!' + char_range_between = '-' +) + +var specials = []byte{ + char_any, + char_single, + char_escape, + char_range_open, + char_range_close, + char_terms_open, + char_terms_close, +} + +func Special(c byte) bool { + return bytes.IndexByte(specials, c) != -1 +} + +type tokens []Token + +func (i *tokens) shift() (ret Token) { + ret = (*i)[0] + copy(*i, (*i)[1:]) + *i = (*i)[:len(*i)-1] + return +} + +func (i *tokens) push(v Token) { + *i = append(*i, v) +} + +func (i *tokens) empty() bool { + return len(*i) == 0 +} + +var eof rune = 0 + +type lexer struct { + data string + pos int + err error + + tokens tokens + termsLevel int + + lastRune rune + lastRuneSize int + hasRune bool +} + +func NewLexer(source string) *lexer { + l := &lexer{ + data: source, + tokens: tokens(make([]Token, 0, 4)), + } + return l +} + +func (l *lexer) Next() Token { + if l.err != nil { + return Token{Error, l.err.Error()} + } + if !l.tokens.empty() { + return l.tokens.shift() + } + + l.fetchItem() + return l.Next() +} + +func (l *lexer) peek() (r rune, w int) { + if l.pos == len(l.data) { + return eof, 0 + } + + r, w = utf8.DecodeRuneInString(l.data[l.pos:]) + if r == utf8.RuneError { + l.errorf("could not read rune") + r = eof + w = 0 + } + + return +} + +func (l *lexer) read() rune { + if l.hasRune { + l.hasRune = false + l.seek(l.lastRuneSize) + return l.lastRune + } + + r, s := l.peek() + l.seek(s) + + l.lastRune = r + l.lastRuneSize = s + + return r +} + +func (l *lexer) seek(w int) { + l.pos += w +} + +func (l *lexer) unread() { + if l.hasRune { + l.errorf("could not unread rune") + return + } + l.seek(-l.lastRuneSize) + l.hasRune = true +} + +func (l *lexer) errorf(f string, v ...interface{}) { + l.err = fmt.Errorf(f, v...) +} + +func (l *lexer) inTerms() bool { + return l.termsLevel > 0 +} + +func (l *lexer) termsEnter() { + l.termsLevel++ +} + +func (l *lexer) termsLeave() { + l.termsLevel-- +} + +var inTextBreakers = []rune{char_single, char_any, char_range_open, char_terms_open} +var inTermsBreakers = append(inTextBreakers, char_terms_close, char_comma) + +func (l *lexer) fetchItem() { + r := l.read() + switch { + case r == eof: + l.tokens.push(Token{EOF, ""}) + + case r == char_terms_open: + l.termsEnter() + l.tokens.push(Token{TermsOpen, string(r)}) + + case r == char_comma && l.inTerms(): + l.tokens.push(Token{Separator, string(r)}) + + case r == char_terms_close && l.inTerms(): + l.tokens.push(Token{TermsClose, string(r)}) + l.termsLeave() + + case r == char_range_open: + l.tokens.push(Token{RangeOpen, string(r)}) + l.fetchRange() + + case r == char_single: + l.tokens.push(Token{Single, string(r)}) + + case r == char_any: + if l.read() == char_any { + l.tokens.push(Token{Super, string(r) + string(r)}) + } else { + l.unread() + l.tokens.push(Token{Any, string(r)}) + } + + default: + l.unread() + + var breakers []rune + if l.inTerms() { + breakers = inTermsBreakers + } else { + breakers = inTextBreakers + } + l.fetchText(breakers) + } +} + +func (l *lexer) fetchRange() { + var wantHi bool + var wantClose bool + var seenNot bool + for { + r := l.read() + if r == eof { + l.errorf("unexpected end of input") + return + } + + if wantClose { + if r != char_range_close { + l.errorf("expected close range character") + } else { + l.tokens.push(Token{RangeClose, string(r)}) + } + return + } + + if wantHi { + l.tokens.push(Token{RangeHi, string(r)}) + wantClose = true + continue + } + + if !seenNot && r == char_range_not { + l.tokens.push(Token{Not, string(r)}) + seenNot = true + continue + } + + if n, w := l.peek(); n == char_range_between { + l.seek(w) + l.tokens.push(Token{RangeLo, string(r)}) + l.tokens.push(Token{RangeBetween, string(n)}) + wantHi = true + continue + } + + l.unread() // unread first peek and fetch as text + l.fetchText([]rune{char_range_close}) + wantClose = true + } +} + +func (l *lexer) fetchText(breakers []rune) { + var data []rune + var escaped bool + +reading: + for { + r := l.read() + if r == eof { + break + } + + if !escaped { + if r == char_escape { + escaped = true + continue + } + + if runes.IndexRune(breakers, r) != -1 { + l.unread() + break reading + } + } + + escaped = false + data = append(data, r) + } + + if len(data) > 0 { + l.tokens.push(Token{Text, string(data)}) + } +} diff --git a/vendor/github.com/gobwas/glob/syntax/lexer/token.go b/vendor/github.com/gobwas/glob/syntax/lexer/token.go new file mode 100644 index 000000000..2797c4e83 --- /dev/null +++ b/vendor/github.com/gobwas/glob/syntax/lexer/token.go @@ -0,0 +1,88 @@ +package lexer + +import "fmt" + +type TokenType int + +const ( + EOF TokenType = iota + Error + Text + Char + Any + Super + Single + Not + Separator + RangeOpen + RangeClose + RangeLo + RangeHi + RangeBetween + TermsOpen + TermsClose +) + +func (tt TokenType) String() string { + switch tt { + case EOF: + return "eof" + + case Error: + return "error" + + case Text: + return "text" + + case Char: + return "char" + + case Any: + return "any" + + case Super: + return "super" + + case Single: + return "single" + + case Not: + return "not" + + case Separator: + return "separator" + + case RangeOpen: + return "range_open" + + case RangeClose: + return "range_close" + + case RangeLo: + return "range_lo" + + case RangeHi: + return "range_hi" + + case RangeBetween: + return "range_between" + + case TermsOpen: + return "terms_open" + + case TermsClose: + return "terms_close" + + default: + return "undef" + } +} + +type Token struct { + Type TokenType + Raw string +} + +func (t Token) String() string { + return fmt.Sprintf("%v<%q>", t.Type, t.Raw) +} diff --git a/vendor/github.com/gobwas/glob/syntax/syntax.go b/vendor/github.com/gobwas/glob/syntax/syntax.go new file mode 100644 index 000000000..1d168b148 --- /dev/null +++ b/vendor/github.com/gobwas/glob/syntax/syntax.go @@ -0,0 +1,14 @@ +package syntax + +import ( + "github.com/gobwas/glob/syntax/ast" + "github.com/gobwas/glob/syntax/lexer" +) + +func Parse(s string) (*ast.Node, error) { + return ast.Parse(lexer.NewLexer(s)) +} + +func Special(b byte) bool { + return lexer.Special(b) +} diff --git a/vendor/github.com/gobwas/glob/util/runes/runes.go b/vendor/github.com/gobwas/glob/util/runes/runes.go new file mode 100644 index 000000000..a72355641 --- /dev/null +++ b/vendor/github.com/gobwas/glob/util/runes/runes.go @@ -0,0 +1,154 @@ +package runes + +func Index(s, needle []rune) int { + ls, ln := len(s), len(needle) + + switch { + case ln == 0: + return 0 + case ln == 1: + return IndexRune(s, needle[0]) + case ln == ls: + if Equal(s, needle) { + return 0 + } + return -1 + case ln > ls: + return -1 + } + +head: + for i := 0; i < ls && ls-i >= ln; i++ { + for y := 0; y < ln; y++ { + if s[i+y] != needle[y] { + continue head + } + } + + return i + } + + return -1 +} + +func LastIndex(s, needle []rune) int { + ls, ln := len(s), len(needle) + + switch { + case ln == 0: + if ls == 0 { + return 0 + } + return ls + case ln == 1: + return IndexLastRune(s, needle[0]) + case ln == ls: + if Equal(s, needle) { + return 0 + } + return -1 + case ln > ls: + return -1 + } + +head: + for i := ls - 1; i >= 0 && i >= ln; i-- { + for y := ln - 1; y >= 0; y-- { + if s[i-(ln-y-1)] != needle[y] { + continue head + } + } + + return i - ln + 1 + } + + return -1 +} + +// IndexAny returns the index of the first instance of any Unicode code point +// from chars in s, or -1 if no Unicode code point from chars is present in s. +func IndexAny(s, chars []rune) int { + if len(chars) > 0 { + for i, c := range s { + for _, m := range chars { + if c == m { + return i + } + } + } + } + return -1 +} + +func Contains(s, needle []rune) bool { + return Index(s, needle) >= 0 +} + +func Max(s []rune) (max rune) { + for _, r := range s { + if r > max { + max = r + } + } + + return +} + +func Min(s []rune) rune { + min := rune(-1) + for _, r := range s { + if min == -1 { + min = r + continue + } + + if r < min { + min = r + } + } + + return min +} + +func IndexRune(s []rune, r rune) int { + for i, c := range s { + if c == r { + return i + } + } + return -1 +} + +func IndexLastRune(s []rune, r rune) int { + for i := len(s) - 1; i >= 0; i-- { + if s[i] == r { + return i + } + } + + return -1 +} + +func Equal(a, b []rune) bool { + if len(a) == len(b) { + for i := 0; i < len(a); i++ { + if a[i] != b[i] { + return false + } + } + + return true + } + + return false +} + +// HasPrefix tests whether the string s begins with prefix. +func HasPrefix(s, prefix []rune) bool { + return len(s) >= len(prefix) && Equal(s[0:len(prefix)], prefix) +} + +// HasSuffix tests whether the string s ends with suffix. +func HasSuffix(s, suffix []rune) bool { + return len(s) >= len(suffix) && Equal(s[len(s)-len(suffix):], suffix) +} diff --git a/vendor/github.com/gobwas/glob/util/strings/strings.go b/vendor/github.com/gobwas/glob/util/strings/strings.go new file mode 100644 index 000000000..e8ee1920b --- /dev/null +++ b/vendor/github.com/gobwas/glob/util/strings/strings.go @@ -0,0 +1,39 @@ +package strings + +import ( + "strings" + "unicode/utf8" +) + +func IndexAnyRunes(s string, rs []rune) int { + for _, r := range rs { + if i := strings.IndexRune(s, r); i != -1 { + return i + } + } + + return -1 +} + +func LastIndexAnyRunes(s string, rs []rune) int { + for _, r := range rs { + i := -1 + if 0 <= r && r < utf8.RuneSelf { + i = strings.LastIndexByte(s, byte(r)) + } else { + sub := s + for len(sub) > 0 { + j := strings.IndexRune(s, r) + if j == -1 { + break + } + i = j + sub = sub[i+1:] + } + } + if i != -1 { + return i + } + } + return -1 +} diff --git a/vendor/github.com/gookit/color/.gitignore b/vendor/github.com/gookit/color/.gitignore new file mode 100644 index 000000000..5efa5e3f0 --- /dev/null +++ b/vendor/github.com/gookit/color/.gitignore @@ -0,0 +1,20 @@ +*.log +*.swp +.idea +*.patch +### Go template +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out +.DS_Store +app +demo diff --git a/vendor/github.com/gookit/color/LICENSE b/vendor/github.com/gookit/color/LICENSE new file mode 100644 index 000000000..d839cdc1a --- /dev/null +++ b/vendor/github.com/gookit/color/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2016 inhere + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/gookit/color/README.md b/vendor/github.com/gookit/color/README.md new file mode 100644 index 000000000..134181dc6 --- /dev/null +++ b/vendor/github.com/gookit/color/README.md @@ -0,0 +1,468 @@ +# CLI Color + +![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/gookit/color?style=flat-square) +[![Actions Status](https://github.com/gookit/color/workflows/action-tests/badge.svg)](https://github.com/gookit/color/actions) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/51b28c5f7ffe4cc2b0f12ecf25ed247f)](https://app.codacy.com/app/inhere/color) +[![GoDoc](https://godoc.org/github.com/gookit/color?status.svg)](https://pkg.go.dev/github.com/gookit/color?tab=overview) +[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/gookit/color)](https://github.com/gookit/color) +[![Build Status](https://travis-ci.org/gookit/color.svg?branch=master)](https://travis-ci.org/gookit/color) +[![Coverage Status](https://coveralls.io/repos/github/gookit/color/badge.svg?branch=master)](https://coveralls.io/github/gookit/color?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/gookit/color)](https://goreportcard.com/report/github.com/gookit/color) + +A command-line color library with true color support, universal API methods and Windows support. + +> **[中文说明](README.zh-CN.md)** + +Basic color preview: + +![basic-color](_examples/images/basic-color2.png) + +Now, 256 colors and RGB colors have also been supported to work in Windows CMD and PowerShell: + +![color-on-cmd-pwsh](_examples/images/color-on-cmd-pwsh.jpg) + +## Features + + - Simple to use, zero dependencies + - Supports rich color output: 16-color (4-bit), 256-color (8-bit), true color (24-bit, RGB) + - 16-color output is the most commonly used and most widely supported, working on any Windows version + - Since `v1.2.4` **the 256-color (8-bit), true color (24-bit) support windows CMD and PowerShell** + - See [this gist](https://gist.github.com/XVilka/8346728) for information on true color support + - Generic API methods: `Print`, `Printf`, `Println`, `Sprint`, `Sprintf` + - Supports HTML tag-style color rendering, such as `message`. + - In addition to using built-in tags, it also supports custom color attributes + - Custom color attributes support the use of 16 color names, 256 color values, rgb color values and hex color values + - Support working on Windows `cmd` and `powerShell` terminal + - Basic colors: `Bold`, `Black`, `White`, `Gray`, `Red`, `Green`, `Yellow`, `Blue`, `Magenta`, `Cyan` + - Additional styles: `Info`, `Note`, `Light`, `Error`, `Danger`, `Notice`, `Success`, `Comment`, `Primary`, `Warning`, `Question`, `Secondary` + - Support by set `NO_COLOR` for disable color or use `FORCE_COLOR` for force open color render. + - Support Rgb, 256, 16 color conversion + +## GoDoc + + - [godoc for gopkg](https://pkg.go.dev/gopkg.in/gookit/color.v1) + - [godoc for github](https://pkg.go.dev/github.com/gookit/color) + +## Install + +```bash +go get github.com/gookit/color +``` + +## Quick start + +```go +package main + +import ( + "fmt" + + "github.com/gookit/color" +) + +func main() { + // quick use package func + color.Redp("Simple to use color") + color.Redln("Simple to use color") + color.Greenp("Simple to use color\n") + color.Cyanln("Simple to use color") + color.Yellowln("Simple to use color") + + // quick use like fmt.Print* + color.Red.Println("Simple to use color") + color.Green.Print("Simple to use color\n") + color.Cyan.Printf("Simple to use %s\n", "color") + color.Yellow.Printf("Simple to use %s\n", "color") + + // use like func + red := color.FgRed.Render + green := color.FgGreen.Render + fmt.Printf("%s line %s library\n", red("Command"), green("color")) + + // custom color + color.New(color.FgWhite, color.BgBlack).Println("custom color style") + + // can also: + color.Style{color.FgCyan, color.OpBold}.Println("custom color style") + + // internal theme/style: + color.Info.Tips("message") + color.Info.Prompt("message") + color.Info.Println("message") + color.Warn.Println("message") + color.Error.Println("message") + + // use style tag + color.Print("hello, welcome\n") + // Custom label attr: Supports the use of 16 color names, 256 color values, rgb color values and hex color values + color.Println("hello, welcome") + + // apply a style tag + color.Tag("info").Println("info style text") + + // prompt message + color.Info.Prompt("prompt style message") + color.Warn.Prompt("prompt style message") + + // tips message + color.Info.Tips("tips style message") + color.Warn.Tips("tips style message") +} +``` + +Run demo: `go run ./_examples/demo.go` + +![colored-out](_examples/images/color-demo.jpg) + +## Basic/16 color + +Supported on any Windows version. Provide generic API methods: `Print`, `Printf`, `Println`, `Sprint`, `Sprintf` + +```go +color.Bold.Println("bold message") +color.Black.Println("bold message") +color.White.Println("bold message") +color.Gray.Println("bold message") +color.Red.Println("yellow message") +color.Blue.Println("yellow message") +color.Cyan.Println("yellow message") +color.Yellow.Println("yellow message") +color.Magenta.Println("yellow message") + +// Only use foreground color +color.FgCyan.Printf("Simple to use %s\n", "color") +// Only use background color +color.BgRed.Printf("Simple to use %s\n", "color") +``` + +Run demo: `go run ./_examples/color_16.go` + +![basic-color](_examples/images/basic-color.png) + +### Custom build color + +```go +// Full custom: foreground, background, option +myStyle := color.New(color.FgWhite, color.BgBlack, color.OpBold) +myStyle.Println("custom color style") + +// can also: +color.Style{color.FgCyan, color.OpBold}.Println("custom color style") +``` + +custom set console settings: + +```go +// set console color +color.Set(color.FgCyan) + +// print message +fmt.Print("message") + +// reset console settings +color.Reset() +``` + +### Additional styles + +provide generic API methods: `Print`, `Printf`, `Println`, `Sprint`, `Sprintf` + +print message use defined style: + +```go +color.Info.Println("Info message") +color.Note.Println("Note message") +color.Notice.Println("Notice message") +color.Error.Println("Error message") +color.Danger.Println("Danger message") +color.Warn.Println("Warn message") +color.Debug.Println("Debug message") +color.Primary.Println("Primary message") +color.Question.Println("Question message") +color.Secondary.Println("Secondary message") +``` + +Run demo: `go run ./_examples/theme_basic.go` + +![theme-basic](_examples/images/theme-basic.png) + +**Tips style** + +```go +color.Info.Tips("Info tips message") +color.Note.Tips("Note tips message") +color.Notice.Tips("Notice tips message") +color.Error.Tips("Error tips message") +color.Danger.Tips("Danger tips message") +color.Warn.Tips("Warn tips message") +color.Debug.Tips("Debug tips message") +color.Primary.Tips("Primary tips message") +color.Question.Tips("Question tips message") +color.Secondary.Tips("Secondary tips message") +``` + +Run demo: `go run ./_examples/theme_tips.go` + +![theme-tips](_examples/images/theme-tips.png) + +**Prompt Style** + +```go +color.Info.Prompt("Info prompt message") +color.Note.Prompt("Note prompt message") +color.Notice.Prompt("Notice prompt message") +color.Error.Prompt("Error prompt message") +color.Danger.Prompt("Danger prompt message") +color.Warn.Prompt("Warn prompt message") +color.Debug.Prompt("Debug prompt message") +color.Primary.Prompt("Primary prompt message") +color.Question.Prompt("Question prompt message") +color.Secondary.Prompt("Secondary prompt message") +``` + +Run demo: `go run ./_examples/theme_prompt.go` + +![theme-prompt](_examples/images/theme-prompt.png) + +**Block Style** + +```go +color.Info.Block("Info block message") +color.Note.Block("Note block message") +color.Notice.Block("Notice block message") +color.Error.Block("Error block message") +color.Danger.Block("Danger block message") +color.Warn.Block("Warn block message") +color.Debug.Block("Debug block message") +color.Primary.Block("Primary block message") +color.Question.Block("Question block message") +color.Secondary.Block("Secondary block message") +``` + +Run demo: `go run ./_examples/theme_block.go` + +![theme-block](_examples/images/theme-block.png) + +## 256-color usage + +> 256 colors support Windows CMD, PowerShell environment after `v1.2.4` + +### Set the foreground or background color + +- `color.C256(val uint8, isBg ...bool) Color256` + +```go +c := color.C256(132) // fg color +c.Println("message") +c.Printf("format %s", "message") + +c := color.C256(132, true) // bg color +c.Println("message") +c.Printf("format %s", "message") +``` + +### 256-color style + +Can be used to set foreground and background colors at the same time. + +- `S256(fgAndBg ...uint8) *Style256` + +```go +s := color.S256(32, 203) +s.Println("message") +s.Printf("format %s", "message") +``` + +with options: + +```go +s := color.S256(32, 203) +s.SetOpts(color.Opts{color.OpBold}) + +s.Println("style with options") +s.Printf("style with %s\n", "options") +``` + +Run demo: `go run ./_examples/color_256.go` + +![color-tags](_examples/images/color-256.png) + +## RGB/True color + +> RGB colors support Windows `CMD`, `PowerShell` environment after `v1.2.4` + +**Preview:** + +> Run demo: `Run demo: go run ./_examples/color_rgb.go` + +![color-rgb](_examples/images/color-rgb.png) + +example: + +```go +color.RGB(30, 144, 255).Println("message. use RGB number") + +color.HEX("#1976D2").Println("blue-darken") +color.HEX("#D50000", true).Println("red-accent. use HEX style") + +color.RGBStyleFromString("213,0,0").Println("red-accent. use RGB number") +color.HEXStyle("eee", "D50000").Println("deep-purple color") +``` + +### Set the foreground or background color + +- `color.RGB(r, g, b uint8, isBg ...bool) RGBColor` + +```go +c := color.RGB(30,144,255) // fg color +c.Println("message") +c.Printf("format %s", "message") + +c := color.RGB(30,144,255, true) // bg color +c.Println("message") +c.Printf("format %s", "message") +``` + +Create a style from an hexadecimal color string: + +- `color.HEX(hex string, isBg ...bool) RGBColor` + +```go +c := color.HEX("ccc") // can also: "cccccc" "#cccccc" +c.Println("message") +c.Printf("format %s", "message") + +c = color.HEX("aabbcc", true) // as bg color +c.Println("message") +c.Printf("format %s", "message") +``` + +### RGB color style + +Can be used to set the foreground and background colors at the same time. + +- `color.NewRGBStyle(fg RGBColor, bg ...RGBColor) *RGBStyle` + +```go +s := color.NewRGBStyle(RGB(20, 144, 234), RGB(234, 78, 23)) +s.Println("message") +s.Printf("format %s", "message") +``` + +Create a style from an hexadecimal color string: + +- `color.HEXStyle(fg string, bg ...string) *RGBStyle` + +```go +s := color.HEXStyle("11aa23", "eee") +s.Println("message") +s.Printf("format %s", "message") +``` + +with options: + +```go +s := color.HEXStyle("11aa23", "eee") +s.SetOpts(color.Opts{color.OpBold}) + +s.Println("style with options") +s.Printf("style with %s\n", "options") +``` + +## HTML-like tag usage + +**Supported** on Windows `cmd.exe` `PowerShell` . + +```go +// use style tag +color.Print("hello, welcome") +color.Println("hello") +color.Println("hello") +color.Println("hello") + +// custom color attributes +color.Print("hello, welcome\n") + +// Custom label attr: Supports the use of 16 color names, 256 color values, rgb color values and hex color values +color.Println("hello, welcome") +``` + +- `color.Tag` + +```go +// set a style tag +color.Tag("info").Print("info style text") +color.Tag("info").Printf("%s style text", "info") +color.Tag("info").Println("info style text") +``` + +Run demo: `go run ./_examples/color_tag.go` + +![color-tags](_examples/images/color-tags.png) + +## Color convert + +Supports conversion between Rgb, 256, 16 colors, `Rgb <=> 256 <=> 16` + +```go +basic := color.Red +basic.Println("basic color") + +c256 := color.Red.C256() +c256.Println("256 color") +c256.C16().Println("basic color") + +rgb := color.Red.RGB() +rgb.Println("rgb color") +rgb.C256().Println("256 color") +``` + +## Func refer + +There are some useful functions reference + +- `Disable()` disable color render +- `SetOutput(io.Writer)` custom set the colored text output writer +- `ForceOpenColor()` force open color render +- `Colors2code(colors ...Color) string` Convert colors to code. return like "32;45;3" +- `ClearCode(str string) string` Use for clear color codes +- `ClearTag(s string) string` clear all color html-tag for a string +- `IsConsole(w io.Writer)` Determine whether w is one of stderr, stdout, stdin +- `HexToRgb(hex string) (rgb []int)` Convert hex color string to RGB numbers +- `RgbToHex(rgb []int) string` Convert RGB to hex code +- More useful func please see https://pkg.go.dev/github.com/gookit/color + +## Project use + +Check out these projects, which use https://github.com/gookit/color : + +- https://github.com/Delta456/box-cli-maker Make Highly Customized Boxes for your CLI + +## Gookit packages + + - [gookit/ini](https://github.com/gookit/ini) Go config management, use INI files + - [gookit/rux](https://github.com/gookit/rux) Simple and fast request router for golang HTTP + - [gookit/gcli](https://github.com/gookit/gcli) build CLI application, tool library, running CLI commands + - [gookit/slog](https://github.com/gookit/slog) Concise and extensible go log library + - [gookit/event](https://github.com/gookit/event) Lightweight event manager and dispatcher implements by Go + - [gookit/cache](https://github.com/gookit/cache) Generic cache use and cache manager for golang. support File, Memory, Redis, Memcached. + - [gookit/config](https://github.com/gookit/config) Go config management. support JSON, YAML, TOML, INI, HCL, ENV and Flags + - [gookit/color](https://github.com/gookit/color) A command-line color library with true color support, universal API methods and Windows support + - [gookit/filter](https://github.com/gookit/filter) Provide filtering, sanitizing, and conversion of golang data + - [gookit/validate](https://github.com/gookit/validate) Use for data validation and filtering. support Map, Struct, Form data + - [gookit/goutil](https://github.com/gookit/goutil) Some utils for the Go: string, array/slice, map, format, cli, env, filesystem, test and more + - More, please see https://github.com/gookit + +## See also + + - [inhere/console](https://github.com/inhere/php-console) + - [xo/terminfo](https://github.com/xo/terminfo) + - [beego/bee](https://github.com/beego/bee) + - [issue9/term](https://github.com/issue9/term) + - [ANSI escape code](https://en.wikipedia.org/wiki/ANSI_escape_code) + - [Standard ANSI color map](https://conemu.github.io/en/AnsiEscapeCodes.html#Standard_ANSI_color_map) + - [Terminal Colors](https://gist.github.com/XVilka/8346728) + +## License + +[MIT](/LICENSE) diff --git a/vendor/github.com/gookit/color/README.zh-CN.md b/vendor/github.com/gookit/color/README.zh-CN.md new file mode 100644 index 000000000..dee1458b0 --- /dev/null +++ b/vendor/github.com/gookit/color/README.zh-CN.md @@ -0,0 +1,472 @@ +# CLI Color + +![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/gookit/color?style=flat-square) +[![Actions Status](https://github.com/gookit/color/workflows/action-tests/badge.svg)](https://github.com/gookit/color/actions) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/51b28c5f7ffe4cc2b0f12ecf25ed247f)](https://app.codacy.com/app/inhere/color) +[![GoDoc](https://godoc.org/github.com/gookit/color?status.svg)](https://pkg.go.dev/github.com/gookit/color?tab=overview) +[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/gookit/color)](https://github.com/gookit/color) +[![Build Status](https://travis-ci.org/gookit/color.svg?branch=master)](https://travis-ci.org/gookit/color) +[![Coverage Status](https://coveralls.io/repos/github/gookit/color/badge.svg?branch=master)](https://coveralls.io/github/gookit/color?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/gookit/color)](https://goreportcard.com/report/github.com/gookit/color) + +Golang下的命令行色彩使用库, 拥有丰富的色彩渲染输出,通用的API方法,兼容Windows系统 + +> **[EN README](README.md)** + +基本颜色预览: + +![basic-color](_examples/images/basic-color2.png) + +现在,256色和RGB色彩也已经支持windows CMD和PowerShell中工作: + +![color-on-cmd-pwsh](_examples/images/color-on-cmd-pwsh.jpg) + +## 功能特色 + + - 使用简单方便 + - 支持丰富的颜色输出, 16色(4bit),256色(8bit),RGB色彩(24bit, RGB) + - 16色(4bit)是最常用和支持最广的,支持Windows `cmd.exe` + - 自 `v1.2.4` 起 **256色(8bit),RGB色彩(24bit)均支持Windows CMD和PowerShell终端** + - 请查看 [this gist](https://gist.github.com/XVilka/8346728) 了解支持RGB色彩的终端 + - 提供通用的API方法:`Print` `Printf` `Println` `Sprint` `Sprintf` + - 同时支持html标签式的颜色渲染,除了使用内置标签,同时支持自定义颜色属性 + - 例如: `this an message` 标签内部的文本将会渲染为绿色字体 + - 自定义颜色属性: 支持使用16色彩名称,256色彩值,rgb色彩值以及hex色彩值 + - 基础色彩: `Bold` `Black` `White` `Gray` `Red` `Green` `Yellow` `Blue` `Magenta` `Cyan` + - 扩展风格: `Info` `Note` `Light` `Error` `Danger` `Notice` `Success` `Comment` `Primary` `Warning` `Question` `Secondary` + - 支持通过设置环境变量 `NO_COLOR` 来禁用色彩,或者使用 `FORCE_COLOR` 来强制使用色彩渲染. + - 支持 Rgb, 256, 16 色彩之间的互相转换 + - 支持Linux、Mac,同时兼容Windows系统环境 + +## GoDoc + + - [godoc for gopkg](https://pkg.go.dev/gopkg.in/gookit/color.v1) + - [godoc for github](https://pkg.go.dev/github.com/gookit/color) + +## 安装 + +```bash +go get github.com/gookit/color +``` + +## 快速开始 + +如下,引入当前包就可以快速的使用 + +```go +package main + +import ( + "fmt" + + "github.com/gookit/color" +) + +func main() { + // 简单快速的使用,跟 fmt.Print* 类似 + color.Redp("Simple to use color") + color.Redln("Simple to use color") + color.Greenp("Simple to use color\n") + color.Cyanln("Simple to use color") + color.Yellowln("Simple to use color") + + // 简单快速的使用,跟 fmt.Print* 类似 + color.Red.Println("Simple to use color") + color.Green.Print("Simple to use color\n") + color.Cyan.Printf("Simple to use %s\n", "color") + color.Yellow.Printf("Simple to use %s\n", "color") + + // use like func + red := color.FgRed.Render + green := color.FgGreen.Render + fmt.Printf("%s line %s library\n", red("Command"), green("color")) + + // 自定义颜色 + color.New(color.FgWhite, color.BgBlack).Println("custom color style") + + // 也可以: + color.Style{color.FgCyan, color.OpBold}.Println("custom color style") + + // internal style: + color.Info.Println("message") + color.Warn.Println("message") + color.Error.Println("message") + + // 使用内置颜色标签 + color.Print("hello, welcome\n") + // 自定义标签: 支持使用16色彩名称,256色彩值,rgb色彩值以及hex色彩值 + color.Println("hello, welcome") + + // apply a style tag + color.Tag("info").Println("info style text") + + // prompt message + color.Info.Prompt("prompt style message") + color.Warn.Prompt("prompt style message") + + // tips message + color.Info.Tips("tips style message") + color.Warn.Tips("tips style message") +} +``` + +> 运行 demo: `go run ./_examples/demo.go` + +![colored-out](_examples/images/color-demo.jpg) + +## 基础颜色(16-color) + +提供通用的API方法:`Print` `Printf` `Println` `Sprint` `Sprintf` + +> 支持在windows `cmd.exe` `powerShell` 等终端使用 + +```go +color.Bold.Println("bold message") +color.Black.Println("bold message") +color.White.Println("bold message") +color.Gray.Println("bold message") +color.Red.Println("yellow message") +color.Blue.Println("yellow message") +color.Cyan.Println("yellow message") +color.Yellow.Println("yellow message") +color.Magenta.Println("yellow message") + +// Only use foreground color +color.FgCyan.Printf("Simple to use %s\n", "color") +// Only use background color +color.BgRed.Printf("Simple to use %s\n", "color") +``` + +> 运行demo: `go run ./_examples/color_16.go` + +![basic-color](_examples/images/basic-color.png) + +### 构建风格 + +```go +// 仅设置前景色 +color.FgCyan.Printf("Simple to use %s\n", "color") +// 仅设置背景色 +color.BgRed.Printf("Simple to use %s\n", "color") + +// 完全自定义: 前景色 背景色 选项 +style := color.New(color.FgWhite, color.BgBlack, color.OpBold) +style.Println("custom color style") + +// 也可以: +color.Style{color.FgCyan, color.OpBold}.Println("custom color style") +``` + +直接设置控制台属性: + +```go +// 设置console颜色 +color.Set(color.FgCyan) + +// 输出信息 +fmt.Print("message") + +// 重置console颜色 +color.Reset() +``` + +> 当然,color已经内置丰富的色彩风格支持 + +### 扩展风格方法 + +提供通用的API方法:`Print` `Printf` `Println` `Sprint` `Sprintf` + +> 支持在windows `cmd.exe` `powerShell` 等终端使用 + +基础使用: + +```go +// print message +color.Info.Println("Info message") +color.Note.Println("Note message") +color.Notice.Println("Notice message") +color.Error.Println("Error message") +color.Danger.Println("Danger message") +color.Warn.Println("Warn message") +color.Debug.Println("Debug message") +color.Primary.Println("Primary message") +color.Question.Println("Question message") +color.Secondary.Println("Secondary message") +``` + +Run demo: `go run ./_examples/theme_basic.go` + +![theme-basic](_examples/images/theme-basic.png) + +**简约提示风格** + +```go +color.Info.Tips("Info tips message") +color.Note.Tips("Note tips message") +color.Notice.Tips("Notice tips message") +color.Error.Tips("Error tips message") +color.Danger.Tips("Danger tips message") +color.Warn.Tips("Warn tips message") +color.Debug.Tips("Debug tips message") +color.Primary.Tips("Primary tips message") +color.Question.Tips("Question tips message") +color.Secondary.Tips("Secondary tips message") +``` + +Run demo: `go run ./_examples/theme_tips.go` + +![theme-tips](_examples/images/theme-tips.png) + +**着重提示风格** + +```go +color.Info.Prompt("Info prompt message") +color.Note.Prompt("Note prompt message") +color.Notice.Prompt("Notice prompt message") +color.Error.Prompt("Error prompt message") +color.Danger.Prompt("Danger prompt message") +``` + +Run demo: `go run ./_examples/theme_prompt.go` + +![theme-prompt](_examples/images/theme-prompt.png) + +**强调提示风格** + +```go +color.Warn.Block("Warn block message") +color.Debug.Block("Debug block message") +color.Primary.Block("Primary block message") +color.Question.Block("Question block message") +color.Secondary.Block("Secondary block message") +``` + +Run demo: `go run ./_examples/theme_block.go` + +![theme-block](_examples/images/theme-block.png) + +## 256 色彩使用 + +> 256色彩在 `v1.2.4` 后支持Windows CMD,PowerShell 环境 + +### 使用前景或后景色 + + - `color.C256(val uint8, isBg ...bool) Color256` + +```go +c := color.C256(132) // fg color +c.Println("message") +c.Printf("format %s", "message") + +c := color.C256(132, true) // bg color +c.Println("message") +c.Printf("format %s", "message") +``` + +### 使用256 色彩风格 + +> 可同时设置前景和背景色 + +- `color.S256(fgAndBg ...uint8) *Style256` + +```go +s := color.S256(32, 203) +s.Println("message") +s.Printf("format %s", "message") +``` + +可以同时添加选项设置: + +```go +s := color.S256(32, 203) +s.SetOpts(color.Opts{color.OpBold}) + +s.Println("style with options") +s.Printf("style with %s\n", "options") +``` + +> 运行 demo: `go run ./_examples/color_256.go` + +![color-tags](_examples/images/color-256.png) + +## RGB/True色彩使用 + +> RGB色彩在 `v1.2.4` 后支持 Windows `CMD`, `PowerShell` 环境 + +**效果预览:** + +> 运行 demo: `Run demo: go run ./_examples/color_rgb.go` + +![color-rgb](_examples/images/color-rgb.png) + +代码示例: + +```go +color.RGB(30, 144, 255).Println("message. use RGB number") + +color.HEX("#1976D2").Println("blue-darken") +color.HEX("#D50000", true).Println("red-accent. use HEX style") + +color.RGBStyleFromString("213,0,0").Println("red-accent. use RGB number") +color.HEXStyle("eee", "D50000").Println("deep-purple color") +``` + +### 使用前景或后景色 + +- `color.RGB(r, g, b uint8, isBg ...bool) RGBColor` + +```go +c := color.RGB(30,144,255) // fg color +c.Println("message") +c.Printf("format %s", "message") + +c := color.RGB(30,144,255, true) // bg color +c.Println("message") +c.Printf("format %s", "message") +``` + +- `color.HEX(hex string, isBg ...bool) RGBColor` 从16进制颜色创建 + +```go +c := color.HEX("ccc") // 也可以写为: "cccccc" "#cccccc" +c.Println("message") +c.Printf("format %s", "message") + +c = color.HEX("aabbcc", true) // as bg color +c.Println("message") +c.Printf("format %s", "message") +``` + +### 使用RGB风格 + +> 可同时设置前景和背景色 + +- `color.NewRGBStyle(fg RGBColor, bg ...RGBColor) *RGBStyle` + +```go +s := color.NewRGBStyle(RGB(20, 144, 234), RGB(234, 78, 23)) +s.Println("message") +s.Printf("format %s", "message") +``` + +- `color.HEXStyle(fg string, bg ...string) *RGBStyle` 从16进制颜色创建 + +```go +s := color.HEXStyle("11aa23", "eee") +s.Println("message") +s.Printf("format %s", "message") +``` + +- 可以同时添加选项设置: + +```go +s := color.HEXStyle("11aa23", "eee") +s.SetOpts(color.Opts{color.OpBold}) + +s.Println("style with options") +s.Printf("style with %s\n", "options") +``` + +## 使用颜色标签 + +> **支持** 在windows `cmd.exe` `PowerShell` 使用 + +使用内置的颜色标签,可以非常方便简单的构建自己需要的任何格式 + +> 同时支持自定义颜色属性: 支持使用16色彩名称,256色彩值,rgb色彩值以及hex色彩值 + +```go +// 使用内置的 color tag +color.Print("hello, welcome") +color.Println("hello") +color.Println("hello") +color.Println("hello") + +// 自定义颜色属性 +color.Print("hello, welcome\n") + +// 自定义颜色属性: 支持使用16色彩名称,256色彩值,rgb色彩值以及hex色彩值 +color.Println("hello, welcome") +``` + +- 使用 `color.Tag` + +给后面输出的文本信息加上给定的颜色风格标签 + +```go +// set a style tag +color.Tag("info").Print("info style text") +color.Tag("info").Printf("%s style text", "info") +color.Tag("info").Println("info style text") +``` + +> 运行 demo: `go run ./_examples/color_tag.go` + +![color-tags](_examples/images/color-tags.png) + +## 颜色转换 + +支持 Rgb, 256, 16 色彩之间的互相转换 `Rgb <=> 256 <=> 16` + +```go +basic := color.Red +basic.Println("basic color") + +c256 := color.Red.C256() +c256.Println("256 color") +c256.C16().Println("basic color") + +rgb := color.Red.RGB() +rgb.Println("rgb color") +rgb.C256().Println("256 color") +``` + +## 方法参考 + +一些有用的工具方法参考 + +- `Disable()` disable color render +- `SetOutput(io.Writer)` custom set the colored text output writer +- `ForceOpenColor()` force open color render +- `ClearCode(str string) string` Use for clear color codes +- `Colors2code(colors ...Color) string` Convert colors to code. return like "32;45;3" +- `ClearTag(s string) string` clear all color html-tag for a string +- `IsConsole(w io.Writer)` Determine whether w is one of stderr, stdout, stdin +- `HexToRgb(hex string) (rgb []int)` Convert hex color string to RGB numbers +- `RgbToHex(rgb []int) string` Convert RGB to hex code +- 更多请查看文档 https://pkg.go.dev/github.com/gookit/color + +## 使用color的项目 + +看看这些使用了 https://github.com/gookit/color 的项目: + +- https://github.com/Delta456/box-cli-maker Make Highly Customized Boxes for your CLI + +## Gookit 工具包 + + - [gookit/ini](https://github.com/gookit/ini) INI配置读取管理,支持多文件加载,数据覆盖合并, 解析ENV变量, 解析变量引用 + - [gookit/rux](https://github.com/gookit/rux) Simple and fast request router for golang HTTP + - [gookit/gcli](https://github.com/gookit/gcli) Go的命令行应用,工具库,运行CLI命令,支持命令行色彩,用户交互,进度显示,数据格式化显示 + - [gookit/slog](https://github.com/gookit/slog) 简洁易扩展的go日志库 + - [gookit/event](https://github.com/gookit/event) Go实现的轻量级的事件管理、调度程序库, 支持设置监听器的优先级, 支持对一组事件进行监听 + - [gookit/cache](https://github.com/gookit/cache) 通用的缓存使用包装库,通过包装各种常用的驱动,来提供统一的使用API + - [gookit/config](https://github.com/gookit/config) Go应用配置管理,支持多种格式(JSON, YAML, TOML, INI, HCL, ENV, Flags),多文件加载,远程文件加载,数据合并 + - [gookit/color](https://github.com/gookit/color) CLI 控制台颜色渲染工具库, 拥有简洁的使用API,支持16色,256色,RGB色彩渲染输出 + - [gookit/filter](https://github.com/gookit/filter) 提供对Golang数据的过滤,净化,转换 + - [gookit/validate](https://github.com/gookit/validate) Go通用的数据验证与过滤库,使用简单,内置大部分常用验证、过滤器 + - [gookit/goutil](https://github.com/gookit/goutil) Go 的一些工具函数,格式化,特殊处理,常用信息获取等 + - 更多请查看 https://github.com/gookit + +## 参考项目 + + - [inhere/console](https://github.com/inhere/php-console) + - [xo/terminfo](https://github.com/xo/terminfo) + - [beego/bee](https://github.com/beego/bee) + - [issue9/term](https://github.com/issue9/term) + - [ANSI转义序列](https://zh.wikipedia.org/wiki/ANSI转义序列) + - [Standard ANSI color map](https://conemu.github.io/en/AnsiEscapeCodes.html#Standard_ANSI_color_map) + - [Terminal Colors](https://gist.github.com/XVilka/8346728) + +## License + +MIT diff --git a/vendor/github.com/gookit/color/color.go b/vendor/github.com/gookit/color/color.go new file mode 100644 index 000000000..edb2a5d7b --- /dev/null +++ b/vendor/github.com/gookit/color/color.go @@ -0,0 +1,238 @@ +/* +Package color is Command line color library. +Support rich color rendering output, universal API method, compatible with Windows system + +Source code and other details for the project are available at GitHub: + + https://github.com/gookit/color + +More usage please see README and tests. +*/ +package color + +import ( + "fmt" + "io" + "os" + "regexp" + + "github.com/xo/terminfo" +) + +// terminal color available level alias of the terminfo.ColorLevel* +const ( + LevelNo = terminfo.ColorLevelNone // not support color. + Level16 = terminfo.ColorLevelBasic // 3/4 bit color supported + Level256 = terminfo.ColorLevelHundreds // 8 bit color supported + LevelRgb = terminfo.ColorLevelMillions // (24 bit)true color supported +) + +// color render templates +// ESC 操作的表示: +// "\033"(Octal 8进制) = "\x1b"(Hexadecimal 16进制) = 27 (10进制) +const ( + SettingTpl = "\x1b[%sm" + FullColorTpl = "\x1b[%sm%s\x1b[0m" +) + +// ResetSet Close all properties. +const ResetSet = "\x1b[0m" + +// CodeExpr regex to clear color codes eg "\033[1;36mText\x1b[0m" +const CodeExpr = `\033\[[\d;?]+m` + +var ( + // Enable switch color render and display + // + // NOTICE: + // if ENV: NO_COLOR is not empty, will disable color render. + Enable = os.Getenv("NO_COLOR") == "" + // RenderTag render HTML tag on call color.Xprint, color.PrintX + RenderTag = true + // debug mode for development. + // + // set env: + // COLOR_DEBUG_MODE=on + // or: + // COLOR_DEBUG_MODE=on go run ./_examples/envcheck.go + debugMode = os.Getenv("COLOR_DEBUG_MODE") == "on" + // inner errors record on detect color level + innerErrs []error + // output the default io.Writer message print + output io.Writer = os.Stdout + // mark current env, It's like in `cmd.exe` + // if not in windows, it's always is False. + isLikeInCmd bool + // the color support level for current terminal + // needVTP - need enable VTP, only for windows OS + colorLevel, needVTP = detectTermColorLevel() + // match color codes + codeRegex = regexp.MustCompile(CodeExpr) + // mark current env is support color. + // Always: isLikeInCmd != supportColor + // supportColor = IsSupportColor() +) + +// TermColorLevel value on current ENV +func TermColorLevel() terminfo.ColorLevel { + return colorLevel +} + +// SupportColor on the current ENV +func SupportColor() bool { + return colorLevel > terminfo.ColorLevelNone +} + +// Support16Color on the current ENV +// func Support16Color() bool { +// return colorLevel > terminfo.ColorLevelNone +// } + +// Support256Color on the current ENV +func Support256Color() bool { + return colorLevel > terminfo.ColorLevelBasic +} + +// SupportTrueColor on the current ENV +func SupportTrueColor() bool { + return colorLevel > terminfo.ColorLevelHundreds +} + +/************************************************************* + * global settings + *************************************************************/ + +// Set set console color attributes +func Set(colors ...Color) (int, error) { + code := Colors2code(colors...) + err := SetTerminal(code) + return 0, err +} + +// Reset reset console color attributes +func Reset() (int, error) { + err := ResetTerminal() + return 0, err +} + +// Disable disable color output +func Disable() bool { + oldVal := Enable + Enable = false + return oldVal +} + +// NotRenderTag on call color.Xprint, color.PrintX +func NotRenderTag() { + RenderTag = false +} + +// SetOutput set default colored text output +func SetOutput(w io.Writer) { + output = w +} + +// ResetOutput reset output +func ResetOutput() { + output = os.Stdout +} + +// ResetOptions reset all package option setting +func ResetOptions() { + RenderTag = true + Enable = true + output = os.Stdout +} + +// ForceColor force open color render +func ForceSetColorLevel(level terminfo.ColorLevel) terminfo.ColorLevel { + oldLevelVal := colorLevel + colorLevel = level + return oldLevelVal +} + +// ForceColor force open color render +func ForceColor() terminfo.ColorLevel { + return ForceOpenColor() +} + +// ForceOpenColor force open color render +func ForceOpenColor() terminfo.ColorLevel { + // TODO should set level to ? + return ForceSetColorLevel(terminfo.ColorLevelMillions) +} + +// IsLikeInCmd check result +// Deprecated +func IsLikeInCmd() bool { + return isLikeInCmd +} + +// InnerErrs info +func InnerErrs() []error { + return innerErrs +} + +/************************************************************* + * render color code + *************************************************************/ + +// RenderCode render message by color code. +// Usage: +// msg := RenderCode("3;32;45", "some", "message") +func RenderCode(code string, args ...interface{}) string { + var message string + if ln := len(args); ln == 0 { + return "" + } + + message = fmt.Sprint(args...) + if len(code) == 0 { + return message + } + + // disabled OR not support color + if !Enable || !SupportColor() { + return ClearCode(message) + } + + return fmt.Sprintf(FullColorTpl, code, message) +} + +// RenderWithSpaces Render code with spaces. +// If the number of args is > 1, a space will be added between the args +func RenderWithSpaces(code string, args ...interface{}) string { + message := formatArgsForPrintln(args) + if len(code) == 0 { + return message + } + + // disabled OR not support color + if !Enable || !SupportColor() { + return ClearCode(message) + } + + return fmt.Sprintf(FullColorTpl, code, message) +} + +// RenderString render a string with color code. +// Usage: +// msg := RenderString("3;32;45", "a message") +func RenderString(code string, str string) string { + if len(code) == 0 || str == "" { + return str + } + + // disabled OR not support color + if !Enable || !SupportColor() { + return ClearCode(str) + } + + return fmt.Sprintf(FullColorTpl, code, str) +} + +// ClearCode clear color codes. +// eg: "\033[36;1mText\x1b[0m" -> "Text" +func ClearCode(str string) string { + return codeRegex.ReplaceAllString(str, "") +} diff --git a/vendor/github.com/gookit/color/color_16.go b/vendor/github.com/gookit/color/color_16.go new file mode 100644 index 000000000..28e1048e0 --- /dev/null +++ b/vendor/github.com/gookit/color/color_16.go @@ -0,0 +1,440 @@ +package color + +import ( + "fmt" + "strconv" +) + +// Color Color16, 16 color value type +// 3(2^3=8) OR 4(2^4=16) bite color. +type Color uint8 +type Basic = Color // alias of Color + +// Opts basic color options. code: 0 - 9 +type Opts []Color + +// Add option value +func (o *Opts) Add(ops ...Color) { + for _, op := range ops { + if uint8(op) < 10 { + *o = append(*o, op) + } + } +} + +// IsValid options +func (o Opts) IsValid() bool { + return len(o) > 0 +} + +// IsEmpty options +func (o Opts) IsEmpty() bool { + return len(o) == 0 +} + +// String options to string. eg: "1;3" +func (o Opts) String() string { + return Colors2code(o...) +} + +/************************************************************* + * Basic 16 color definition + *************************************************************/ + +// Base value for foreground/background color +const ( + FgBase uint8 = 30 + BgBase uint8 = 40 + // hi color base code + HiFgBase uint8 = 90 + HiBgBase uint8 = 100 +) + +// Foreground colors. basic foreground colors 30 - 37 +const ( + FgBlack Color = iota + 30 + FgRed + FgGreen + FgYellow + FgBlue + FgMagenta // 品红 + FgCyan // 青色 + FgWhite + // FgDefault revert default FG + FgDefault Color = 39 +) + +// Extra foreground color 90 - 97(非标准) +const ( + FgDarkGray Color = iota + 90 // 亮黑(灰) + FgLightRed + FgLightGreen + FgLightYellow + FgLightBlue + FgLightMagenta + FgLightCyan + FgLightWhite + // FgGray is alias of FgDarkGray + FgGray Color = 90 // 亮黑(灰) +) + +// Background colors. basic background colors 40 - 47 +const ( + BgBlack Color = iota + 40 + BgRed + BgGreen + BgYellow // BgBrown like yellow + BgBlue + BgMagenta + BgCyan + BgWhite + // BgDefault revert default BG + BgDefault Color = 49 +) + +// Extra background color 100 - 107(非标准) +const ( + BgDarkGray Color = iota + 100 + BgLightRed + BgLightGreen + BgLightYellow + BgLightBlue + BgLightMagenta + BgLightCyan + BgLightWhite + // BgGray is alias of BgDarkGray + BgGray Color = 100 +) + +// Option settings +const ( + OpReset Color = iota // 0 重置所有设置 + OpBold // 1 加粗 + OpFuzzy // 2 模糊(不是所有的终端仿真器都支持) + OpItalic // 3 斜体(不是所有的终端仿真器都支持) + OpUnderscore // 4 下划线 + OpBlink // 5 闪烁 + OpFastBlink // 5 快速闪烁(未广泛支持) + OpReverse // 7 颠倒的 交换背景色与前景色 + OpConcealed // 8 隐匿的 + OpStrikethrough // 9 删除的,删除线(未广泛支持) +) + +// There are basic and light foreground color aliases +const ( + Red = FgRed + Cyan = FgCyan + Gray = FgDarkGray // is light Black + Blue = FgBlue + Black = FgBlack + Green = FgGreen + White = FgWhite + Yellow = FgYellow + Magenta = FgMagenta + + // special + + Bold = OpBold + Normal = FgDefault + + // extra light + + LightRed = FgLightRed + LightCyan = FgLightCyan + LightBlue = FgLightBlue + LightGreen = FgLightGreen + LightWhite = FgLightWhite + LightYellow = FgLightYellow + LightMagenta = FgLightMagenta + + HiRed = FgLightRed + HiCyan = FgLightCyan + HiBlue = FgLightBlue + HiGreen = FgLightGreen + HiWhite = FgLightWhite + HiYellow = FgLightYellow + HiMagenta = FgLightMagenta + + BgHiRed = BgLightRed + BgHiCyan = BgLightCyan + BgHiBlue = BgLightBlue + BgHiGreen = BgLightGreen + BgHiWhite = BgLightWhite + BgHiYellow = BgLightYellow + BgHiMagenta = BgLightMagenta +) + +// Bit4 an method for create Color +func Bit4(code uint8) Color { + return Color(code) +} + +/************************************************************* + * Color render methods + *************************************************************/ + +// Name get color code name. +func (c Color) Name() string { + name, ok := basic2nameMap[uint8(c)] + if ok { + return name + } + return "unknown" +} + +// Text render a text message +func (c Color) Text(message string) string { + return RenderString(c.String(), message) +} + +// Render messages by color setting +// Usage: +// green := color.FgGreen.Render +// fmt.Println(green("message")) +func (c Color) Render(a ...interface{}) string { + return RenderCode(c.String(), a...) +} + +// Renderln messages by color setting. +// like Println, will add spaces for each argument +// Usage: +// green := color.FgGreen.Renderln +// fmt.Println(green("message")) +func (c Color) Renderln(a ...interface{}) string { + return RenderWithSpaces(c.String(), a...) +} + +// Sprint render messages by color setting. is alias of the Render() +func (c Color) Sprint(a ...interface{}) string { + return RenderCode(c.String(), a...) +} + +// Sprintf format and render message. +// Usage: +// green := color.Green.Sprintf +// colored := green("message") +func (c Color) Sprintf(format string, args ...interface{}) string { + return RenderString(c.String(), fmt.Sprintf(format, args...)) +} + +// Print messages. +// Usage: +// color.Green.Print("message") +// OR: +// green := color.FgGreen.Print +// green("message") +func (c Color) Print(args ...interface{}) { + doPrintV2(c.Code(), fmt.Sprint(args...)) +} + +// Printf format and print messages. +// Usage: +// color.Cyan.Printf("string %s", "arg0") +func (c Color) Printf(format string, a ...interface{}) { + doPrintV2(c.Code(), fmt.Sprintf(format, a...)) +} + +// Println messages with new line +func (c Color) Println(a ...interface{}) { + doPrintlnV2(c.String(), a) +} + +// Light current color. eg: 36(FgCyan) -> 96(FgLightCyan). +// Usage: +// lightCyan := Cyan.Light() +// lightCyan.Print("message") +func (c Color) Light() Color { + val := int(c) + if val >= 30 && val <= 47 { + return Color(uint8(c) + 60) + } + + // don't change + return c +} + +// Darken current color. eg. 96(FgLightCyan) -> 36(FgCyan) +// Usage: +// cyan := LightCyan.Darken() +// cyan.Print("message") +func (c Color) Darken() Color { + val := int(c) + if val >= 90 && val <= 107 { + return Color(uint8(c) - 60) + } + + // don't change + return c +} + +// C256 convert 16 color to 256-color code. +func (c Color) C256() Color256 { + val := uint8(c) + if val < 10 { // is option code + return emptyC256 // empty + } + + var isBg uint8 + if val >= BgBase && val <= 47 { // is bg + isBg = AsBg + val = val - 10 // to fg code + } else if val >= HiBgBase && val <= 107 { // is hi bg + isBg = AsBg + val = val - 10 // to fg code + } + + if c256, ok := basicTo256Map[val]; ok { + return Color256{c256, isBg} + } + + // use raw value direct convert + return Color256{val} +} + +// RGB convert 16 color to 256-color code. +func (c Color) RGB() RGBColor { + val := uint8(c) + if val < 10 { // is option code + return emptyRGBColor + } + + return HEX(Basic2hex(val)) +} + +// Code convert to code string. eg "35" +func (c Color) Code() string { + // return fmt.Sprintf("%d", c) + return strconv.Itoa(int(c)) +} + +// String convert to code string. eg "35" +func (c Color) String() string { + // return fmt.Sprintf("%d", c) + return strconv.Itoa(int(c)) +} + +// IsValid color value +func (c Color) IsValid() bool { + return c < 107 +} + +/************************************************************* + * basic color maps + *************************************************************/ + +// FgColors foreground colors map +var FgColors = map[string]Color{ + "black": FgBlack, + "red": FgRed, + "green": FgGreen, + "yellow": FgYellow, + "blue": FgBlue, + "magenta": FgMagenta, + "cyan": FgCyan, + "white": FgWhite, + "default": FgDefault, +} + +// BgColors background colors map +var BgColors = map[string]Color{ + "black": BgBlack, + "red": BgRed, + "green": BgGreen, + "yellow": BgYellow, + "blue": BgBlue, + "magenta": BgMagenta, + "cyan": BgCyan, + "white": BgWhite, + "default": BgDefault, +} + +// ExFgColors extra foreground colors map +var ExFgColors = map[string]Color{ + "darkGray": FgDarkGray, + "lightRed": FgLightRed, + "lightGreen": FgLightGreen, + "lightYellow": FgLightYellow, + "lightBlue": FgLightBlue, + "lightMagenta": FgLightMagenta, + "lightCyan": FgLightCyan, + "lightWhite": FgLightWhite, +} + +// ExBgColors extra background colors map +var ExBgColors = map[string]Color{ + "darkGray": BgDarkGray, + "lightRed": BgLightRed, + "lightGreen": BgLightGreen, + "lightYellow": BgLightYellow, + "lightBlue": BgLightBlue, + "lightMagenta": BgLightMagenta, + "lightCyan": BgLightCyan, + "lightWhite": BgLightWhite, +} + +// Options color options map +// Deprecated +// NOTICE: please use AllOptions instead. +var Options = AllOptions + +// AllOptions color options map +var AllOptions = map[string]Color{ + "reset": OpReset, + "bold": OpBold, + "fuzzy": OpFuzzy, + "italic": OpItalic, + "underscore": OpUnderscore, + "blink": OpBlink, + "reverse": OpReverse, + "concealed": OpConcealed, +} + +var ( + // TODO basic name alias + // basicNameAlias = map[string]string{} + + // basic color name to code + name2basicMap = initName2basicMap() + // basic2nameMap basic color code to name + basic2nameMap = map[uint8]string{ + 30: "black", + 31: "red", + 32: "green", + 33: "yellow", + 34: "blue", + 35: "magenta", + 36: "cyan", + 37: "white", + // hi color code + 90: "lightBlack", + 91: "lightRed", + 92: "lightGreen", + 93: "lightYellow", + 94: "lightBlue", + 95: "lightMagenta", + 96: "lightCyan", + 97: "lightWhite", + // options + 0: "reset", + 1: "bold", + 2: "fuzzy", + 3: "italic", + 4: "underscore", + 5: "blink", + 7: "reverse", + 8: "concealed", + } +) + +// Basic2nameMap data +func Basic2nameMap() map[uint8]string { + return basic2nameMap +} + +func initName2basicMap() map[string]uint8 { + n2b := make(map[string]uint8, len(basic2nameMap)) + for u, s := range basic2nameMap { + n2b[s] = u + } + return n2b +} diff --git a/vendor/github.com/gookit/color/color_256.go b/vendor/github.com/gookit/color/color_256.go new file mode 100644 index 000000000..efd6dca30 --- /dev/null +++ b/vendor/github.com/gookit/color/color_256.go @@ -0,0 +1,308 @@ +package color + +import ( + "fmt" + "strconv" + "strings" +) + +/* +from wikipedia, 256 color: + ESC[ … 38;5; … m选择前景色 + ESC[ … 48;5; … m选择背景色 + 0- 7:标准颜色(同 ESC[30–37m) + 8- 15:高强度颜色(同 ESC[90–97m) + 16-231:6 × 6 × 6 立方(216色): 16 + 36 × r + 6 × g + b (0 ≤ r, g, b ≤ 5) + 232-255:从黑到白的24阶灰度色 +*/ + +// tpl for 8 bit 256 color(`2^8`) +// +// format: +// ESC[ … 38;5; … m // 选择前景色 +// ESC[ … 48;5; … m // 选择背景色 +// +// example: +// fg "\x1b[38;5;242m" +// bg "\x1b[48;5;208m" +// both "\x1b[38;5;242;48;5;208m" +// +// links: +// https://zh.wikipedia.org/wiki/ANSI%E8%BD%AC%E4%B9%89%E5%BA%8F%E5%88%97#8位 +const ( + TplFg256 = "38;5;%d" + TplBg256 = "48;5;%d" + Fg256Pfx = "38;5;" + Bg256Pfx = "48;5;" +) + +/************************************************************* + * 8bit(256) Color: Bit8Color Color256 + *************************************************************/ + +// Color256 256 color (8 bit), uint8 range at 0 - 255 +// +// 颜色值使用10进制和16进制都可 0x98 = 152 +// +// The color consists of two uint8: +// 0: color value +// 1: color type; Fg=0, Bg=1, >1: unset value +// +// example: +// fg color: [152, 0] +// bg color: [152, 1] +// +// NOTICE: now support 256 color on windows CMD, PowerShell +// lint warn - Name starts with package name +type Color256 [2]uint8 +type Bit8Color = Color256 // alias + +var emptyC256 = Color256{1: 99} + +// Bit8 create a color256 +func Bit8(val uint8, isBg ...bool) Color256 { + return C256(val, isBg...) +} + +// C256 create a color256 +func C256(val uint8, isBg ...bool) Color256 { + bc := Color256{val} + + // mark is bg color + if len(isBg) > 0 && isBg[0] { + bc[1] = AsBg + } + + return bc +} + +// Set terminal by 256 color code +func (c Color256) Set() error { + return SetTerminal(c.String()) +} + +// Reset terminal. alias of the ResetTerminal() +func (c Color256) Reset() error { + return ResetTerminal() +} + +// Print print message +func (c Color256) Print(a ...interface{}) { + doPrintV2(c.String(), fmt.Sprint(a...)) +} + +// Printf format and print message +func (c Color256) Printf(format string, a ...interface{}) { + doPrintV2(c.String(), fmt.Sprintf(format, a...)) +} + +// Println print message with newline +func (c Color256) Println(a ...interface{}) { + doPrintlnV2(c.String(), a) +} + +// Sprint returns rendered message +func (c Color256) Sprint(a ...interface{}) string { + return RenderCode(c.String(), a...) +} + +// Sprintf returns format and rendered message +func (c Color256) Sprintf(format string, a ...interface{}) string { + return RenderString(c.String(), fmt.Sprintf(format, a...)) +} + +// C16 convert color-256 to 16 color. +func (c Color256) C16() Color { + return c.Basic() +} + +// Basic convert color-256 to basic 16 color. +func (c Color256) Basic() Color { + return Color(c[0]) // TODO +} + +// RGB convert color-256 to RGB color. +func (c Color256) RGB() RGBColor { + return RGBFromSlice(C256ToRgb(c[0]), c[1] == AsBg) +} + +// RGBColor convert color-256 to RGB color. +func (c Color256) RGBColor() RGBColor { + return c.RGB() +} + +// Value return color value +func (c Color256) Value() uint8 { + return c[0] +} + +// Code convert to color code string. eg: "12" +func (c Color256) Code() string { + return strconv.Itoa(int(c[0])) +} + +// FullCode convert to color code string with prefix. eg: "38;5;12" +func (c Color256) FullCode() string { + return c.String() +} + +// String convert to color code string with prefix. eg: "38;5;12" +func (c Color256) String() string { + if c[1] == AsFg { // 0 is Fg + // return fmt.Sprintf(TplFg256, c[0]) + return Fg256Pfx + strconv.Itoa(int(c[0])) + } + + if c[1] == AsBg { // 1 is Bg + // return fmt.Sprintf(TplBg256, c[0]) + return Bg256Pfx + strconv.Itoa(int(c[0])) + } + + return "" // empty +} + +// IsFg color +func (c Color256) IsFg() bool { + return c[1] == AsFg +} + +// ToFg 256 color +func (c Color256) ToFg() Color256 { + c[1] = AsFg + return c +} + +// IsBg color +func (c Color256) IsBg() bool { + return c[1] == AsBg +} + +// ToBg 256 color +func (c Color256) ToBg() Color256 { + c[1] = AsBg + return c +} + +// IsEmpty value +func (c Color256) IsEmpty() bool { + return c[1] > 1 +} + +/************************************************************* + * 8bit(256) Style + *************************************************************/ + +// Style256 definition +// +// 前/背景色 +// 都是由两位uint8组成, 第一位是色彩值; +// 第二位与 Bit8Color 不一样的是,在这里表示是否设置了值 0 未设置 !=0 已设置 +type Style256 struct { + // p Printer + + // Name of the style + Name string + // color options of the style + opts Opts + // fg and bg color + fg, bg Color256 +} + +// S256 create a color256 style +// Usage: +// s := color.S256() +// s := color.S256(132) // fg +// s := color.S256(132, 203) // fg and bg +func S256(fgAndBg ...uint8) *Style256 { + s := &Style256{} + vl := len(fgAndBg) + if vl > 0 { // with fg + s.fg = Color256{fgAndBg[0], 1} + + if vl > 1 { // and with bg + s.bg = Color256{fgAndBg[1], 1} + } + } + + return s +} + +// Set fg and bg color value, can also with color options +func (s *Style256) Set(fgVal, bgVal uint8, opts ...Color) *Style256 { + s.fg = Color256{fgVal, 1} + s.bg = Color256{bgVal, 1} + s.opts.Add(opts...) + return s +} + +// SetBg set bg color value +func (s *Style256) SetBg(bgVal uint8) *Style256 { + s.bg = Color256{bgVal, 1} + return s +} + +// SetFg set fg color value +func (s *Style256) SetFg(fgVal uint8) *Style256 { + s.fg = Color256{fgVal, 1} + return s +} + +// SetOpts set options +func (s *Style256) SetOpts(opts Opts) *Style256 { + s.opts = opts + return s +} + +// AddOpts add options +func (s *Style256) AddOpts(opts ...Color) *Style256 { + s.opts.Add(opts...) + return s +} + +// Print message +func (s *Style256) Print(a ...interface{}) { + doPrintV2(s.String(), fmt.Sprint(a...)) +} + +// Printf format and print message +func (s *Style256) Printf(format string, a ...interface{}) { + doPrintV2(s.String(), fmt.Sprintf(format, a...)) +} + +// Println print message with newline +func (s *Style256) Println(a ...interface{}) { + doPrintlnV2(s.String(), a) +} + +// Sprint returns rendered message +func (s *Style256) Sprint(a ...interface{}) string { + return RenderCode(s.Code(), a...) +} + +// Sprintf returns format and rendered message +func (s *Style256) Sprintf(format string, a ...interface{}) string { + return RenderString(s.Code(), fmt.Sprintf(format, a...)) +} + +// Code convert to color code string +func (s *Style256) Code() string { + return s.String() +} + +// String convert to color code string +func (s *Style256) String() string { + var ss []string + if s.fg[1] > 0 { + ss = append(ss, fmt.Sprintf(TplFg256, s.fg[0])) + } + + if s.bg[1] > 0 { + ss = append(ss, fmt.Sprintf(TplBg256, s.bg[0])) + } + + if s.opts.IsValid() { + ss = append(ss, s.opts.String()) + } + + return strings.Join(ss, ";") +} diff --git a/vendor/github.com/gookit/color/color_rgb.go b/vendor/github.com/gookit/color/color_rgb.go new file mode 100644 index 000000000..a7ede1853 --- /dev/null +++ b/vendor/github.com/gookit/color/color_rgb.go @@ -0,0 +1,391 @@ +package color + +import ( + "fmt" + "strconv" + "strings" +) + +// 24 bit RGB color +// RGB: +// R 0-255 G 0-255 B 0-255 +// R 00-FF G 00-FF B 00-FF (16进制) +// +// Format: +// ESC[ … 38;2;;; … m // Select RGB foreground color +// ESC[ … 48;2;;; … m // Choose RGB background color +// +// links: +// https://zh.wikipedia.org/wiki/ANSI%E8%BD%AC%E4%B9%89%E5%BA%8F%E5%88%97#24位 +// +// example: +// fg: \x1b[38;2;30;144;255mMESSAGE\x1b[0m +// bg: \x1b[48;2;30;144;255mMESSAGE\x1b[0m +// both: \x1b[38;2;233;90;203;48;2;30;144;255mMESSAGE\x1b[0m +const ( + TplFgRGB = "38;2;%d;%d;%d" + TplBgRGB = "48;2;%d;%d;%d" + FgRGBPfx = "38;2;" + BgRGBPfx = "48;2;" +) + +// mark color is fg or bg. +const ( + AsFg uint8 = iota + AsBg +) + +// values from https://github.com/go-terminfo/terminfo +// var ( +// RgbaBlack = image_color.RGBA{0, 0, 0, 255} +// Red = color.RGBA{205, 0, 0, 255} +// Green = color.RGBA{0, 205, 0, 255} +// Orange = color.RGBA{205, 205, 0, 255} +// Blue = color.RGBA{0, 0, 238, 255} +// Magenta = color.RGBA{205, 0, 205, 255} +// Cyan = color.RGBA{0, 205, 205, 255} +// LightGrey = color.RGBA{229, 229, 229, 255} +// +// DarkGrey = color.RGBA{127, 127, 127, 255} +// LightRed = color.RGBA{255, 0, 0, 255} +// LightGreen = color.RGBA{0, 255, 0, 255} +// Yellow = color.RGBA{255, 255, 0, 255} +// LightBlue = color.RGBA{92, 92, 255, 255} +// LightMagenta = color.RGBA{255, 0, 255, 255} +// LightCyan = color.RGBA{0, 255, 255, 255} +// White = color.RGBA{255, 255, 255, 255} +// ) + +/************************************************************* + * RGB Color(Bit24Color, TrueColor) + *************************************************************/ + +// RGBColor definition. +// +// The first to third digits represent the color value. +// The last digit represents the foreground(0), background(1), >1 is unset value +// +// Usage: +// // 0, 1, 2 is R,G,B. +// // 3rd: Fg=0, Bg=1, >1: unset value +// RGBColor{30,144,255, 0} +// RGBColor{30,144,255, 1} +// +// NOTICE: now support RGB color on windows CMD, PowerShell +type RGBColor [4]uint8 + +// create a empty RGBColor +var emptyRGBColor = RGBColor{3: 99} + +// RGB color create. +// Usage: +// c := RGB(30,144,255) +// c := RGB(30,144,255, true) +// c.Print("message") +func RGB(r, g, b uint8, isBg ...bool) RGBColor { + rgb := RGBColor{r, g, b} + if len(isBg) > 0 && isBg[0] { + rgb[3] = AsBg + } + + return rgb +} + +// Rgb alias of the RGB() +func Rgb(r, g, b uint8, isBg ...bool) RGBColor { return RGB(r, g, b, isBg...) } + +// Bit24 alias of the RGB() +func Bit24(r, g, b uint8, isBg ...bool) RGBColor { return RGB(r, g, b, isBg...) } + +// RGBFromSlice quick RGBColor from slice +func RGBFromSlice(rgb []uint8, isBg ...bool) RGBColor { + return RGB(rgb[0], rgb[1], rgb[2], isBg...) +} + +// HEX create RGB color from a HEX color string. +// Usage: +// c := HEX("ccc") // rgb: [204 204 204] +// c := HEX("aabbcc") // rgb: [170 187 204] +// c := HEX("#aabbcc") +// c := HEX("0xaabbcc") +// c.Print("message") +func HEX(hex string, isBg ...bool) RGBColor { + if rgb := HexToRgb(hex); len(rgb) > 0 { + return RGB(uint8(rgb[0]), uint8(rgb[1]), uint8(rgb[2]), isBg...) + } + + // mark is empty + return emptyRGBColor +} + +// Hex alias of the HEX() +func Hex(hex string, isBg ...bool) RGBColor { return HEX(hex, isBg...) } + +// RGBFromString create RGB color from a string. +// Usage: +// c := RGBFromString("170,187,204") +// c.Print("message") +func RGBFromString(rgb string, isBg ...bool) RGBColor { + ss := stringToArr(rgb, ",") + if len(ss) != 3 { + return emptyRGBColor + } + + var ar [3]int + for i, val := range ss { + iv, err := strconv.Atoi(val) + if err != nil { + return emptyRGBColor + } + + ar[i] = iv + } + + return RGB(uint8(ar[0]), uint8(ar[1]), uint8(ar[2]), isBg...) +} + +// Set terminal by rgb/true color code +func (c RGBColor) Set() error { + return SetTerminal(c.String()) +} + +// Reset terminal. alias of the ResetTerminal() +func (c RGBColor) Reset() error { + return ResetTerminal() +} + +// Print print message +func (c RGBColor) Print(a ...interface{}) { + doPrintV2(c.String(), fmt.Sprint(a...)) +} + +// Printf format and print message +func (c RGBColor) Printf(format string, a ...interface{}) { + doPrintV2(c.String(), fmt.Sprintf(format, a...)) +} + +// Println print message with newline +func (c RGBColor) Println(a ...interface{}) { + doPrintlnV2(c.String(), a) +} + +// Sprint returns rendered message +func (c RGBColor) Sprint(a ...interface{}) string { + return RenderCode(c.String(), a...) +} + +// Sprintf returns format and rendered message +func (c RGBColor) Sprintf(format string, a ...interface{}) string { + return RenderString(c.String(), fmt.Sprintf(format, a...)) +} + +// Values to RGB values +func (c RGBColor) Values() []int { + return []int{int(c[0]), int(c[1]), int(c[2])} +} + +// Code to color code string without prefix. eg: "204;123;56" +func (c RGBColor) Code() string { + return fmt.Sprintf("%d;%d;%d", c[0], c[1], c[2]) +} + +// Hex color rgb to hex string. as in "ff0080". +func (c RGBColor) Hex() string { + return fmt.Sprintf("%02x%02x%02x", c[0], c[1], c[2]) +} + +// FullCode to color code string with prefix +func (c RGBColor) FullCode() string { + return c.String() +} + +// String to color code string with prefix. eg: "38;2;204;123;56" +func (c RGBColor) String() string { + if c[3] == AsFg { + return fmt.Sprintf(TplFgRGB, c[0], c[1], c[2]) + } + + if c[3] == AsBg { + return fmt.Sprintf(TplBgRGB, c[0], c[1], c[2]) + } + + // c[3] > 1 is empty + return "" +} + +// IsEmpty value +func (c RGBColor) IsEmpty() bool { + return c[3] > AsBg +} + +// IsValid value +// func (c RGBColor) IsValid() bool { +// return c[3] <= AsBg +// } + +// C256 returns the closest approximate 256 (8 bit) color +func (c RGBColor) C256() Color256 { + return C256(RgbTo256(c[0], c[1], c[2]), c[3] == AsBg) +} + +// Basic returns the closest approximate 16 (4 bit) color +func (c RGBColor) Basic() Color { + // return Color(RgbToAnsi(c[0], c[1], c[2], c[3] == AsBg)) + return Color(Rgb2basic(c[0], c[1], c[2], c[3] == AsBg)) +} + +// Color returns the closest approximate 16 (4 bit) color +func (c RGBColor) Color() Color { return c.Basic() } + +// C16 returns the closest approximate 16 (4 bit) color +func (c RGBColor) C16() Color { return c.Basic() } + +/************************************************************* + * RGB Style + *************************************************************/ + +// RGBStyle definition. +// +// Foreground/Background color +// All are composed of 4 digits uint8, the first three digits are the color value; +// The last bit is different from RGBColor, here it indicates whether the value is set. +// - 1 Has been set +// - ^1 Not set +type RGBStyle struct { + // Name of the style + Name string + // color options of the style + opts Opts + // fg and bg color + fg, bg RGBColor +} + +// NewRGBStyle create a RGBStyle. +func NewRGBStyle(fg RGBColor, bg ...RGBColor) *RGBStyle { + s := &RGBStyle{} + if len(bg) > 0 { + s.SetBg(bg[0]) + } + + return s.SetFg(fg) +} + +// HEXStyle create a RGBStyle from HEX color string. +// Usage: +// s := HEXStyle("aabbcc", "eee") +// s.Print("message") +func HEXStyle(fg string, bg ...string) *RGBStyle { + s := &RGBStyle{} + if len(bg) > 0 { + s.SetBg(HEX(bg[0])) + } + + if len(fg) > 0 { + s.SetFg(HEX(fg)) + } + + return s +} + +// RGBStyleFromString create a RGBStyle from color value string. +// Usage: +// s := RGBStyleFromString("170,187,204", "70,87,4") +// s.Print("message") +func RGBStyleFromString(fg string, bg ...string) *RGBStyle { + s := &RGBStyle{} + if len(bg) > 0 { + s.SetBg(RGBFromString(bg[0])) + } + + return s.SetFg(RGBFromString(fg)) +} + +// Set fg and bg color, can also with color options +func (s *RGBStyle) Set(fg, bg RGBColor, opts ...Color) *RGBStyle { + return s.SetFg(fg).SetBg(bg).SetOpts(opts) +} + +// SetFg set fg color +func (s *RGBStyle) SetFg(fg RGBColor) *RGBStyle { + fg[3] = 1 // add fixed value, mark is valid + s.fg = fg + return s +} + +// SetBg set bg color +func (s *RGBStyle) SetBg(bg RGBColor) *RGBStyle { + bg[3] = 1 // add fixed value, mark is valid + s.bg = bg + return s +} + +// SetOpts set color options +func (s *RGBStyle) SetOpts(opts Opts) *RGBStyle { + s.opts = opts + return s +} + +// AddOpts add options +func (s *RGBStyle) AddOpts(opts ...Color) *RGBStyle { + s.opts.Add(opts...) + return s +} + +// Print print message +func (s *RGBStyle) Print(a ...interface{}) { + doPrintV2(s.String(), fmt.Sprint(a...)) +} + +// Printf format and print message +func (s *RGBStyle) Printf(format string, a ...interface{}) { + doPrintV2(s.String(), fmt.Sprintf(format, a...)) +} + +// Println print message with newline +func (s *RGBStyle) Println(a ...interface{}) { + doPrintlnV2(s.String(), a) +} + +// Sprint returns rendered message +func (s *RGBStyle) Sprint(a ...interface{}) string { + return RenderCode(s.String(), a...) +} + +// Sprintf returns format and rendered message +func (s *RGBStyle) Sprintf(format string, a ...interface{}) string { + return RenderString(s.String(), fmt.Sprintf(format, a...)) +} + +// Code convert to color code string +func (s *RGBStyle) Code() string { + return s.String() +} + +// FullCode convert to color code string +func (s *RGBStyle) FullCode() string { + return s.String() +} + +// String convert to color code string +func (s *RGBStyle) String() string { + var ss []string + // last value ensure is enable. + if s.fg[3] == 1 { + ss = append(ss, fmt.Sprintf(TplFgRGB, s.fg[0], s.fg[1], s.fg[2])) + } + + if s.bg[3] == 1 { + ss = append(ss, fmt.Sprintf(TplBgRGB, s.bg[0], s.bg[1], s.bg[2])) + } + + if s.opts.IsValid() { + ss = append(ss, s.opts.String()) + } + + return strings.Join(ss, ";") +} + +// IsEmpty style +func (s *RGBStyle) IsEmpty() bool { + return s.fg[3] != 1 && s.bg[3] != 1 +} diff --git a/vendor/github.com/gookit/color/color_tag.go b/vendor/github.com/gookit/color/color_tag.go new file mode 100644 index 000000000..051ba84fe --- /dev/null +++ b/vendor/github.com/gookit/color/color_tag.go @@ -0,0 +1,427 @@ +package color + +import ( + "fmt" + "regexp" + "strings" +) + +// output colored text like use html tag. (not support windows cmd) +const ( + // MatchExpr regex to match color tags + // + // Notice: golang 不支持反向引用. 即不支持使用 \1 引用第一个匹配 ([a-z=;]+) + // MatchExpr = `<([a-z=;]+)>(.*?)<\/\1>` + // 所以调整一下 统一使用 `` 来结束标签,例如 "some text" + // + // allow custom attrs, eg: "content" + // (?s:...) s - 让 "." 匹配换行 + MatchExpr = `<([0-9a-zA-Z_=,;]+)>(?s:(.*?))<\/>` + + // AttrExpr regex to match custom color attributes + // eg: "content" + AttrExpr = `(fg|bg|op)[\s]*=[\s]*([0-9a-zA-Z,]+);?` + + // StripExpr regex used for removing color tags + // StripExpr = `<[\/]?[a-zA-Z=;]+>` + // 随着上面的做一些调整 + StripExpr = `<[\/]?[0-9a-zA-Z_=,;]*>` +) + +var ( + attrRegex = regexp.MustCompile(AttrExpr) + matchRegex = regexp.MustCompile(MatchExpr) + stripRegex = regexp.MustCompile(StripExpr) +) + +/************************************************************* + * internal defined color tags + *************************************************************/ + +// There are internal defined color tags +// Usage: content text +// @notice 加 0 在前面是为了防止之前的影响到现在的设置 +var colorTags = map[string]string{ + // basic tags + "red": "0;31", + "red1": "1;31", // with bold + "redB": "1;31", + "red_b": "1;31", + "blue": "0;34", + "blue1": "1;34", // with bold + "blueB": "1;34", + "blue_b": "1;34", + "cyan": "0;36", + "cyan1": "1;36", // with bold + "cyanB": "1;36", + "cyan_b": "1;36", + "green": "0;32", + "green1": "1;32", // with bold + "greenB": "1;32", + "green_b": "1;32", + "black": "0;30", + "white": "1;37", + "default": "0;39", // no color + "normal": "0;39", // no color + "brown": "0;33", // #A52A2A + "yellow": "0;33", + "ylw0": "0;33", + "yellowB": "1;33", // with bold + "ylw1": "1;33", + "ylwB": "1;33", + "magenta": "0;35", + "mga": "0;35", // short name + "magentaB": "1;35", // with bold + "mgb": "1;35", + "mgaB": "1;35", + + // light/hi tags + + "gray": "0;90", + "darkGray": "0;90", + "dark_gray": "0;90", + "lightYellow": "0;93", + "light_yellow": "0;93", + "hiYellow": "0;93", + "hi_yellow": "0;93", + "hiYellowB": "1;93", // with bold + "hi_yellow_b": "1;93", + "lightMagenta": "0;95", + "light_magenta": "0;95", + "hiMagenta": "0;95", + "hi_magenta": "0;95", + "lightMagentaB": "1;95", // with bold + "hiMagentaB": "1;95", // with bold + "hi_magenta_b": "1;95", + "lightRed": "0;91", + "light_red": "0;91", + "hiRed": "0;91", + "hi_red": "0;91", + "lightRedB": "1;91", // with bold + "light_red_b": "1;91", + "hi_red_b": "1;91", + "lightGreen": "0;92", + "light_green": "0;92", + "hiGreen": "0;92", + "hi_green": "0;92", + "lightGreenB": "1;92", + "light_green_b": "1;92", + "hi_green_b": "1;92", + "lightBlue": "0;94", + "light_blue": "0;94", + "hiBlue": "0;94", + "hi_blue": "0;94", + "lightBlueB": "1;94", + "light_blue_b": "1;94", + "hi_blue_b": "1;94", + "lightCyan": "0;96", + "light_cyan": "0;96", + "hiCyan": "0;96", + "hi_cyan": "0;96", + "lightCyanB": "1;96", + "light_cyan_b": "1;96", + "hi_cyan_b": "1;96", + "lightWhite": "0;97;40", + "light_white": "0;97;40", + + // option + "bold": "1", + "b": "1", + "underscore": "4", + "us": "4", // short name for 'underscore' + "reverse": "7", + + // alert tags, like bootstrap's alert + "suc": "1;32", // same "green" and "bold" + "success": "1;32", + "info": "0;32", // same "green", + "comment": "0;33", // same "brown" + "note": "36;1", + "notice": "36;4", + "warn": "0;1;33", + "warning": "0;30;43", + "primary": "0;34", + "danger": "1;31", // same "red" but add bold + "err": "97;41", + "error": "97;41", // fg light white; bg red +} + +/************************************************************* + * parse color tags + *************************************************************/ + +var ( + tagParser = TagParser{} + rxNumStr = regexp.MustCompile("^[0-9]{1,3}$") + rxHexCode = regexp.MustCompile("^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$") +) + +// TagParser struct +type TagParser struct { + disable bool +} + +// NewTagParser create +func NewTagParser() *TagParser { + return &TagParser{} +} + +// func (tp *TagParser) Disable() *TagParser { +// tp.disable = true +// return tp +// } + +// ParseByEnv parse given string. will check package setting. +func (tp *TagParser) ParseByEnv(str string) string { + // disable handler TAG + if !RenderTag { + return str + } + + // disable OR not support color + if !Enable || !SupportColor() { + return ClearTag(str) + } + + return tp.Parse(str) +} + +// Parse parse given string, replace color tag and return rendered string +func (tp *TagParser) Parse(str string) string { + // not contains color tag + if !strings.Contains(str, "") { + return str + } + + // find color tags by regex. str eg: "content" + matched := matchRegex.FindAllStringSubmatch(str, -1) + + // item: 0 full text 1 tag name 2 tag content + for _, item := range matched { + full, tag, content := item[0], item[1], item[2] + + // use defined tag name: "content" -> tag: "info" + if !strings.ContainsRune(tag, '=') { + code := colorTags[tag] + if len(code) > 0 { + now := RenderString(code, content) + // old := WrapTag(content, tag) is equals to var 'full' + str = strings.Replace(str, full, now, 1) + } + continue + } + + // custom color in tag + // - basic: "fg=white;bg=blue;op=bold" + if code := ParseCodeFromAttr(tag); len(code) > 0 { + now := RenderString(code, content) + str = strings.Replace(str, full, now, 1) + } + } + + return str +} + +// func (tp *TagParser) ParseAttr(attr string) (code string) { +// return +// } + +// ReplaceTag parse string, replace color tag and return rendered string +func ReplaceTag(str string) string { + return tagParser.ParseByEnv(str) +} + +// ParseCodeFromAttr parse color attributes. +// +// attr format: +// // VALUE please see var: FgColors, BgColors, AllOptions +// "fg=VALUE;bg=VALUE;op=VALUE" +// 16 color: +// "fg=yellow" +// "bg=red" +// "op=bold,underscore" option is allow multi value +// "fg=white;bg=blue;op=bold" +// "fg=white;op=bold,underscore" +// 256 color: +// "fg=167" +// "fg=167;bg=23" +// "fg=167;bg=23;op=bold" +// true color: +// // hex +// "fg=fc1cac" +// "fg=fc1cac;bg=c2c3c4" +// // r,g,b +// "fg=23,45,214" +// "fg=23,45,214;bg=109,99,88" +func ParseCodeFromAttr(attr string) (code string) { + if !strings.ContainsRune(attr, '=') { + return + } + + attr = strings.Trim(attr, ";=,") + if len(attr) == 0 { + return + } + + var codes []string + matched := attrRegex.FindAllStringSubmatch(attr, -1) + + for _, item := range matched { + pos, val := item[1], item[2] + switch pos { + case "fg": + if c, ok := FgColors[val]; ok { // basic + codes = append(codes, c.String()) + } else if c, ok := ExFgColors[val]; ok { // extra + codes = append(codes, c.String()) + } else if code := rgbHex256toCode(val, false); code != "" { + codes = append(codes, code) + } + case "bg": + if c, ok := BgColors[val]; ok { // basic bg + codes = append(codes, c.String()) + } else if c, ok := ExBgColors[val]; ok { // extra bg + codes = append(codes, c.String()) + } else if code := rgbHex256toCode(val, true); code != "" { + codes = append(codes, code) + } + case "op": // options allow multi value + if strings.Contains(val, ",") { + ns := strings.Split(val, ",") + for _, n := range ns { + if c, ok := AllOptions[n]; ok { + codes = append(codes, c.String()) + } + } + } else if c, ok := AllOptions[val]; ok { + codes = append(codes, c.String()) + } + } + } + + return strings.Join(codes, ";") +} + +func rgbHex256toCode(val string, isBg bool) (code string) { + if len(val) == 6 && rxHexCode.MatchString(val) { // hex: "fc1cac" + code = HEX(val, isBg).String() + } else if strings.ContainsRune(val, ',') { // rgb: "231,178,161" + code = strings.Replace(val, ",", ";", -1) + if isBg { + code = BgRGBPfx + code + } else { + code = FgRGBPfx + code + } + } else if len(val) < 4 && rxNumStr.MatchString(val) { // 256 code + if isBg { + code = Bg256Pfx + val + } else { + code = Fg256Pfx + val + } + } + return +} + +// ClearTag clear all tag for a string +func ClearTag(s string) string { + if !strings.Contains(s, "") { + return s + } + + return stripRegex.ReplaceAllString(s, "") +} + +/************************************************************* + * helper methods + *************************************************************/ + +// GetTagCode get color code by tag name +func GetTagCode(name string) string { + return colorTags[name] +} + +// ApplyTag for messages +func ApplyTag(tag string, a ...interface{}) string { + return RenderCode(GetTagCode(tag), a...) +} + +// WrapTag wrap a tag for a string "content" +func WrapTag(s string, tag string) string { + if s == "" || tag == "" { + return s + } + + return fmt.Sprintf("<%s>%s", tag, s) +} + +// GetColorTags get all internal color tags +func GetColorTags() map[string]string { + return colorTags +} + +// IsDefinedTag is defined tag name +func IsDefinedTag(name string) bool { + _, ok := colorTags[name] + return ok +} + +/************************************************************* + * Tag extra + *************************************************************/ + +// Tag value is a defined style name +// Usage: +// Tag("info").Println("message") +type Tag string + +// Print messages +func (tg Tag) Print(a ...interface{}) { + name := string(tg) + str := fmt.Sprint(a...) + + if stl := GetStyle(name); !stl.IsEmpty() { + stl.Print(str) + } else { + doPrintV2(GetTagCode(name), str) + } +} + +// Printf format and print messages +func (tg Tag) Printf(format string, a ...interface{}) { + name := string(tg) + str := fmt.Sprintf(format, a...) + + if stl := GetStyle(name); !stl.IsEmpty() { + stl.Print(str) + } else { + doPrintV2(GetTagCode(name), str) + } +} + +// Println messages line +func (tg Tag) Println(a ...interface{}) { + name := string(tg) + if stl := GetStyle(name); !stl.IsEmpty() { + stl.Println(a...) + } else { + doPrintlnV2(GetTagCode(name), a) + } +} + +// Sprint render messages +func (tg Tag) Sprint(a ...interface{}) string { + name := string(tg) + // if stl := GetStyle(name); !stl.IsEmpty() { + // return stl.Render(args...) + // } + + return RenderCode(GetTagCode(name), a...) +} + +// Sprintf format and render messages +func (tg Tag) Sprintf(format string, a ...interface{}) string { + tag := string(tg) + str := fmt.Sprintf(format, a...) + + return RenderString(GetTagCode(tag), str) +} diff --git a/vendor/github.com/gookit/color/convert.go b/vendor/github.com/gookit/color/convert.go new file mode 100644 index 000000000..d641fb767 --- /dev/null +++ b/vendor/github.com/gookit/color/convert.go @@ -0,0 +1,593 @@ +package color + +import ( + "fmt" + "math" + "strconv" + "strings" +) + +var ( + // ---------- basic(16) <=> 256 color convert ---------- + basicTo256Map = map[uint8]uint8{ + 30: 0, // black 000000 + 31: 160, // red c51e14 + 32: 34, // green 1dc121 + 33: 184, // yellow c7c329 + 34: 20, // blue 0a2fc4 + 35: 170, // magenta c839c5 + 36: 44, // cyan 20c5c6 + 37: 188, // white c7c7c7 + 90: 59, // lightBlack 686868 + 91: 203, // lightRed fd6f6b + 92: 83, // lightGreen 67f86f + 93: 227, // lightYellow fffa72 + 94: 69, // lightBlue 6a76fb + 95: 213, // lightMagenta fd7cfc + 96: 87, // lightCyan 68fdfe + 97: 15, // lightWhite ffffff + } + + // ---------- basic(16) <=> RGB color convert ---------- + // refer from Hyper app + basic2hexMap = map[uint8]string{ + 30: "000000", // black + 31: "c51e14", // red + 32: "1dc121", // green + 33: "c7c329", // yellow + 34: "0a2fc4", // blue + 35: "c839c5", // magenta + 36: "20c5c6", // cyan + 37: "c7c7c7", // white + 90: "686868", // lightBlack/darkGray + 91: "fd6f6b", // lightRed + 92: "67f86f", // lightGreen + 93: "fffa72", // lightYellow + 94: "6a76fb", // lightBlue + 95: "fd7cfc", // lightMagenta + 96: "68fdfe", // lightCyan + 97: "ffffff", // lightWhite + } + // will convert data from basic2hexMap + hex2basicMap = initHex2basicMap() + + // ---------- 256 <=> RGB color convert ---------- + // adapted from https://gist.github.com/MicahElliott/719710 + + c256ToHexMap = init256ToHexMap() + + // rgb to 256 color look-up table + // RGB hex => 256 code + hexTo256Table = map[string]uint8{ + // Primary 3-bit (8 colors). Unique representation! + "000000": 0, + "800000": 1, + "008000": 2, + "808000": 3, + "000080": 4, + "800080": 5, + "008080": 6, + "c0c0c0": 7, + + // Equivalent "bright" versions of original 8 colors. + "808080": 8, + "ff0000": 9, + "00ff00": 10, + "ffff00": 11, + "0000ff": 12, + "ff00ff": 13, + "00ffff": 14, + "ffffff": 15, + + // values commented out below are duplicates from the prior sections + + // Strictly ascending. + // "000000": 16, + "000001": 16, // up: avoid key conflicts, value + 1 + "00005f": 17, + "000087": 18, + "0000af": 19, + "0000d7": 20, + // "0000ff": 21, + "0000fe": 21, // up: avoid key conflicts, value - 1 + "005f00": 22, + "005f5f": 23, + "005f87": 24, + "005faf": 25, + "005fd7": 26, + "005fff": 27, + "008700": 28, + "00875f": 29, + "008787": 30, + "0087af": 31, + "0087d7": 32, + "0087ff": 33, + "00af00": 34, + "00af5f": 35, + "00af87": 36, + "00afaf": 37, + "00afd7": 38, + "00afff": 39, + "00d700": 40, + "00d75f": 41, + "00d787": 42, + "00d7af": 43, + "00d7d7": 44, + "00d7ff": 45, + // "00ff00": 46, + "00ff01": 46, // up: avoid key conflicts, value + 1 + "00ff5f": 47, + "00ff87": 48, + "00ffaf": 49, + "00ffd7": 50, + // "00ffff": 51, + "00fffe": 51, // up: avoid key conflicts, value - 1 + "5f0000": 52, + "5f005f": 53, + "5f0087": 54, + "5f00af": 55, + "5f00d7": 56, + "5f00ff": 57, + "5f5f00": 58, + "5f5f5f": 59, + "5f5f87": 60, + "5f5faf": 61, + "5f5fd7": 62, + "5f5fff": 63, + "5f8700": 64, + "5f875f": 65, + "5f8787": 66, + "5f87af": 67, + "5f87d7": 68, + "5f87ff": 69, + "5faf00": 70, + "5faf5f": 71, + "5faf87": 72, + "5fafaf": 73, + "5fafd7": 74, + "5fafff": 75, + "5fd700": 76, + "5fd75f": 77, + "5fd787": 78, + "5fd7af": 79, + "5fd7d7": 80, + "5fd7ff": 81, + "5fff00": 82, + "5fff5f": 83, + "5fff87": 84, + "5fffaf": 85, + "5fffd7": 86, + "5fffff": 87, + "870000": 88, + "87005f": 89, + "870087": 90, + "8700af": 91, + "8700d7": 92, + "8700ff": 93, + "875f00": 94, + "875f5f": 95, + "875f87": 96, + "875faf": 97, + "875fd7": 98, + "875fff": 99, + "878700": 100, + "87875f": 101, + "878787": 102, + "8787af": 103, + "8787d7": 104, + "8787ff": 105, + "87af00": 106, + "87af5f": 107, + "87af87": 108, + "87afaf": 109, + "87afd7": 110, + "87afff": 111, + "87d700": 112, + "87d75f": 113, + "87d787": 114, + "87d7af": 115, + "87d7d7": 116, + "87d7ff": 117, + "87ff00": 118, + "87ff5f": 119, + "87ff87": 120, + "87ffaf": 121, + "87ffd7": 122, + "87ffff": 123, + "af0000": 124, + "af005f": 125, + "af0087": 126, + "af00af": 127, + "af00d7": 128, + "af00ff": 129, + "af5f00": 130, + "af5f5f": 131, + "af5f87": 132, + "af5faf": 133, + "af5fd7": 134, + "af5fff": 135, + "af8700": 136, + "af875f": 137, + "af8787": 138, + "af87af": 139, + "af87d7": 140, + "af87ff": 141, + "afaf00": 142, + "afaf5f": 143, + "afaf87": 144, + "afafaf": 145, + "afafd7": 146, + "afafff": 147, + "afd700": 148, + "afd75f": 149, + "afd787": 150, + "afd7af": 151, + "afd7d7": 152, + "afd7ff": 153, + "afff00": 154, + "afff5f": 155, + "afff87": 156, + "afffaf": 157, + "afffd7": 158, + "afffff": 159, + "d70000": 160, + "d7005f": 161, + "d70087": 162, + "d700af": 163, + "d700d7": 164, + "d700ff": 165, + "d75f00": 166, + "d75f5f": 167, + "d75f87": 168, + "d75faf": 169, + "d75fd7": 170, + "d75fff": 171, + "d78700": 172, + "d7875f": 173, + "d78787": 174, + "d787af": 175, + "d787d7": 176, + "d787ff": 177, + "d7af00": 178, + "d7af5f": 179, + "d7af87": 180, + "d7afaf": 181, + "d7afd7": 182, + "d7afff": 183, + "d7d700": 184, + "d7d75f": 185, + "d7d787": 186, + "d7d7af": 187, + "d7d7d7": 188, + "d7d7ff": 189, + "d7ff00": 190, + "d7ff5f": 191, + "d7ff87": 192, + "d7ffaf": 193, + "d7ffd7": 194, + "d7ffff": 195, + // "ff0000": 196, + "ff0001": 196, // up: avoid key conflicts, value + 1 + "ff005f": 197, + "ff0087": 198, + "ff00af": 199, + "ff00d7": 200, + // "ff00ff": 201, + "ff00fe": 201, // up: avoid key conflicts, value - 1 + "ff5f00": 202, + "ff5f5f": 203, + "ff5f87": 204, + "ff5faf": 205, + "ff5fd7": 206, + "ff5fff": 207, + "ff8700": 208, + "ff875f": 209, + "ff8787": 210, + "ff87af": 211, + "ff87d7": 212, + "ff87ff": 213, + "ffaf00": 214, + "ffaf5f": 215, + "ffaf87": 216, + "ffafaf": 217, + "ffafd7": 218, + "ffafff": 219, + "ffd700": 220, + "ffd75f": 221, + "ffd787": 222, + "ffd7af": 223, + "ffd7d7": 224, + "ffd7ff": 225, + // "ffff00": 226, + "ffff01": 226, // up: avoid key conflicts, value + 1 + "ffff5f": 227, + "ffff87": 228, + "ffffaf": 229, + "ffffd7": 230, + // "ffffff": 231, + "fffffe": 231, // up: avoid key conflicts, value - 1 + + // Gray-scale range. + "080808": 232, + "121212": 233, + "1c1c1c": 234, + "262626": 235, + "303030": 236, + "3a3a3a": 237, + "444444": 238, + "4e4e4e": 239, + "585858": 240, + "626262": 241, + "6c6c6c": 242, + "767676": 243, + // "808080": 244, + "808081": 244, // up: avoid key conflicts, value + 1 + "8a8a8a": 245, + "949494": 246, + "9e9e9e": 247, + "a8a8a8": 248, + "b2b2b2": 249, + "bcbcbc": 250, + "c6c6c6": 251, + "d0d0d0": 252, + "dadada": 253, + "e4e4e4": 254, + "eeeeee": 255, + } + + incs = []uint8{0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff} +) + +func initHex2basicMap() map[string]uint8 { + h2b := make(map[string]uint8, len(basic2hexMap)) + // ini data map + for u, s := range basic2hexMap { + h2b[s] = u + } + return h2b +} + +func init256ToHexMap() map[uint8]string { + c256toh := make(map[uint8]string, len(hexTo256Table)) + // ini data map + for hex, c256 := range hexTo256Table { + c256toh[c256] = hex + } + return c256toh +} + +// RgbTo256Table mapping data +func RgbTo256Table() map[string]uint8 { + return hexTo256Table +} + +// Colors2code convert colors to code. return like "32;45;3" +func Colors2code(colors ...Color) string { + if len(colors) == 0 { + return "" + } + + var codes []string + for _, color := range colors { + codes = append(codes, color.String()) + } + + return strings.Join(codes, ";") +} + +/************************************************************* + * HEX code <=> RGB/True color code + *************************************************************/ + +// Hex2rgb alias of the HexToRgb() +func Hex2rgb(hex string) []int { return HexToRgb(hex) } + +// HexToRGB alias of the HexToRgb() +func HexToRGB(hex string) []int { return HexToRgb(hex) } + +// HexToRgb convert hex color string to RGB numbers +// +// Usage: +// rgb := HexToRgb("ccc") // rgb: [204 204 204] +// rgb := HexToRgb("aabbcc") // rgb: [170 187 204] +// rgb := HexToRgb("#aabbcc") // rgb: [170 187 204] +// rgb := HexToRgb("0xad99c0") // rgb: [170 187 204] +func HexToRgb(hex string) (rgb []int) { + hex = strings.TrimSpace(hex) + if hex == "" { + return + } + + // like from css. eg "#ccc" "#ad99c0" + if hex[0] == '#' { + hex = hex[1:] + } + + hex = strings.ToLower(hex) + switch len(hex) { + case 3: // "ccc" + hex = string([]byte{hex[0], hex[0], hex[1], hex[1], hex[2], hex[2]}) + case 8: // "0xad99c0" + hex = strings.TrimPrefix(hex, "0x") + } + + // recheck + if len(hex) != 6 { + return + } + + // convert string to int64 + if i64, err := strconv.ParseInt(hex, 16, 32); err == nil { + color := int(i64) + // parse int + rgb = make([]int, 3) + rgb[0] = color >> 16 + rgb[1] = (color & 0x00FF00) >> 8 + rgb[2] = color & 0x0000FF + } + return +} + +// Rgb2hex alias of the RgbToHex() +func Rgb2hex(rgb []int) string { return RgbToHex(rgb) } + +// RgbToHex convert RGB-code to hex-code +// +// Usage: +// hex := RgbToHex([]int{170, 187, 204}) // hex: "aabbcc" +func RgbToHex(rgb []int) string { + hexNodes := make([]string, len(rgb)) + + for _, v := range rgb { + hexNodes = append(hexNodes, strconv.FormatInt(int64(v), 16)) + } + return strings.Join(hexNodes, "") +} + +/************************************************************* + * 4bit(16) color <=> RGB/True color + *************************************************************/ + +// Basic2hex convert basic color to hex string. +func Basic2hex(val uint8) string { + return basic2hexMap[val] +} + +// Hex2basic convert hex string to basic color code. +func Hex2basic(hex string) uint8 { + return hex2basicMap[hex] +} + +// Rgb2basic alias of the RgbToAnsi() +func Rgb2basic(r, g, b uint8, isBg bool) uint8 { + // is basic color, direct use static map data. + hex := RgbToHex([]int{int(r), int(g), int(b)}) + if val, ok := hex2basicMap[hex]; ok { + if isBg { + return val + 10 + } + return val + } + + return RgbToAnsi(r, g, b, isBg) +} + +// Rgb2ansi alias of the RgbToAnsi() +func Rgb2ansi(r, g, b uint8, isBg bool) uint8 { + return RgbToAnsi(r, g, b, isBg) +} + +// RgbToAnsi convert RGB-code to 16-code +// refer https://github.com/radareorg/radare2/blob/master/libr/cons/rgb.c#L249-L271 +func RgbToAnsi(r, g, b uint8, isBg bool) uint8 { + var bright, c, k uint8 + base := compareVal(isBg, BgBase, FgBase) + + // eco bright-specific + if r == 0x80 && g == 0x80 && b == 0x80 { // 0x80=128 + bright = 53 + } else if r == 0xff || g == 0xff || b == 0xff { // 0xff=255 + bright = 60 + } // else bright = 0 + + if r == g && g == b { + // 0x7f=127 + // r = (r > 0x7f) ? 1 : 0; + r = compareVal(r > 0x7f, 1, 0) + g = compareVal(g > 0x7f, 1, 0) + b = compareVal(b > 0x7f, 1, 0) + } else { + k = (r + g + b) / 3 + + // r = (r >= k) ? 1 : 0; + r = compareVal(r >= k, 1, 0) + g = compareVal(g >= k, 1, 0) + b = compareVal(b >= k, 1, 0) + } + + // c = (r ? 1 : 0) + (g ? (b ? 6 : 2) : (b ? 4 : 0)) + c = compareVal(r > 0, 1, 0) + + if g > 0 { + c += compareVal(b > 0, 6, 2) + } else { + c += compareVal(b > 0, 4, 0) + } + return base + bright + c +} + +/************************************************************* + * 8bit(256) color <=> RGB/True color + *************************************************************/ + +// Rgb2short convert RGB-code to 256-code +func Rgb2short(r, g, b uint8) uint8 { + return RgbTo256(r, g, b) +} + +// RgbTo256 convert RGB-code to 256-code +func RgbTo256(r, g, b uint8) uint8 { + res := make([]uint8, 3) + for partI, part := range [3]uint8{r, g, b} { + i := 0 + for i < len(incs)-1 { + s, b := incs[i], incs[i+1] // smaller, bigger + if s <= part && part <= b { + s1 := math.Abs(float64(s) - float64(part)) + b1 := math.Abs(float64(b) - float64(part)) + var closest uint8 + if s1 < b1 { + closest = s + } else { + closest = b + } + res[partI] = closest + break + } + i++ + } + } + hex := fmt.Sprintf("%02x%02x%02x", res[0], res[1], res[2]) + equiv := hexTo256Table[hex] + return equiv +} + +// C256ToRgb convert an 256 color code to RGB numbers +func C256ToRgb(val uint8) (rgb []uint8) { + hex := c256ToHexMap[val] + // convert to rgb code + rgbInts := Hex2rgb(hex) + + return []uint8{ + uint8(rgbInts[0]), + uint8(rgbInts[1]), + uint8(rgbInts[2]), + } +} + +// C256ToRgbV1 convert an 256 color code to RGB numbers +// refer https://github.com/torvalds/linux/commit/cec5b2a97a11ade56a701e83044d0a2a984c67b4 +func C256ToRgbV1(val uint8) (rgb []uint8) { + var r, g, b uint8 + if val < 8 { // Standard colours. + // r = val&1 ? 0xaa : 0x00; + r = compareVal(val&1 == 1, 0xaa, 0x00) + g = compareVal(val&2 == 2, 0xaa, 0x00) + b = compareVal(val&4 == 4, 0xaa, 0x00) + } else if val < 16 { + // r = val & 1 ? 0xff : 0x55; + r = compareVal(val&1 == 1, 0xff, 0x55) + g = compareVal(val&2 == 2, 0xff, 0x55) + b = compareVal(val&4 == 4, 0xff, 0x55) + } else if val < 232 { /* 6x6x6 colour cube. */ + r = (val - 16) / 36 * 85 / 2 + g = (val - 16) / 6 % 6 * 85 / 2 + b = (val - 16) % 6 * 85 / 2 + } else { /* Grayscale ramp. */ + nv := uint8(int(val)*10 - 2312) + // set value + r, g, b = nv, nv, nv + } + + return []uint8{r, g, b} +} diff --git a/vendor/github.com/gookit/color/detect_env.go b/vendor/github.com/gookit/color/detect_env.go new file mode 100644 index 000000000..f5dde8fda --- /dev/null +++ b/vendor/github.com/gookit/color/detect_env.go @@ -0,0 +1,281 @@ +package color + +import ( + "io" + "io/ioutil" + "os" + "runtime" + "strconv" + "strings" + "syscall" + + "github.com/xo/terminfo" +) + +/************************************************************* + * helper methods for detect color supports + *************************************************************/ + +// DetectColorLevel for current env +// +// NOTICE: The method will detect terminal info each times, +// if only want get current color level, please direct call SupportColor() or TermColorLevel() +func DetectColorLevel() terminfo.ColorLevel { + level, _ := detectTermColorLevel() + return level +} + +// detect terminal color support level +// +// refer https://github.com/Delta456/box-cli-maker +func detectTermColorLevel() (level terminfo.ColorLevel, needVTP bool) { + // on windows WSL: + // - runtime.GOOS == "Linux" + // - support true-color + // env: + // WSL_DISTRO_NAME=Debian + if val := os.Getenv("WSL_DISTRO_NAME"); val != "" { + // detect WSL as it has True Color support + if detectWSL() { + debugf("True Color support on WSL environment") + return terminfo.ColorLevelMillions, false + } + } + + isWin := runtime.GOOS == "windows" + termVal := os.Getenv("TERM") + + // on TERM=screen: not support true-color + if termVal != "screen" { + // On JetBrains Terminal + // - support true-color + // env: + // TERMINAL_EMULATOR=JetBrains-JediTerm + val := os.Getenv("TERMINAL_EMULATOR") + if val == "JetBrains-JediTerm" { + debugf("True Color support on JetBrains-JediTerm, is win: %v", isWin) + return terminfo.ColorLevelMillions, isWin + } + } + + // level, err = terminfo.ColorLevelFromEnv() + level = detectColorLevelFromEnv(termVal, isWin) + debugf("color level by detectColorLevelFromEnv: %s", level.String()) + + // fallback: simple detect by TERM value string. + if level == terminfo.ColorLevelNone { + debugf("level none - fallback check special term color support") + // on Windows: enable VTP as it has True Color support + level, needVTP = detectSpecialTermColor(termVal) + } + return +} + +// detectColorFromEnv returns the color level COLORTERM, FORCE_COLOR, +// TERM_PROGRAM, or determined from the TERM environment variable. +// +// refer the terminfo.ColorLevelFromEnv() +// https://en.wikipedia.org/wiki/Terminfo +func detectColorLevelFromEnv(termVal string, isWin bool) terminfo.ColorLevel { + // check for overriding environment variables + colorTerm, termProg, forceColor := os.Getenv("COLORTERM"), os.Getenv("TERM_PROGRAM"), os.Getenv("FORCE_COLOR") + switch { + case strings.Contains(colorTerm, "truecolor") || strings.Contains(colorTerm, "24bit"): + if termVal == "screen" { // on TERM=screen: not support true-color + return terminfo.ColorLevelHundreds + } + return terminfo.ColorLevelMillions + case colorTerm != "" || forceColor != "": + return terminfo.ColorLevelBasic + case termProg == "Apple_Terminal": + return terminfo.ColorLevelHundreds + case termProg == "Terminus" || termProg == "Hyper": + if termVal == "screen" { // on TERM=screen: not support true-color + return terminfo.ColorLevelHundreds + } + return terminfo.ColorLevelMillions + case termProg == "iTerm.app": + if termVal == "screen" { // on TERM=screen: not support true-color + return terminfo.ColorLevelHundreds + } + + // check iTerm version + ver := os.Getenv("TERM_PROGRAM_VERSION") + if ver != "" { + i, err := strconv.Atoi(strings.Split(ver, ".")[0]) + if err != nil { + saveInternalError(terminfo.ErrInvalidTermProgramVersion) + // return terminfo.ColorLevelNone + return terminfo.ColorLevelHundreds + } + if i == 3 { + return terminfo.ColorLevelMillions + } + } + return terminfo.ColorLevelHundreds + } + + // otherwise determine from TERM's max_colors capability + if !isWin && termVal != "" { + debugf("TERM=%s - check color level by load terminfo file", termVal) + ti, err := terminfo.Load(termVal) + if err != nil { + saveInternalError(err) + return terminfo.ColorLevelNone + } + + debugf("the loaded term info file is: %s", ti.File) + v, ok := ti.Nums[terminfo.MaxColors] + switch { + case !ok || v <= 16: + return terminfo.ColorLevelNone + case ok && v >= 256: + return terminfo.ColorLevelHundreds + } + return terminfo.ColorLevelBasic + } + + // no TERM env value. default return none level + return terminfo.ColorLevelNone + // return terminfo.ColorLevelBasic +} + +var detectedWSL bool +var wslContents string + +// https://github.com/Microsoft/WSL/issues/423#issuecomment-221627364 +func detectWSL() bool { + if !detectedWSL { + b := make([]byte, 1024) + // `cat /proc/version` + // on mac: + // !not the file! + // on linux(debian,ubuntu,alpine): + // Linux version 4.19.121-linuxkit (root@18b3f92ade35) (gcc version 9.2.0 (Alpine 9.2.0)) #1 SMP Thu Jan 21 15:36:34 UTC 2021 + // on win git bash, conEmu: + // MINGW64_NT-10.0-19042 version 3.1.7-340.x86_64 (@WIN-N0G619FD3UK) (gcc version 9.3.0 (GCC) ) 2020-10-23 13:08 UTC + // on WSL: + // Linux version 4.4.0-19041-Microsoft (Microsoft@Microsoft.com) (gcc version 5.4.0 (GCC) ) #488-Microsoft Mon Sep 01 13:43:00 PST 2020 + f, err := os.Open("/proc/version") + if err == nil { + _, _ = f.Read(b) // ignore error + if err = f.Close(); err != nil { + saveInternalError(err) + } + + wslContents = string(b) + } + detectedWSL = true + } + return strings.Contains(wslContents, "Microsoft") +} + +// refer +// https://github.com/Delta456/box-cli-maker/blob/7b5a1ad8a016ce181e7d8b05e24b54ff60b4b38a/detect_unix.go#L27-L45 +// detect WSL as it has True Color support +func isWSL() bool { + // on windows WSL: + // - runtime.GOOS == "Linux" + // - support true-color + // WSL_DISTRO_NAME=Debian + if val := os.Getenv("WSL_DISTRO_NAME"); val == "" { + return false + } + + // `cat /proc/sys/kernel/osrelease` + // on mac: + // !not the file! + // on linux: + // 4.19.121-linuxkit + // on WSL Output: + // 4.4.0-19041-Microsoft + wsl, err := ioutil.ReadFile("/proc/sys/kernel/osrelease") + if err != nil { + saveInternalError(err) + return false + } + + // it gives "Microsoft" for WSL and "microsoft" for WSL 2 + // it support True-color + content := strings.ToLower(string(wsl)) + return strings.Contains(content, "microsoft") +} + +/************************************************************* + * helper methods for check env + *************************************************************/ + +// IsWindows OS env +func IsWindows() bool { + return runtime.GOOS == "windows" +} + +// IsConsole Determine whether w is one of stderr, stdout, stdin +func IsConsole(w io.Writer) bool { + o, ok := w.(*os.File) + if !ok { + return false + } + + fd := o.Fd() + + // fix: cannot use 'o == os.Stdout' to compare + return fd == uintptr(syscall.Stdout) || fd == uintptr(syscall.Stdin) || fd == uintptr(syscall.Stderr) +} + +// IsMSys msys(MINGW64) environment, does not necessarily support color +func IsMSys() bool { + // like "MSYSTEM=MINGW64" + if len(os.Getenv("MSYSTEM")) > 0 { + return true + } + + return false +} + +// IsSupportColor check current console is support color. +// +// NOTICE: The method will detect terminal info each times, +// if only want get current color level, please direct call SupportColor() or TermColorLevel() +func IsSupportColor() bool { + return IsSupport16Color() +} + +// IsSupportColor check current console is support color. +// +// NOTICE: The method will detect terminal info each times, +// if only want get current color level, please direct call SupportColor() or TermColorLevel() +func IsSupport16Color() bool { + level, _ := detectTermColorLevel() + return level > terminfo.ColorLevelNone +} + +// IsSupport256Color render check +// +// NOTICE: The method will detect terminal info each times, +// if only want get current color level, please direct call SupportColor() or TermColorLevel() +func IsSupport256Color() bool { + level, _ := detectTermColorLevel() + return level > terminfo.ColorLevelBasic +} + +// IsSupportRGBColor check. alias of the IsSupportTrueColor() +// +// NOTICE: The method will detect terminal info each times, +// if only want get current color level, please direct call SupportColor() or TermColorLevel() +func IsSupportRGBColor() bool { + return IsSupportTrueColor() +} + +// IsSupportTrueColor render check. +// +// NOTICE: The method will detect terminal info each times, +// if only want get current color level, please direct call SupportColor() or TermColorLevel() +// +// ENV: +// "COLORTERM=truecolor" +// "COLORTERM=24bit" +func IsSupportTrueColor() bool { + level, _ := detectTermColorLevel() + return level > terminfo.ColorLevelHundreds +} diff --git a/vendor/github.com/gookit/color/detect_nonwin.go b/vendor/github.com/gookit/color/detect_nonwin.go new file mode 100644 index 000000000..75c7202f0 --- /dev/null +++ b/vendor/github.com/gookit/color/detect_nonwin.go @@ -0,0 +1,48 @@ +// +build !windows + +// The method in the file has no effect +// Only for compatibility with non-Windows systems + +package color + +import ( + "strings" + "syscall" + + "github.com/xo/terminfo" +) + +// detect special term color support +func detectSpecialTermColor(termVal string) (terminfo.ColorLevel, bool) { + if termVal == "" { + return terminfo.ColorLevelNone, false + } + + debugf("terminfo check fail - fallback detect color by check TERM value") + + // on TERM=screen: + // - support 256, not support true-color. test on macOS + if termVal == "screen" { + return terminfo.ColorLevelHundreds, false + } + + if strings.Contains(termVal, "256color") { + return terminfo.ColorLevelHundreds, false + } + + if strings.Contains(termVal, "xterm") { + return terminfo.ColorLevelHundreds, false + // return terminfo.ColorLevelBasic, false + } + + // return terminfo.ColorLevelNone, nil + return terminfo.ColorLevelBasic, false +} + +// IsTerminal returns true if the given file descriptor is a terminal. +// +// Usage: +// IsTerminal(os.Stdout.Fd()) +func IsTerminal(fd uintptr) bool { + return fd == uintptr(syscall.Stdout) || fd == uintptr(syscall.Stdin) || fd == uintptr(syscall.Stderr) +} diff --git a/vendor/github.com/gookit/color/detect_windows.go b/vendor/github.com/gookit/color/detect_windows.go new file mode 100644 index 000000000..7707d9ca2 --- /dev/null +++ b/vendor/github.com/gookit/color/detect_windows.go @@ -0,0 +1,243 @@ +// +build windows + +// Display color on windows +// refer: +// golang.org/x/sys/windows +// golang.org/x/crypto/ssh/terminal +// https://docs.microsoft.com/en-us/windows/console +package color + +import ( + "os" + "syscall" + "unsafe" + + "github.com/xo/terminfo" + "golang.org/x/sys/windows" +) + +// related docs +// https://docs.microsoft.com/zh-cn/windows/console/console-virtual-terminal-sequences +// https://docs.microsoft.com/zh-cn/windows/console/console-virtual-terminal-sequences#samples +var ( + // isMSys bool + kernel32 *syscall.LazyDLL + + procGetConsoleMode *syscall.LazyProc + procSetConsoleMode *syscall.LazyProc +) + +func init() { + if !SupportColor() { + isLikeInCmd = true + return + } + + // if disabled. + if !Enable { + return + } + + // if at windows's ConEmu, Cmder, putty ... terminals not need VTP + + // -------- try force enable colors on windows terminal ------- + tryEnableVTP(needVTP) + + // fetch console screen buffer info + // err := getConsoleScreenBufferInfo(uintptr(syscall.Stdout), &defScreenInfo) +} + +// try force enable colors on windows terminal +func tryEnableVTP(enable bool) bool { + if !enable { + return false + } + + debugf("True-Color by enable VirtualTerminalProcessing on windows") + + initKernel32Proc() + + // enable colors on windows terminal + if tryEnableOnCONOUT() { + return true + } + + return tryEnableOnStdout() +} + +func initKernel32Proc() { + if kernel32 != nil { + return + } + + // load related windows dll + // https://docs.microsoft.com/en-us/windows/console/setconsolemode + kernel32 = syscall.NewLazyDLL("kernel32.dll") + + procGetConsoleMode = kernel32.NewProc("GetConsoleMode") + procSetConsoleMode = kernel32.NewProc("SetConsoleMode") +} + +func tryEnableOnCONOUT() bool { + outHandle, err := syscall.Open("CONOUT$", syscall.O_RDWR, 0) + if err != nil { + saveInternalError(err) + return false + } + + err = EnableVirtualTerminalProcessing(outHandle, true) + if err != nil { + saveInternalError(err) + return false + } + + return true +} + +func tryEnableOnStdout() bool { + // try direct open syscall.Stdout + err := EnableVirtualTerminalProcessing(syscall.Stdout, true) + if err != nil { + saveInternalError(err) + return false + } + + return true +} + +// Get the Windows Version and Build Number +var ( + winVersion, _, buildNumber = windows.RtlGetNtVersionNumbers() +) + +// refer +// https://github.com/Delta456/box-cli-maker/blob/7b5a1ad8a016ce181e7d8b05e24b54ff60b4b38a/detect_windows.go#L30-L57 +// https://github.com/gookit/color/issues/25#issuecomment-738727917 +// detects the Color Level Supported on windows: cmd, powerShell +func detectSpecialTermColor(termVal string) (tl terminfo.ColorLevel, needVTP bool) { + if os.Getenv("ConEmuANSI") == "ON" { + debugf("support True Color by ConEmuANSI=ON") + // ConEmuANSI is "ON" for generic ANSI support + // but True Color option is enabled by default + // I am just assuming that people wouldn't have disabled it + // Even if it is not enabled then ConEmu will auto round off + // accordingly + return terminfo.ColorLevelMillions, false + } + + // Before Windows 10 Build Number 10586, console never supported ANSI Colors + if buildNumber < 10586 || winVersion < 10 { + // Detect if using ANSICON on older systems + if os.Getenv("ANSICON") != "" { + conVersion := os.Getenv("ANSICON_VER") + // 8 bit Colors were only supported after v1.81 release + if conVersion >= "181" { + return terminfo.ColorLevelHundreds, false + } + return terminfo.ColorLevelBasic, false + } + + return terminfo.ColorLevelNone, false + } + + // True Color is not available before build 14931 so fallback to 8 bit color. + if buildNumber < 14931 { + return terminfo.ColorLevelHundreds, true + } + + // Windows 10 build 14931 is the first release that supports 16m/TrueColor + debugf("support True Color on windows version is >= build 14931") + return terminfo.ColorLevelMillions, true +} + +/************************************************************* + * render full color code on windows(8,16,24bit color) + *************************************************************/ + +// docs https://docs.microsoft.com/zh-cn/windows/console/getconsolemode#parameters +const ( + // equals to docs page's ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 + EnableVirtualTerminalProcessingMode uint32 = 0x4 +) + +// EnableVirtualTerminalProcessing Enable virtual terminal processing +// +// ref from github.com/konsorten/go-windows-terminal-sequences +// doc https://docs.microsoft.com/zh-cn/windows/console/console-virtual-terminal-sequences#samples +// +// Usage: +// err := EnableVirtualTerminalProcessing(syscall.Stdout, true) +// // support print color text +// err = EnableVirtualTerminalProcessing(syscall.Stdout, false) +func EnableVirtualTerminalProcessing(stream syscall.Handle, enable bool) error { + var mode uint32 + // Check if it is currently in the terminal + // err := syscall.GetConsoleMode(syscall.Stdout, &mode) + err := syscall.GetConsoleMode(stream, &mode) + if err != nil { + // fmt.Println("EnableVirtualTerminalProcessing", err) + return err + } + + if enable { + mode |= EnableVirtualTerminalProcessingMode + } else { + mode &^= EnableVirtualTerminalProcessingMode + } + + ret, _, err := procSetConsoleMode.Call(uintptr(stream), uintptr(mode)) + if ret == 0 { + return err + } + + return nil +} + +// renderColorCodeOnCmd enable cmd color render. +// func renderColorCodeOnCmd(fn func()) { +// err := EnableVirtualTerminalProcessing(syscall.Stdout, true) +// // if is not in terminal, will clear color tag. +// if err != nil { +// // panic(err) +// fn() +// return +// } +// +// // force open color render +// old := ForceOpenColor() +// fn() +// // revert color setting +// supportColor = old +// +// err = EnableVirtualTerminalProcessing(syscall.Stdout, false) +// if err != nil { +// panic(err) +// } +// } + +/************************************************************* + * render simple color code on windows + *************************************************************/ + +// IsTty returns true if the given file descriptor is a terminal. +func IsTty(fd uintptr) bool { + initKernel32Proc() + + var st uint32 + r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) + return r != 0 && e == 0 +} + +// IsTerminal returns true if the given file descriptor is a terminal. +// +// Usage: +// fd := os.Stdout.Fd() +// fd := uintptr(syscall.Stdout) // for windows +// IsTerminal(fd) +func IsTerminal(fd uintptr) bool { + initKernel32Proc() + + var st uint32 + r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) + return r != 0 && e == 0 +} diff --git a/vendor/github.com/gookit/color/go.mod b/vendor/github.com/gookit/color/go.mod new file mode 100644 index 000000000..cd94efc3a --- /dev/null +++ b/vendor/github.com/gookit/color/go.mod @@ -0,0 +1,9 @@ +module github.com/gookit/color + +go 1.12 + +require ( + github.com/stretchr/testify v1.6.1 + github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 + golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44 +) diff --git a/vendor/github.com/gookit/color/go.sum b/vendor/github.com/gookit/color/go.sum new file mode 100644 index 000000000..2d67cba01 --- /dev/null +++ b/vendor/github.com/gookit/color/go.sum @@ -0,0 +1,15 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8= +github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44 h1:Bli41pIlzTzf3KEY06n+xnzK/BESIg2ze4Pgfh/aI8c= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/vendor/github.com/gookit/color/printer.go b/vendor/github.com/gookit/color/printer.go new file mode 100644 index 000000000..326aabc0b --- /dev/null +++ b/vendor/github.com/gookit/color/printer.go @@ -0,0 +1,122 @@ +package color + +import "fmt" + +/************************************************************* + * colored message Printer + *************************************************************/ + +// PrinterFace interface +type PrinterFace interface { + fmt.Stringer + Sprint(a ...interface{}) string + Sprintf(format string, a ...interface{}) string + Print(a ...interface{}) + Printf(format string, a ...interface{}) + Println(a ...interface{}) +} + +// Printer a generic color message printer. +// +// Usage: +// p := &Printer{Code: "32;45;3"} +// p.Print("message") +type Printer struct { + // NoColor disable color. + NoColor bool + // Code color code string. eg "32;45;3" + Code string +} + +// NewPrinter instance +func NewPrinter(colorCode string) *Printer { + return &Printer{Code: colorCode} +} + +// String returns color code string. eg: "32;45;3" +func (p *Printer) String() string { + // panic("implement me") + return p.Code +} + +// Sprint returns rendering colored messages +func (p *Printer) Sprint(a ...interface{}) string { + return RenderCode(p.String(), a...) +} + +// Sprintf returns format and rendering colored messages +func (p *Printer) Sprintf(format string, a ...interface{}) string { + return RenderString(p.String(), fmt.Sprintf(format, a...)) +} + +// Print rendering colored messages +func (p *Printer) Print(a ...interface{}) { + doPrintV2(p.String(), fmt.Sprint(a...)) +} + +// Printf format and rendering colored messages +func (p *Printer) Printf(format string, a ...interface{}) { + doPrintV2(p.String(), fmt.Sprintf(format, a...)) +} + +// Println rendering colored messages with newline +func (p *Printer) Println(a ...interface{}) { + doPrintlnV2(p.Code, a) +} + +// IsEmpty color code +func (p *Printer) IsEmpty() bool { + return p.Code == "" +} + +/************************************************************* + * SimplePrinter struct + *************************************************************/ + +// SimplePrinter use for quick use color print on inject to struct +type SimplePrinter struct{} + +// Print message +func (s *SimplePrinter) Print(v ...interface{}) { + Print(v...) +} + +// Printf message +func (s *SimplePrinter) Printf(format string, v ...interface{}) { + Printf(format, v...) +} + +// Println message +func (s *SimplePrinter) Println(v ...interface{}) { + Println(v...) +} + +// Infof message +func (s *SimplePrinter) Infof(format string, a ...interface{}) { + Info.Printf(format, a...) +} + +// Infoln message +func (s *SimplePrinter) Infoln(a ...interface{}) { + Info.Println(a...) +} + +// Warnf message +func (s *SimplePrinter) Warnf(format string, a ...interface{}) { + Warn.Printf(format, a...) +} + +// Warnln message +func (s *SimplePrinter) Warnln(a ...interface{}) { + Warn.Println(a...) +} + +// Errorf message +func (s *SimplePrinter) Errorf(format string, a ...interface{}) { + Error.Printf(format, a...) +} + +// Errorln message +func (s *SimplePrinter) Errorln(a ...interface{}) { + Error.Println(a...) +} diff --git a/vendor/github.com/gookit/color/quickstart.go b/vendor/github.com/gookit/color/quickstart.go new file mode 100644 index 000000000..3cc3b77fa --- /dev/null +++ b/vendor/github.com/gookit/color/quickstart.go @@ -0,0 +1,109 @@ +package color + +/************************************************************* + * quick use color print message + *************************************************************/ + +// Redp print message with Red color +func Redp(a ...interface{}) { + Red.Print(a...) +} + +// Redln print message line with Red color +func Redln(a ...interface{}) { + Red.Println(a...) +} + +// Bluep print message with Blue color +func Bluep(a ...interface{}) { + Blue.Print(a...) +} + +// Blueln print message line with Blue color +func Blueln(a ...interface{}) { + Blue.Println(a...) +} + +// Cyanp print message with Cyan color +func Cyanp(a ...interface{}) { + Cyan.Print(a...) +} + +// Cyanln print message line with Cyan color +func Cyanln(a ...interface{}) { + Cyan.Println(a...) +} + +// Grayp print message with Gray color +func Grayp(a ...interface{}) { + Gray.Print(a...) +} + +// Grayln print message line with Gray color +func Grayln(a ...interface{}) { + Gray.Println(a...) +} + +// Greenp print message with Green color +func Greenp(a ...interface{}) { + Green.Print(a...) +} + +// Greenln print message line with Green color +func Greenln(a ...interface{}) { + Green.Println(a...) +} + +// Yellowp print message with Yellow color +func Yellowp(a ...interface{}) { + Yellow.Print(a...) +} + +// Yellowln print message line with Yellow color +func Yellowln(a ...interface{}) { + Yellow.Println(a...) +} + +// Magentap print message with Magenta color +func Magentap(a ...interface{}) { + Magenta.Print(a...) +} + +// Magentaln print message line with Magenta color +func Magentaln(a ...interface{}) { + Magenta.Println(a...) +} + +/************************************************************* + * quick use style print message + *************************************************************/ + +// Infof print message with Info style +func Infof(format string, a ...interface{}) { + Info.Printf(format, a...) +} + +// Infoln print message with Info style +func Infoln(a ...interface{}) { + Info.Println(a...) +} + +// Errorf print message with Error style +func Errorf(format string, a ...interface{}) { + Error.Printf(format, a...) +} + +// Errorln print message with Error style +func Errorln(a ...interface{}) { + Error.Println(a...) +} + +// Warnf print message with Warn style +func Warnf(format string, a ...interface{}) { + Warn.Printf(format, a...) +} + +// Warnln print message with Warn style +func Warnln(a ...interface{}) { + Warn.Println(a...) +} diff --git a/vendor/github.com/gookit/color/style.go b/vendor/github.com/gookit/color/style.go new file mode 100644 index 000000000..fad76fb33 --- /dev/null +++ b/vendor/github.com/gookit/color/style.go @@ -0,0 +1,315 @@ +package color + +import ( + "fmt" + "strings" +) + +/************************************************************* + * 16 color Style + *************************************************************/ + +// Style a 16 color style. can add: fg color, bg color, color options +// +// Example: +// color.Style{color.FgGreen}.Print("message") +type Style []Color + +// New create a custom style +// +// Usage: +// color.New(color.FgGreen).Print("message") +// equals to: +// color.Style{color.FgGreen}.Print("message") +func New(colors ...Color) Style { + return colors +} + +// Save to global styles map +func (s Style) Save(name string) { + AddStyle(name, s) +} + +// Add to global styles map +func (s *Style) Add(cs ...Color) { + *s = append(*s, cs...) +} + +// Render render text +// Usage: +// color.New(color.FgGreen).Render("text") +// color.New(color.FgGreen, color.BgBlack, color.OpBold).Render("text") +func (s Style) Render(a ...interface{}) string { + return RenderCode(s.String(), a...) +} + +// Renderln render text line. +// like Println, will add spaces for each argument +// Usage: +// color.New(color.FgGreen).Renderln("text", "more") +// color.New(color.FgGreen, color.BgBlack, color.OpBold).Render("text", "more") +func (s Style) Renderln(a ...interface{}) string { + return RenderWithSpaces(s.String(), a...) +} + +// Sprint is alias of the 'Render' +func (s Style) Sprint(a ...interface{}) string { + return RenderCode(s.String(), a...) +} + +// Sprintf format and render message. +func (s Style) Sprintf(format string, a ...interface{}) string { + return RenderString(s.String(), fmt.Sprintf(format, a...)) +} + +// Print render and Print text +func (s Style) Print(a ...interface{}) { + doPrintV2(s.String(), fmt.Sprint(a...)) +} + +// Printf render and print text +func (s Style) Printf(format string, a ...interface{}) { + doPrintV2(s.Code(), fmt.Sprintf(format, a...)) +} + +// Println render and print text line +func (s Style) Println(a ...interface{}) { + doPrintlnV2(s.String(), a) +} + +// Code convert to code string. returns like "32;45;3" +func (s Style) Code() string { + return s.String() +} + +// String convert to code string. returns like "32;45;3" +func (s Style) String() string { + return Colors2code(s...) +} + +// IsEmpty style +func (s Style) IsEmpty() bool { + return len(s) == 0 +} + +/************************************************************* + * Theme(extended Style) + *************************************************************/ + +// Theme definition. extends from Style +type Theme struct { + // Name theme name + Name string + // Style for the theme + Style +} + +// NewTheme instance +func NewTheme(name string, style Style) *Theme { + return &Theme{name, style} +} + +// Save to themes map +func (t *Theme) Save() { + AddTheme(t.Name, t.Style) +} + +// Tips use name as title, only apply style for name +func (t *Theme) Tips(format string, a ...interface{}) { + // only apply style for name + t.Print(strings.ToUpper(t.Name) + ": ") + Printf(format+"\n", a...) +} + +// Prompt use name as title, and apply style for message +func (t *Theme) Prompt(format string, a ...interface{}) { + title := strings.ToUpper(t.Name) + ":" + t.Println(title, fmt.Sprintf(format, a...)) +} + +// Block like Prompt, but will wrap a empty line +func (t *Theme) Block(format string, a ...interface{}) { + title := strings.ToUpper(t.Name) + ":\n" + + t.Println(title, fmt.Sprintf(format, a...)) +} + +/************************************************************* + * Theme: internal themes + *************************************************************/ + +// internal themes(like bootstrap style) +// Usage: +// color.Info.Print("message") +// color.Info.Printf("a %s message", "test") +// color.Warn.Println("message") +// color.Error.Println("message") +var ( + // Info color style + Info = &Theme{"info", Style{OpReset, FgGreen}} + // Note color style + Note = &Theme{"note", Style{OpBold, FgLightCyan}} + // Warn color style + Warn = &Theme{"warning", Style{OpBold, FgYellow}} + // Light color style + Light = &Theme{"light", Style{FgLightWhite, BgBlack}} + // Error color style + Error = &Theme{"error", Style{FgLightWhite, BgRed}} + // Danger color style + Danger = &Theme{"danger", Style{OpBold, FgRed}} + // Debug color style + Debug = &Theme{"debug", Style{OpReset, FgCyan}} + // Notice color style + Notice = &Theme{"notice", Style{OpBold, FgCyan}} + // Comment color style + Comment = &Theme{"comment", Style{OpReset, FgYellow}} + // Success color style + Success = &Theme{"success", Style{OpBold, FgGreen}} + // Primary color style + Primary = &Theme{"primary", Style{OpReset, FgBlue}} + // Question color style + Question = &Theme{"question", Style{OpReset, FgMagenta}} + // Secondary color style + Secondary = &Theme{"secondary", Style{FgDarkGray}} +) + +// Themes internal defined themes. +// Usage: +// color.Themes["info"].Println("message") +var Themes = map[string]*Theme{ + "info": Info, + "note": Note, + "light": Light, + "error": Error, + + "debug": Debug, + "danger": Danger, + "notice": Notice, + "success": Success, + "comment": Comment, + "primary": Primary, + "warning": Warn, + + "question": Question, + "secondary": Secondary, +} + +// AddTheme add a theme and style +func AddTheme(name string, style Style) { + Themes[name] = NewTheme(name, style) + Styles[name] = style +} + +// GetTheme get defined theme by name +func GetTheme(name string) *Theme { + return Themes[name] +} + +/************************************************************* + * internal styles + *************************************************************/ + +// Styles internal defined styles, like bootstrap styles. +// Usage: +// color.Styles["info"].Println("message") +var Styles = map[string]Style{ + "info": {OpReset, FgGreen}, + "note": {OpBold, FgLightCyan}, + "light": {FgLightWhite, BgRed}, + "error": {FgLightWhite, BgRed}, + + "danger": {OpBold, FgRed}, + "notice": {OpBold, FgCyan}, + "success": {OpBold, FgGreen}, + "comment": {OpReset, FgMagenta}, + "primary": {OpReset, FgBlue}, + "warning": {OpBold, FgYellow}, + + "question": {OpReset, FgMagenta}, + "secondary": {FgDarkGray}, +} + +// some style name alias +var styleAliases = map[string]string{ + "err": "error", + "suc": "success", + "warn": "warning", +} + +// AddStyle add a style +func AddStyle(name string, s Style) { + Styles[name] = s +} + +// GetStyle get defined style by name +func GetStyle(name string) Style { + if s, ok := Styles[name]; ok { + return s + } + + if realName, ok := styleAliases[name]; ok { + return Styles[realName] + } + + // empty style + return New() +} + +/************************************************************* + * color scheme + *************************************************************/ + +// Scheme struct +type Scheme struct { + Name string + Styles map[string]Style +} + +// NewScheme create new Scheme +func NewScheme(name string, styles map[string]Style) *Scheme { + return &Scheme{Name: name, Styles: styles} +} + +// NewDefaultScheme create an defuault color Scheme +func NewDefaultScheme(name string) *Scheme { + return NewScheme(name, map[string]Style{ + "info": {OpReset, FgGreen}, + "warn": {OpBold, FgYellow}, + "error": {FgLightWhite, BgRed}, + }) +} + +// Style get by name +func (s *Scheme) Style(name string) Style { + return s.Styles[name] +} + +// Infof message print +func (s *Scheme) Infof(format string, a ...interface{}) { + s.Styles["info"].Printf(format, a...) +} + +// Infoln message print +func (s *Scheme) Infoln(v ...interface{}) { + s.Styles["info"].Println(v...) +} + +// Warnf message print +func (s *Scheme) Warnf(format string, a ...interface{}) { + s.Styles["warn"].Printf(format, a...) +} + +// Warnln message print +func (s *Scheme) Warnln(v ...interface{}) { + s.Styles["warn"].Println(v...) +} + +// Errorf message print +func (s *Scheme) Errorf(format string, a ...interface{}) { + s.Styles["error"].Printf(format, a...) +} + +// Errorln message print +func (s *Scheme) Errorln(v ...interface{}) { + s.Styles["error"].Println(v...) +} diff --git a/vendor/github.com/gookit/color/utils.go b/vendor/github.com/gookit/color/utils.go new file mode 100644 index 000000000..dedf9f2df --- /dev/null +++ b/vendor/github.com/gookit/color/utils.go @@ -0,0 +1,206 @@ +package color + +import ( + "fmt" + "io" + "log" + "strings" +) + +// SetTerminal by given code. +func SetTerminal(code string) error { + if !Enable || !SupportColor() { + return nil + } + + _, err := fmt.Fprintf(output, SettingTpl, code) + return err +} + +// ResetTerminal terminal setting. +func ResetTerminal() error { + if !Enable || !SupportColor() { + return nil + } + + _, err := fmt.Fprint(output, ResetSet) + return err +} + +/************************************************************* + * print methods(will auto parse color tags) + *************************************************************/ + +// Print render color tag and print messages +func Print(a ...interface{}) { + Fprint(output, a...) +} + +// Printf format and print messages +func Printf(format string, a ...interface{}) { + Fprintf(output, format, a...) +} + +// Println messages with new line +func Println(a ...interface{}) { + Fprintln(output, a...) +} + +// Fprint print rendered messages to writer +// Notice: will ignore print error +func Fprint(w io.Writer, a ...interface{}) { + _, err := fmt.Fprint(w, Render(a...)) + saveInternalError(err) + + // if isLikeInCmd { + // renderColorCodeOnCmd(func() { + // _, _ = fmt.Fprint(w, Render(a...)) + // }) + // } else { + // _, _ = fmt.Fprint(w, Render(a...)) + // } +} + +// Fprintf print format and rendered messages to writer. +// Notice: will ignore print error +func Fprintf(w io.Writer, format string, a ...interface{}) { + str := fmt.Sprintf(format, a...) + _, err := fmt.Fprint(w, ReplaceTag(str)) + saveInternalError(err) +} + +// Fprintln print rendered messages line to writer +// Notice: will ignore print error +func Fprintln(w io.Writer, a ...interface{}) { + str := formatArgsForPrintln(a) + _, err := fmt.Fprintln(w, ReplaceTag(str)) + saveInternalError(err) +} + +// Lprint passes colored messages to a log.Logger for printing. +// Notice: should be goroutine safe +func Lprint(l *log.Logger, a ...interface{}) { + l.Print(Render(a...)) +} + +// Render parse color tags, return rendered string. +// Usage: +// text := Render("hello world!") +// fmt.Println(text) +func Render(a ...interface{}) string { + if len(a) == 0 { + return "" + } + + return ReplaceTag(fmt.Sprint(a...)) +} + +// Sprint parse color tags, return rendered string +func Sprint(a ...interface{}) string { + if len(a) == 0 { + return "" + } + + return ReplaceTag(fmt.Sprint(a...)) +} + +// Sprintf format and return rendered string +func Sprintf(format string, a ...interface{}) string { + return ReplaceTag(fmt.Sprintf(format, a...)) +} + +// String alias of the ReplaceTag +func String(s string) string { + return ReplaceTag(s) +} + +// Text alias of the ReplaceTag +func Text(s string) string { + return ReplaceTag(s) +} + +/************************************************************* + * helper methods for print + *************************************************************/ + +// new implementation, support render full color code on pwsh.exe, cmd.exe +func doPrintV2(code, str string) { + _, err := fmt.Fprint(output, RenderString(code, str)) + saveInternalError(err) + + // if isLikeInCmd { + // renderColorCodeOnCmd(func() { + // _, _ = fmt.Fprint(output, RenderString(code, str)) + // }) + // } else { + // _, _ = fmt.Fprint(output, RenderString(code, str)) + // } +} + +// new implementation, support render full color code on pwsh.exe, cmd.exe +func doPrintlnV2(code string, args []interface{}) { + str := formatArgsForPrintln(args) + _, err := fmt.Fprintln(output, RenderString(code, str)) + saveInternalError(err) +} + +// if use Println, will add spaces for each arg +func formatArgsForPrintln(args []interface{}) (message string) { + if ln := len(args); ln == 0 { + message = "" + } else if ln == 1 { + message = fmt.Sprint(args[0]) + } else { + message = fmt.Sprintln(args...) + // clear last "\n" + message = message[:len(message)-1] + } + return +} + +/************************************************************* + * helper methods + *************************************************************/ + +// is on debug mode +// func isDebugMode() bool { +// return debugMode == "on" +// } + +func debugf(f string, v ...interface{}) { + if debugMode { + fmt.Print("COLOR_DEBUG: ") + fmt.Printf(f, v...) + fmt.Println() + } +} + +// equals: return ok ? val1 : val2 +func compareVal(ok bool, val1, val2 uint8) uint8 { + if ok { + return val1 + } + return val2 +} + +func saveInternalError(err error) { + if err != nil { + debugf("inner error: %s", err.Error()) + innerErrs = append(innerErrs, err) + } +} + +func stringToArr(str, sep string) (arr []string) { + str = strings.TrimSpace(str) + if str == "" { + return + } + + ss := strings.Split(str, sep) + for _, val := range ss { + if val = strings.TrimSpace(val); val != "" { + arr = append(arr, val) + } + } + return +} diff --git a/vendor/github.com/jesseduffield/gocui/edit.go b/vendor/github.com/jesseduffield/gocui/edit.go index a169e563b..8c4b74adf 100644 --- a/vendor/github.com/jesseduffield/gocui/edit.go +++ b/vendor/github.com/jesseduffield/gocui/edit.go @@ -6,14 +6,8 @@ package gocui import ( "unicode" - - "github.com/go-errors/errors" - - "github.com/mattn/go-runewidth" ) -const maxInt = int(^uint(0) >> 1) - // Editor interface must be satisfied by gocui editors. type Editor interface { Edit(v *View, key Key, ch rune, mod Modifier) bool @@ -34,467 +28,40 @@ var DefaultEditor Editor = EditorFunc(simpleEditor) // simpleEditor is used as the default gocui editor. func simpleEditor(v *View, key Key, ch rune, mod Modifier) bool { - matched := true - switch { - case ch != 0 && mod == 0: - v.EditWrite(ch) - case key == KeySpace: - v.EditWrite(' ') case key == KeyBackspace || key == KeyBackspace2: - v.EditDelete(true) + v.TextArea.BackSpaceChar() case key == KeyCtrlD || key == KeyDelete: - v.EditDelete(false) - case key == KeyInsert: - v.Overwrite = !v.Overwrite + v.TextArea.DeleteChar() case key == KeyArrowDown: - v.MoveCursor(0, 1, false) + v.TextArea.MoveCursorDown() case key == KeyArrowUp: - v.MoveCursor(0, -1, false) + v.TextArea.MoveCursorUp() case key == KeyArrowLeft: - v.MoveCursor(-1, 0, false) + v.TextArea.MoveCursorLeft() case key == KeyArrowRight: - v.MoveCursor(1, 0, false) + v.TextArea.MoveCursorRight() case key == KeyEnter: - v.EditNewLine() + v.TextArea.TypeRune('\n') + case key == KeySpace: + v.TextArea.TypeRune(' ') + case key == KeyInsert: + v.TextArea.ToggleOverwrite() case key == KeyCtrlU: - v.EditDeleteToStartOfLine() - case key == KeyCtrlA: - v.EditGotoToStartOfLine() - case key == KeyCtrlE: - v.EditGotoToEndOfLine() - matched = true + v.TextArea.DeleteToStartOfLine() + case key == KeyCtrlA || key == KeyHome: + v.TextArea.GoToStartOfLine() + case key == KeyCtrlE || key == KeyEnd: + v.TextArea.GoToEndOfLine() - // TODO: see if we need all three of these conditions: maybe the final one is sufficient + // TODO: see if we need all three of these conditions: maybe the final one is sufficient case ch != 0 && mod == 0 && unicode.IsPrint(ch): - v.EditWrite(ch) + v.TextArea.TypeRune(ch) default: - matched = false + return false } - return matched -} - -// EditWrite writes a rune at the cursor position. -func (v *View) EditWrite(ch rune) { - w := runewidth.RuneWidth(ch) - if w == 0 { - return - } - - v.writeRune(v.cx, v.cy, ch) - v.moveCursor(w, 0, true) -} - -func (v *View) EditWriteString(str string) { - for _, ch := range str { - v.EditWrite(ch) - } -} - -func (v *View) SetEditorContent(content string) error { - v.Clear() - if err := v.SetOrigin(0, 0); err != nil { - return err - } - if err := v.SetCursor(0, 0); err != nil { - return err - } - v.EditWriteString(content) - return nil -} - -// EditDeleteToStartOfLine is the equivalent of pressing ctrl+U in your terminal, it deletes to the start of the line. Or if you are already at the start of the line, it deletes the newline character -func (v *View) EditDeleteToStartOfLine() { - x, _ := v.Cursor() - if x == 0 { - v.EditDelete(true) - } else { - // delete characters until we are the start of the line - for x > 0 { - v.EditDelete(true) - x, _ = v.Cursor() - } - } -} - -// EditGotoToStartOfLine takes you to the start of the current line -func (v *View) EditGotoToStartOfLine() { - x, _ := v.Cursor() - for x > 0 { - v.MoveCursor(-1, 0, false) - x, _ = v.Cursor() - } -} - -// EditGotoToEndOfLine takes you to the end of the line -func (v *View) EditGotoToEndOfLine() { - _, y := v.Cursor() - _ = v.SetCursor(0, y+1) - x, newY := v.Cursor() - if newY == y { - // we must be on the last line, so lets move to the very end - prevX := -1 - for prevX != x { - prevX = x - v.MoveCursor(1, 0, false) - x, _ = v.Cursor() - } - } else { - // most left so now we're at the end of the original line - v.MoveCursor(-1, 0, false) - } -} - -// EditDelete deletes a rune at the cursor position. back determines the -// direction. -func (v *View) EditDelete(back bool) { - v.writeMutex.Lock() - defer v.writeMutex.Unlock() - - x, y := v.ox+v.cx, v.oy+v.cy - if y < 0 { - return - } else if y >= len(v.viewLines) { - v.MoveCursor(-1, 0, true) - return - } - - maxX, _ := v.Size() - if back { - if x == 0 { // start of the line - if y < 1 { - return - } - - var maxPrevWidth int - if v.Wrap { - maxPrevWidth = maxX - } else { - maxPrevWidth = maxInt - } - - if v.viewLines[y].linesX == 0 { // regular line - v.mergeLines(v.cy - 1) - if len(v.viewLines[y-1].line) < maxPrevWidth { - v.MoveCursor(-1, 0, true) - } - } else { // wrapped line - n, _ := v.deleteRune(len(v.viewLines[y-1].line)-1, v.cy-1) - v.MoveCursor(-n, 0, true) - } - } else { // middle/end of the line - n, _ := v.deleteRune(v.cx-1, v.cy) - v.MoveCursor(-n, 0, true) - } - } else { - if x == len(v.viewLines[y].line) { // end of the line - v.mergeLines(v.cy) - } else { // start/middle of the line - v.deleteRune(v.cx, v.cy) - } - } -} - -// EditNewLine inserts a new line under the cursor. -func (v *View) EditNewLine() { - v.writeMutex.Lock() - defer v.writeMutex.Unlock() - - v.breakLine(v.cx, v.cy) - v.ox = 0 - v.cy = v.cy + 1 - v.cx = 0 -} - -// MoveCursor moves the cursor taking into account the width of the line/view, -// displacing the origin if necessary. -func (v *View) MoveCursor(dx, dy int, writeMode bool) { - ox, oy := v.cx+v.ox, v.cy+v.oy - x, y := ox+dx, oy+dy - - if y < 0 || y >= len(v.viewLines) { - v.moveCursor(dx, dy, writeMode) - return - } - - // Removing newline. - if x < 0 { - var prevLen int - if y-1 >= 0 && y-1 < len(v.viewLines) { - prevLen = lineWidth(v.viewLines[y-1].line) - } - - v.MoveCursor(prevLen, -1, writeMode) - return - } - - line := v.viewLines[y].line - var col int - var prevCol int - for i := range line { - prevCol = col - col += runewidth.RuneWidth(line[i].chr) - if dx > 0 { - if x <= col { - x = col - break - } - continue - } - - if x < col { - x = prevCol - break - } - } - - v.moveCursor(x-ox, y-oy, writeMode) -} - -func (v *View) moveCursor(dx, dy int, writeMode bool) { - maxX, maxY := v.Size() - cx, cy := v.cx+dx, v.cy+dy - x, y := v.ox+cx, v.oy+cy - - var curLineWidth, prevLineWidth int - // get the width of the current line - curLineWidth = maxInt - if v.Wrap { - curLineWidth = maxX - 1 - } - - if !writeMode { - curLineWidth = 0 - if y >= 0 && y < len(v.viewLines) { - curLineWidth = lineWidth(v.viewLines[y].line) - if v.Wrap && curLineWidth >= maxX { - curLineWidth = maxX - 1 - } - } - } - // get the width of the previous line - prevLineWidth = 0 - if y-1 >= 0 && y-1 < len(v.viewLines) { - prevLineWidth = lineWidth(v.viewLines[y-1].line) - } - // adjust cursor's x position and view's x origin - if x > curLineWidth { // move to next line - if dx > 0 { // horizontal movement - cy++ - if writeMode || v.oy+cy < len(v.viewLines) { - if !v.Wrap { - v.ox = 0 - } - v.cx = 0 - } - } else { // vertical movement - if curLineWidth > 0 { // move cursor to the EOL - if v.Wrap { - v.cx = curLineWidth - } else { - ncx := curLineWidth - v.ox - if ncx < 0 { - v.ox += ncx - if v.ox < 0 { - v.ox = 0 - } - v.cx = 0 - } else { - v.cx = ncx - } - } - } else { - if writeMode || v.oy+cy < len(v.viewLines) { - if !v.Wrap { - v.ox = 0 - } - v.cx = 0 - } - } - } - } else if cx < 0 { - if !v.Wrap && v.ox > 0 { // move origin to the left - v.ox += cx - v.cx = 0 - } else { // move to previous line - cy-- - if prevLineWidth > 0 { - if !v.Wrap { // set origin so the EOL is visible - nox := prevLineWidth - maxX + 1 - if nox < 0 { - nox = 0 - } - v.ox = nox - } - v.cx = prevLineWidth - } else { - if !v.Wrap { - v.ox = 0 - } - v.cx = 0 - } - } - } else { // stay on the same line - if v.Wrap { - v.cx = cx - } else { - if cx >= maxX { - v.ox += cx - maxX + 1 - v.cx = maxX - } else { - v.cx = cx - } - } - } - - // adjust cursor's y position and view's y origin - if cy < 0 { - if v.oy > 0 { - v.oy-- - } - } else if writeMode || v.oy+cy < len(v.viewLines) { - if cy >= maxY { - v.oy++ - } else { - v.cy = cy - } - } -} - -// writeRune writes a rune into the view's internal buffer, at the -// position corresponding to the point (x, y). The length of the internal -// buffer is increased if the point is out of bounds. Overwrite mode is -// governed by the value of View.overwrite. -func (v *View) writeRune(x, y int, ch rune) error { - v.writeMutex.Lock() - defer v.writeMutex.Unlock() - - v.tainted = true - - x, y, err := v.realPosition(x, y) - if err != nil { - return err - } - - if x < 0 || y < 0 { - return errors.New("invalid point") - } - - if y >= len(v.lines) { - s := make([][]cell, y-len(v.lines)+1) - v.lines = append(v.lines, s...) - } - - olen := len(v.lines[y]) - w := runewidth.RuneWidth(ch) - - var s []cell - if x >= len(v.lines[y]) { - s = make([]cell, x-len(v.lines[y])+w) - } else if !v.Overwrite { - s = make([]cell, w) - } - v.lines[y] = append(v.lines[y], s...) - - if !v.Overwrite || (v.Overwrite && x >= olen-w) { - copy(v.lines[y][x+w:], v.lines[y][x:]) - } - v.lines[y][x] = cell{ - fgColor: v.FgColor, - bgColor: v.BgColor, - chr: ch, - } - - for i := 1; i < w; i++ { - v.lines[y][x+i] = cell{ - fgColor: v.FgColor, - bgColor: v.BgColor, - chr: '\x00', - } - } - - return nil -} - -// deleteRune removes a rune from the view's internal buffer, at the -// position corresponding to the point (x, y). -// returns the amount of columns that where removed. -func (v *View) deleteRune(x, y int) (int, error) { - v.tainted = true - - x, y, err := v.realPosition(x, y) - if err != nil { - return 0, err - } - - if x < 0 || y < 0 || y >= len(v.lines) || x >= len(v.lines[y]) { - return 0, errors.New("invalid point") - } - - var tw int - for i := range v.lines[y] { - w := runewidth.RuneWidth(v.lines[y][i].chr) - tw += w - if tw > x { - v.lines[y] = append(v.lines[y][:i], v.lines[y][i+w:]...) - return w, nil - } - - } - - return 0, nil -} - -// mergeLines merges the lines "y" and "y+1" if possible. -func (v *View) mergeLines(y int) error { - v.clearViewLines() - - _, y, err := v.realPosition(0, y) - if err != nil { - return err - } - - if y < 0 || y >= len(v.lines) { - return errors.New("invalid point") - } - - if y < len(v.lines)-1 { // otherwise we don't need to merge anything - v.lines[y] = append(v.lines[y], v.lines[y+1]...) - v.lines = append(v.lines[:y+1], v.lines[y+2:]...) - } - return nil -} - -// breakLine breaks a line of the internal buffer at the position corresponding -// to the point (x, y). -func (v *View) breakLine(x, y int) error { - v.tainted = true - - x, y, err := v.realPosition(x, y) - if err != nil { - return err - } - - if y < 0 || y >= len(v.lines) { - return errors.New("invalid point") - } - - var left, right []cell - if x < len(v.lines[y]) { // break line - left = make([]cell, len(v.lines[y][:x])) - copy(left, v.lines[y][:x]) - right = make([]cell, len(v.lines[y][x:])) - copy(right, v.lines[y][x:]) - } else { // new empty line - left = v.lines[y] - } - - lines := make([][]cell, len(v.lines)+1) - lines[y] = left - lines[y+1] = right - copy(lines, v.lines[:y]) - copy(lines[y+2:], v.lines[y+1:]) - v.lines = lines - return nil + v.RenderTextArea() + + return true } diff --git a/vendor/github.com/jesseduffield/gocui/go.mod b/vendor/github.com/jesseduffield/gocui/go.mod index fbf0fbb23..d7f11d16c 100644 --- a/vendor/github.com/jesseduffield/gocui/go.mod +++ b/vendor/github.com/jesseduffield/gocui/go.mod @@ -3,7 +3,8 @@ module github.com/jesseduffield/gocui go 1.12 require ( - github.com/gdamore/tcell/v2 v2.0.0 + github.com/gdamore/tcell/v2 v2.4.0 github.com/go-errors/errors v1.0.2 - github.com/mattn/go-runewidth v0.0.9 + github.com/mattn/go-runewidth v0.0.10 + github.com/stretchr/testify v1.7.0 ) diff --git a/vendor/github.com/jesseduffield/gocui/go.sum b/vendor/github.com/jesseduffield/gocui/go.sum index 2a892bec7..8ed3f9b35 100644 --- a/vendor/github.com/jesseduffield/gocui/go.sum +++ b/vendor/github.com/jesseduffield/gocui/go.sum @@ -1,15 +1,29 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= -github.com/gdamore/tcell/v2 v2.0.0 h1:GRWG8aLfWAlekj9Q6W29bVvkHENc6hp79XOqG4AWDOs= -github.com/gdamore/tcell/v2 v2.0.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= +github.com/gdamore/tcell/v2 v2.4.0 h1:W6dxJEmaxYvhICFoTY3WrLLEXsQ11SaFnKGVEXW57KM= +github.com/gdamore/tcell/v2 v2.4.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU= github.com/go-errors/errors v1.0.2 h1:xMxH9j2fNg/L4hLn/4y3M0IUsn0M6Wbu/Uh9QlOfBh4= github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs= github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756 h1:9nuHUbU8dRnRRfj9KjWUVrJeoexdbeMjttk6Oh1rD10= -golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg= +github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= +github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M= +golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/vendor/github.com/jesseduffield/gocui/gui.go b/vendor/github.com/jesseduffield/gocui/gui.go index eccae45a3..957a9fe62 100644 --- a/vendor/github.com/jesseduffield/gocui/gui.go +++ b/vendor/github.com/jesseduffield/gocui/gui.go @@ -15,6 +15,7 @@ import ( "github.com/gdamore/tcell/v2" "github.com/go-errors/errors" + "github.com/mattn/go-runewidth" ) // OutputMode represents an output mode, which determines how colors @@ -147,10 +148,6 @@ type Gui struct { // match any known sequence, ESC means KeyEsc. InputEsc bool - // If ASCII is true then use ASCII instead of unicode to draw the - // interface. Using ASCII is more portable. - ASCII bool - // SupportOverlaps is true when we allow for view edges to overlap with other // view edges SupportOverlaps bool @@ -754,9 +751,7 @@ func (g *Gui) clear(fg, bg Attribute) (int, int) { // drawFrameEdges draws the horizontal and vertical edges of a view. func (g *Gui) drawFrameEdges(v *View, fgColor, bgColor Attribute) error { runeH, runeV := '─', '│' - if g.ASCII { - runeH, runeV = '-', '|' - } else if len(v.FrameRunes) >= 2 { + if len(v.FrameRunes) >= 2 { runeH, runeV = v.FrameRunes[0], v.FrameRunes[1] } @@ -882,9 +877,6 @@ func (g *Gui) drawFrameCorners(v *View, fgColor, bgColor Attribute) error { runeBL = corner(v, TOP|RIGHT) runeBR = corner(v, TOP|LEFT) } - if g.ASCII { - runeTL, runeTR, runeBL, runeBR = '+', '+', '+', '+' - } corners := []struct { x, y int @@ -930,8 +922,8 @@ func (g *Gui) drawTitle(v *View, fgColor, bgColor Attribute) error { str := strings.Join(tabs, separator) + x := v.x0 + 2 for i, ch := range str { - x := v.x0 + i + 2 if x < 0 { continue } else if x > v.x1-2 || x >= g.maxX { @@ -957,6 +949,7 @@ func (g *Gui) drawTitle(v *View, fgColor, bgColor Attribute) error { if err := g.SetRune(x, v.y0, ch, currentFgColor, currentBgColor); err != nil { return err } + x += runewidth.RuneWidth(ch) } return nil } @@ -971,14 +964,15 @@ func (g *Gui) drawSubtitle(v *View, fgColor, bgColor Attribute) error { if start < v.x0 { return nil } - for i, ch := range v.Subtitle { - x := start + i + x := start + for _, ch := range v.Subtitle { if x >= v.x1 { break } if err := g.SetRune(x, v.y0, ch, fgColor, bgColor); err != nil { return err } + x += runewidth.RuneWidth(ch) } return nil } @@ -999,14 +993,15 @@ func (g *Gui) drawListFooter(v *View, fgColor, bgColor Attribute) error { if start < v.x0 { return nil } - for i, ch := range message { - x := start + i + x := start + for _, ch := range message { if x >= v.x1 { break } if err := g.SetRune(x, v.y1, ch, fgColor, bgColor); err != nil { return err } + x += runewidth.RuneWidth(ch) } return nil } diff --git a/vendor/github.com/jesseduffield/gocui/tcell_driver.go b/vendor/github.com/jesseduffield/gocui/tcell_driver.go index 8d5045bce..2783103c3 100644 --- a/vendor/github.com/jesseduffield/gocui/tcell_driver.go +++ b/vendor/github.com/jesseduffield/gocui/tcell_driver.go @@ -8,6 +8,7 @@ import ( "time" "github.com/gdamore/tcell/v2" + "github.com/mattn/go-runewidth" ) // We probably don't want this being a global variable for YOLO for now @@ -20,19 +21,50 @@ type oldStyle struct { outputMode OutputMode } +var runeReplacements = map[rune]string{ + '┌': "+", + '┐': "+", + '└': "+", + '┘': "+", + '─': "-", + + // using a hyphen here actually looks weird. + // We see these characters when in portrait mode + '╶': " ", + '╴': " ", + + '├': "+", + '│': "|", + '▼': "v", + '►': ">", + '▲': "^", + '◄': "<", +} + // tcellInit initializes tcell screen for use. func (g *Gui) tcellInit() error { + runewidth.DefaultCondition.EastAsianWidth = false + tcell.SetEncodingFallback(tcell.EncodingFallbackASCII) + if s, e := tcell.NewScreen(); e != nil { return e } else if e = s.Init(); e != nil { return e } else { + registerRuneFallbacks(s) + g.screen = s Screen = s return nil } } +func registerRuneFallbacks(s tcell.Screen) { + for before, after := range runeReplacements { + s.RegisterRuneFallback(before, after) + } +} + // tcellInitSimulation initializes tcell screen for use. func (g *Gui) tcellInitSimulation() error { s := tcell.NewSimulationScreen("") diff --git a/vendor/github.com/jesseduffield/gocui/text_area.go b/vendor/github.com/jesseduffield/gocui/text_area.go new file mode 100644 index 000000000..5c9ae31ea --- /dev/null +++ b/vendor/github.com/jesseduffield/gocui/text_area.go @@ -0,0 +1,209 @@ +package gocui + +import "github.com/mattn/go-runewidth" + +type TextArea struct { + content []rune + cursor int + overwrite bool +} + +func (self *TextArea) TypeRune(r rune) { + if self.overwrite && !self.atEnd() { + self.content[self.cursor] = r + } else { + self.content = append( + self.content[:self.cursor], + append([]rune{r}, self.content[self.cursor:]...)..., + ) + } + + self.cursor++ +} + +func (self *TextArea) BackSpaceChar() { + if self.cursor == 0 { + return + } + + self.content = append(self.content[:self.cursor-1], self.content[self.cursor:]...) + self.cursor-- +} + +func (self *TextArea) DeleteChar() { + if self.atEnd() { + return + } + + self.content = append(self.content[:self.cursor], self.content[self.cursor+1:]...) +} + +func (self *TextArea) MoveCursorLeft() { + if self.cursor == 0 { + return + } + + self.cursor-- +} + +func (self *TextArea) MoveCursorRight() { + if self.cursor == len(self.content) { + return + } + + self.cursor++ +} + +func (self *TextArea) MoveCursorUp() { + x, y := self.GetCursorXY() + self.SetCursor2D(x, y-1) +} + +func (self *TextArea) MoveCursorDown() { + x, y := self.GetCursorXY() + self.SetCursor2D(x, y+1) +} + +func (self *TextArea) GetContent() string { + return string(self.content) +} + +func (self *TextArea) ToggleOverwrite() { + self.overwrite = !self.overwrite +} + +func (self *TextArea) atEnd() bool { + return self.cursor == len(self.content) +} + +func (self *TextArea) DeleteToStartOfLine() { + // copying vim's logic: if you're at the start of the line, you delete the newline + // character and go to the end of the previous line + if self.atLineStart() { + if self.cursor == 0 { + return + } + + self.content = append(self.content[:self.cursor-1], self.content[self.cursor:]...) + self.cursor-- + return + } + + // otherwise, you delete everything up to the start of the current line, without + // deleting the newline character + newlineIndex := self.closestNewlineOnLeft() + self.content = append(self.content[:newlineIndex+1], self.content[self.cursor:]...) + self.cursor = newlineIndex + 1 +} + +func (self *TextArea) GoToStartOfLine() { + if self.atLineStart() { + return + } + + // otherwise, you delete everything up to the start of the current line, without + // deleting the newline character + newlineIndex := self.closestNewlineOnLeft() + self.cursor = newlineIndex + 1 +} + +func (self *TextArea) closestNewlineOnLeft() int { + newlineIndex := -1 + + for i, r := range self.content[0:self.cursor] { + if r == '\n' { + newlineIndex = i + } + } + + return newlineIndex +} + +func (self *TextArea) GoToEndOfLine() { + if self.atEnd() { + return + } + + self.cursor = self.closestNewlineOnRight() +} + +func (self *TextArea) closestNewlineOnRight() int { + for i, r := range self.content[self.cursor:] { + if r == '\n' { + return self.cursor + i + } + } + + return len(self.content) +} + +func (self *TextArea) atLineStart() bool { + return self.cursor == 0 || + (len(self.content) > self.cursor-1 && self.content[self.cursor-1] == '\n') +} + +func (self *TextArea) GetCursorXY() (int, int) { + cursorX := 0 + cursorY := 0 + for _, r := range self.content[0:self.cursor] { + if r == '\n' { + cursorY++ + cursorX = 0 + } else { + chWidth := runewidth.RuneWidth(r) + cursorX += chWidth + } + } + + return cursorX, cursorY +} + +// takes an x,y position and maps it to a 1D cursor position +func (self *TextArea) SetCursor2D(x int, y int) { + if y < 0 { + y = 0 + } + if x < 0 { + x = 0 + } + + newCursor := 0 + for _, r := range self.content { + if x <= 0 && y == 0 { + self.cursor = newCursor + return + } + + if r == '\n' { + if y == 0 { + self.cursor = newCursor + return + } + y-- + } else if y == 0 { + chWidth := runewidth.RuneWidth(r) + x -= chWidth + } + + newCursor++ + } + + // if we weren't able to run-down our arg, the user is trying to move out of + // bounds so we'll just return + if y > 0 { + return + } + + self.cursor = newCursor +} + +func (self *TextArea) Clear() { + self.content = []rune{} + self.cursor = 0 +} + +func (self *TextArea) TypeString(str string) { + for _, r := range str { + self.TypeRune(r) + } +} diff --git a/vendor/github.com/jesseduffield/gocui/view.go b/vendor/github.com/jesseduffield/gocui/view.go index f4b13cb2c..11e0e6d70 100644 --- a/vendor/github.com/jesseduffield/gocui/view.go +++ b/vendor/github.com/jesseduffield/gocui/view.go @@ -6,6 +6,7 @@ package gocui import ( "bytes" + "fmt" "io" "strings" "sync" @@ -158,6 +159,8 @@ type View struct { // KeybindOnEdit should be set to true when you want to execute keybindings even when the view is editable // (this is usually not the case) KeybindOnEdit bool + + TextArea *TextArea } // call this in the event of a view resize, or if you want to render new content @@ -340,6 +343,7 @@ func newView(name string, x0, y0, x1, y1 int, mode OutputMode) *View { outMode: mode, ei: newEscapeInterpreter(mode), searcher: &searcher{}, + TextArea: &TextArea{}, } v.FgColor, v.BgColor = ColorDefault, ColorDefault @@ -1119,3 +1123,49 @@ func (v *View) SelectedPoint() (int, int) { ox, oy := v.Origin() return cx + ox, cy + oy } + +func (v *View) RenderTextArea() { + v.Clear() + fmt.Fprint(v, v.TextArea.GetContent()) + cursorX, cursorY := v.TextArea.GetCursorXY() + prevOriginX, prevOriginY := v.Origin() + width, height := v.Size() + + frameAdjustment := 0 + if v.Frame { + frameAdjustment = -1 + } + newViewCursorX, newOriginX := updatedCursorAndOrigin(prevOriginX, width+frameAdjustment, cursorX) + newViewCursorY, newOriginY := updatedCursorAndOrigin(prevOriginY, height+frameAdjustment, cursorY) + + _ = v.SetCursor(newViewCursorX, newViewCursorY) + _ = v.SetOrigin(newOriginX, newOriginY) +} + +func updatedCursorAndOrigin(prevOrigin int, size int, cursor int) (int, int) { + var newViewCursor int + newOrigin := prevOrigin + + if cursor > prevOrigin+size { + newOrigin = cursor - size + newViewCursor = size + } else if cursor < prevOrigin { + newOrigin = cursor + newViewCursor = 0 + } else { + newViewCursor = cursor - prevOrigin + } + + return newViewCursor, newOrigin +} + +func (v *View) ClearTextArea() { + v.Clear() + + v.writeMutex.Lock() + defer v.writeMutex.Unlock() + + v.TextArea.Clear() + _ = v.SetOrigin(0, 0) + _ = v.SetCursor(0, 0) +} diff --git a/vendor/github.com/jesseduffield/minimal/gitignore/LICENSE b/vendor/github.com/jesseduffield/minimal/gitignore/LICENSE new file mode 100644 index 000000000..56f5e365e --- /dev/null +++ b/vendor/github.com/jesseduffield/minimal/gitignore/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2018, iriri +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the copyright holder nor the names of contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/jesseduffield/minimal/gitignore/gitignore.go b/vendor/github.com/jesseduffield/minimal/gitignore/gitignore.go new file mode 100644 index 000000000..740f77d51 --- /dev/null +++ b/vendor/github.com/jesseduffield/minimal/gitignore/gitignore.go @@ -0,0 +1,313 @@ +// Copyright 2018 iriri. All rights reserved. Use of this source code is +// governed by a BSD-style license which can be found in the LICENSE file. + +// Package gitignore can be used to parse .gitignore-style files into lists of +// globs that can be used to test against paths or selectively walk a file +// tree. Gobwas's glob package is used for matching because it is faster than +// using regexp, which is overkill, and supports globstars (**), unlike +// filepath.Match. +package gitignore + +import ( + "bufio" + "errors" + "os" + "os/user" + "path/filepath" + "strings" + + "github.com/gobwas/glob" +) + +type ignoreFile struct { + globs []glob.Glob + abspath []string +} + +type IgnoreList struct { + files []ignoreFile + cwd []string +} + +func toSplit(path string) []string { + return strings.Split(filepath.ToSlash(path), "/") +} + +func fromSplit(path []string) string { + return filepath.FromSlash(strings.Join(path, "/")) +} + +// New creates a new ignore list. +func New() (IgnoreList, error) { + cwd, err := filepath.Abs(".") + if err != nil { + return IgnoreList{}, err + } + files := make([]ignoreFile, 1, 4) + files[0].globs = make([]glob.Glob, 0, 16) + return IgnoreList{ + files, + toSplit(cwd), + }, nil +} + +// From creates a new ignore list and populates the first entry with the +// contents of the specified file. +func From(path string) (IgnoreList, error) { + ign, err := New() + if err == nil { + err = ign.append(path, nil) + } + return ign, err +} + +// FromGit finds the root directory of the current git repository and creates a +// new ignore list with the contents of all .gitignore files in that git +// repository. +func FromGit() (IgnoreList, error) { + ign, err := New() + if err == nil { + err = ign.AppendGit() + } + return ign, err +} + +func clean(s string) string { + i := len(s) - 1 + for ; i >= 0; i-- { + if s[i] != ' ' || i > 0 && s[i-1] == '\\' { + return s[:i+1] + } + } + return "" +} + +// AppendGlob appends a single glob as a new entry in the ignore list. The root +// (relevant for matching patterns that begin with "/") is assumed to be the +// current working directory. +func (ign *IgnoreList) AppendGlob(s string) error { + g, err := glob.Compile(clean(s), '/') + if err == nil { + ign.files[0].globs = append(ign.files[0].globs, g) + } + return err +} + +func toRelpath(s string, dir, cwd []string) string { + if s != "" { + if s[0] != '/' { + return s + } + if dir == nil || cwd == nil { + return s[1:] + } + dir = append(dir, toSplit(s[1:])...) + } + + i := 0 + min := len(cwd) + if len(dir) < min { + min = len(dir) + } + for ; i < min; i++ { + if dir[i] != cwd[i] { + break + } + } + if i == min && len(cwd) == len(dir) { + return "." + } + + ss := make([]string, (len(cwd)-i)+(len(dir)-i)) + j := 0 + for ; j < len(cwd)-i; j++ { + ss[j] = ".." + } + for k := 0; j < len(ss); j, k = j+1, k+1 { + ss[j] = dir[i+k] + } + return fromSplit(ss) +} + +func (ign *IgnoreList) append(path string, dir []string) error { + f, err := os.Open(path) + if err != nil { + return err + } + defer f.Close() + + var ignf *ignoreFile + if dir != nil { + ignf = &ign.files[0] + } else { + d, err := filepath.Abs(filepath.Dir(path)) + if err != nil { + return err + } + if d != fromSplit(ign.cwd) { + dir = toSplit(d) + ignf = &ignoreFile{ + make([]glob.Glob, 0, 16), + dir, + } + } else { + ignf = &ign.files[0] + } + } + scn := bufio.NewScanner(bufio.NewReader(f)) + for scn.Scan() { + s := scn.Text() + if s == "" || s[0] == '#' { + continue + } + g, err := glob.Compile(toRelpath(clean(s), dir, ign.cwd), '/') + if err != nil { + return err + } + ignf.globs = append(ignf.globs, g) + } + ign.files = append(ign.files, *ignf) + return nil +} + +// Append appends the globs in the specified file to the ignore list. Files are +// expected to have the same format as .gitignore files. +func (ign *IgnoreList) Append(path string) error { + return ign.append(path, nil) +} + +func exists(path string) bool { + _, err := os.Stat(path) + return !os.IsNotExist(err) +} + +func findGitRoot(cwd []string) (string, error) { + p := fromSplit(cwd) + for !exists(p + "/.git") { + if len(cwd) == 1 { + return "", errors.New("not in a git repository") + } + cwd = cwd[:len(cwd)-1] + p = fromSplit(cwd) + } + return p, nil +} + +func (ign *IgnoreList) appendAll(fname, root string) error { + return filepath.Walk( + root, + func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if filepath.Base(path) == fname { + ign.append(path, nil) + } + return nil + }) +} + +// AppendGit finds the root directory of the current git repository and appends +// the contents of all .gitignore files in that git repository to the ignore +// list. +func (ign *IgnoreList) AppendGit() error { + gitRoot, err := findGitRoot(ign.cwd) + if err != nil { + return err + } + if err = ign.AppendGlob(".git"); err != nil { + return err + } + usr, err := user.Current() + if err != nil { + return err + } + if gg := filepath.Join(usr.HomeDir, ".gitignore_global"); exists(gg) { + if err = ign.append(gg, toSplit(gitRoot)); err != nil { + return err + } + } + return ign.appendAll(".gitignore", gitRoot) +} + +func isPrefix(abspath, dir []string) bool { + if len(abspath) > len(dir) { + return false + } + for i := range abspath { + if abspath[i] != dir[i] { + return false + } + } + return true +} + +func (ign *IgnoreList) match(path string, info os.FileInfo) bool { + if path == "." { + return false + } + ss := make([]string, 0, 4) + base := filepath.Base(path) + ss = append(ss, path) + if base != path { + ss = append(ss, base) + } else { + ss = append(ss, "./"+path) + } + if info != nil && info.IsDir() { + ss = append(ss, path+"/") + if base != path { + ss = append(ss, base+"/") + } else { + ss = append(ss, "./"+path+"/") + } + } + + d, err := filepath.Abs(filepath.Dir(path)) + if err != nil { + return false + } + dir := toSplit(d) + for _, f := range ign.files { + if isPrefix(f.abspath, dir) || len(f.abspath) == 0 { + for _, g := range f.globs { + for _, s := range ss { + if g.Match(s) { + return true + } + } + } + } + } + return false +} + +// Match returns whether any of the globs in the ignore list match the +// specified path. Uses the same matching rules as .gitignore files. +func (ign *IgnoreList) Match(path string) bool { + return ign.match(path, nil) +} + +// Walk walks the file tree with the specified root and calls fn on each file +// or directory. Files and directories that match any of the globs in the +// ignore list are skipped. +func (ign *IgnoreList) Walk(root string, fn filepath.WalkFunc) error { + abs, err := filepath.Abs(root) + if err != nil { + return err + } + return filepath.Walk( + toRelpath("", toSplit(abs), ign.cwd), + func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if ign.match(path, info) { + if info.IsDir() { + return filepath.SkipDir + } + return err + } + return fn(path, info, err) + }) +} diff --git a/vendor/github.com/jesseduffield/minimal/gitignore/go.mod b/vendor/github.com/jesseduffield/minimal/gitignore/go.mod new file mode 100644 index 000000000..0137e6b0f --- /dev/null +++ b/vendor/github.com/jesseduffield/minimal/gitignore/go.mod @@ -0,0 +1,5 @@ +module github.com/jesseduffield/minimal/gitignore + +go 1.15 + +require github.com/gobwas/glob v0.2.3 diff --git a/vendor/github.com/jesseduffield/minimal/gitignore/go.sum b/vendor/github.com/jesseduffield/minimal/gitignore/go.sum new file mode 100644 index 000000000..39fa9fa07 --- /dev/null +++ b/vendor/github.com/jesseduffield/minimal/gitignore/go.sum @@ -0,0 +1,2 @@ +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= diff --git a/vendor/github.com/jesseduffield/minimal/gitignore/testgitignore b/vendor/github.com/jesseduffield/minimal/gitignore/testgitignore new file mode 100644 index 000000000..b01e8daa4 --- /dev/null +++ b/vendor/github.com/jesseduffield/minimal/gitignore/testgitignore @@ -0,0 +1,10 @@ +testgitignore +*.o + +*.out* +#*.ou +aa +bbb +ccc/ +**/Makefile +/testfs/ignoredfile* diff --git a/vendor/github.com/stretchr/testify/LICENSE b/vendor/github.com/stretchr/testify/LICENSE index f38ec5956..4b0421cf9 100644 --- a/vendor/github.com/stretchr/testify/LICENSE +++ b/vendor/github.com/stretchr/testify/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2012-2018 Mat Ryer and Tyler Bunnell +Copyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/github.com/stretchr/testify/assert/assertion_compare.go b/vendor/github.com/stretchr/testify/assert/assertion_compare.go new file mode 100644 index 000000000..41649d267 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertion_compare.go @@ -0,0 +1,394 @@ +package assert + +import ( + "fmt" + "reflect" +) + +type CompareType int + +const ( + compareLess CompareType = iota - 1 + compareEqual + compareGreater +) + +var ( + intType = reflect.TypeOf(int(1)) + int8Type = reflect.TypeOf(int8(1)) + int16Type = reflect.TypeOf(int16(1)) + int32Type = reflect.TypeOf(int32(1)) + int64Type = reflect.TypeOf(int64(1)) + + uintType = reflect.TypeOf(uint(1)) + uint8Type = reflect.TypeOf(uint8(1)) + uint16Type = reflect.TypeOf(uint16(1)) + uint32Type = reflect.TypeOf(uint32(1)) + uint64Type = reflect.TypeOf(uint64(1)) + + float32Type = reflect.TypeOf(float32(1)) + float64Type = reflect.TypeOf(float64(1)) + + stringType = reflect.TypeOf("") +) + +func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) { + obj1Value := reflect.ValueOf(obj1) + obj2Value := reflect.ValueOf(obj2) + + // throughout this switch we try and avoid calling .Convert() if possible, + // as this has a pretty big performance impact + switch kind { + case reflect.Int: + { + intobj1, ok := obj1.(int) + if !ok { + intobj1 = obj1Value.Convert(intType).Interface().(int) + } + intobj2, ok := obj2.(int) + if !ok { + intobj2 = obj2Value.Convert(intType).Interface().(int) + } + if intobj1 > intobj2 { + return compareGreater, true + } + if intobj1 == intobj2 { + return compareEqual, true + } + if intobj1 < intobj2 { + return compareLess, true + } + } + case reflect.Int8: + { + int8obj1, ok := obj1.(int8) + if !ok { + int8obj1 = obj1Value.Convert(int8Type).Interface().(int8) + } + int8obj2, ok := obj2.(int8) + if !ok { + int8obj2 = obj2Value.Convert(int8Type).Interface().(int8) + } + if int8obj1 > int8obj2 { + return compareGreater, true + } + if int8obj1 == int8obj2 { + return compareEqual, true + } + if int8obj1 < int8obj2 { + return compareLess, true + } + } + case reflect.Int16: + { + int16obj1, ok := obj1.(int16) + if !ok { + int16obj1 = obj1Value.Convert(int16Type).Interface().(int16) + } + int16obj2, ok := obj2.(int16) + if !ok { + int16obj2 = obj2Value.Convert(int16Type).Interface().(int16) + } + if int16obj1 > int16obj2 { + return compareGreater, true + } + if int16obj1 == int16obj2 { + return compareEqual, true + } + if int16obj1 < int16obj2 { + return compareLess, true + } + } + case reflect.Int32: + { + int32obj1, ok := obj1.(int32) + if !ok { + int32obj1 = obj1Value.Convert(int32Type).Interface().(int32) + } + int32obj2, ok := obj2.(int32) + if !ok { + int32obj2 = obj2Value.Convert(int32Type).Interface().(int32) + } + if int32obj1 > int32obj2 { + return compareGreater, true + } + if int32obj1 == int32obj2 { + return compareEqual, true + } + if int32obj1 < int32obj2 { + return compareLess, true + } + } + case reflect.Int64: + { + int64obj1, ok := obj1.(int64) + if !ok { + int64obj1 = obj1Value.Convert(int64Type).Interface().(int64) + } + int64obj2, ok := obj2.(int64) + if !ok { + int64obj2 = obj2Value.Convert(int64Type).Interface().(int64) + } + if int64obj1 > int64obj2 { + return compareGreater, true + } + if int64obj1 == int64obj2 { + return compareEqual, true + } + if int64obj1 < int64obj2 { + return compareLess, true + } + } + case reflect.Uint: + { + uintobj1, ok := obj1.(uint) + if !ok { + uintobj1 = obj1Value.Convert(uintType).Interface().(uint) + } + uintobj2, ok := obj2.(uint) + if !ok { + uintobj2 = obj2Value.Convert(uintType).Interface().(uint) + } + if uintobj1 > uintobj2 { + return compareGreater, true + } + if uintobj1 == uintobj2 { + return compareEqual, true + } + if uintobj1 < uintobj2 { + return compareLess, true + } + } + case reflect.Uint8: + { + uint8obj1, ok := obj1.(uint8) + if !ok { + uint8obj1 = obj1Value.Convert(uint8Type).Interface().(uint8) + } + uint8obj2, ok := obj2.(uint8) + if !ok { + uint8obj2 = obj2Value.Convert(uint8Type).Interface().(uint8) + } + if uint8obj1 > uint8obj2 { + return compareGreater, true + } + if uint8obj1 == uint8obj2 { + return compareEqual, true + } + if uint8obj1 < uint8obj2 { + return compareLess, true + } + } + case reflect.Uint16: + { + uint16obj1, ok := obj1.(uint16) + if !ok { + uint16obj1 = obj1Value.Convert(uint16Type).Interface().(uint16) + } + uint16obj2, ok := obj2.(uint16) + if !ok { + uint16obj2 = obj2Value.Convert(uint16Type).Interface().(uint16) + } + if uint16obj1 > uint16obj2 { + return compareGreater, true + } + if uint16obj1 == uint16obj2 { + return compareEqual, true + } + if uint16obj1 < uint16obj2 { + return compareLess, true + } + } + case reflect.Uint32: + { + uint32obj1, ok := obj1.(uint32) + if !ok { + uint32obj1 = obj1Value.Convert(uint32Type).Interface().(uint32) + } + uint32obj2, ok := obj2.(uint32) + if !ok { + uint32obj2 = obj2Value.Convert(uint32Type).Interface().(uint32) + } + if uint32obj1 > uint32obj2 { + return compareGreater, true + } + if uint32obj1 == uint32obj2 { + return compareEqual, true + } + if uint32obj1 < uint32obj2 { + return compareLess, true + } + } + case reflect.Uint64: + { + uint64obj1, ok := obj1.(uint64) + if !ok { + uint64obj1 = obj1Value.Convert(uint64Type).Interface().(uint64) + } + uint64obj2, ok := obj2.(uint64) + if !ok { + uint64obj2 = obj2Value.Convert(uint64Type).Interface().(uint64) + } + if uint64obj1 > uint64obj2 { + return compareGreater, true + } + if uint64obj1 == uint64obj2 { + return compareEqual, true + } + if uint64obj1 < uint64obj2 { + return compareLess, true + } + } + case reflect.Float32: + { + float32obj1, ok := obj1.(float32) + if !ok { + float32obj1 = obj1Value.Convert(float32Type).Interface().(float32) + } + float32obj2, ok := obj2.(float32) + if !ok { + float32obj2 = obj2Value.Convert(float32Type).Interface().(float32) + } + if float32obj1 > float32obj2 { + return compareGreater, true + } + if float32obj1 == float32obj2 { + return compareEqual, true + } + if float32obj1 < float32obj2 { + return compareLess, true + } + } + case reflect.Float64: + { + float64obj1, ok := obj1.(float64) + if !ok { + float64obj1 = obj1Value.Convert(float64Type).Interface().(float64) + } + float64obj2, ok := obj2.(float64) + if !ok { + float64obj2 = obj2Value.Convert(float64Type).Interface().(float64) + } + if float64obj1 > float64obj2 { + return compareGreater, true + } + if float64obj1 == float64obj2 { + return compareEqual, true + } + if float64obj1 < float64obj2 { + return compareLess, true + } + } + case reflect.String: + { + stringobj1, ok := obj1.(string) + if !ok { + stringobj1 = obj1Value.Convert(stringType).Interface().(string) + } + stringobj2, ok := obj2.(string) + if !ok { + stringobj2 = obj2Value.Convert(stringType).Interface().(string) + } + if stringobj1 > stringobj2 { + return compareGreater, true + } + if stringobj1 == stringobj2 { + return compareEqual, true + } + if stringobj1 < stringobj2 { + return compareLess, true + } + } + } + + return compareEqual, false +} + +// Greater asserts that the first element is greater than the second +// +// assert.Greater(t, 2, 1) +// assert.Greater(t, float64(2), float64(1)) +// assert.Greater(t, "b", "a") +func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { + return compareTwoValues(t, e1, e2, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs) +} + +// GreaterOrEqual asserts that the first element is greater than or equal to the second +// +// assert.GreaterOrEqual(t, 2, 1) +// assert.GreaterOrEqual(t, 2, 2) +// assert.GreaterOrEqual(t, "b", "a") +// assert.GreaterOrEqual(t, "b", "b") +func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { + return compareTwoValues(t, e1, e2, []CompareType{compareGreater, compareEqual}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs) +} + +// Less asserts that the first element is less than the second +// +// assert.Less(t, 1, 2) +// assert.Less(t, float64(1), float64(2)) +// assert.Less(t, "a", "b") +func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { + return compareTwoValues(t, e1, e2, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs) +} + +// LessOrEqual asserts that the first element is less than or equal to the second +// +// assert.LessOrEqual(t, 1, 2) +// assert.LessOrEqual(t, 2, 2) +// assert.LessOrEqual(t, "a", "b") +// assert.LessOrEqual(t, "b", "b") +func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { + return compareTwoValues(t, e1, e2, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs) +} + +// Positive asserts that the specified element is positive +// +// assert.Positive(t, 1) +// assert.Positive(t, 1.23) +func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { + zero := reflect.Zero(reflect.TypeOf(e)) + return compareTwoValues(t, e, zero.Interface(), []CompareType{compareGreater}, "\"%v\" is not positive", msgAndArgs) +} + +// Negative asserts that the specified element is negative +// +// assert.Negative(t, -1) +// assert.Negative(t, -1.23) +func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { + zero := reflect.Zero(reflect.TypeOf(e)) + return compareTwoValues(t, e, zero.Interface(), []CompareType{compareLess}, "\"%v\" is not negative", msgAndArgs) +} + +func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + e1Kind := reflect.ValueOf(e1).Kind() + e2Kind := reflect.ValueOf(e2).Kind() + if e1Kind != e2Kind { + return Fail(t, "Elements should be the same type", msgAndArgs...) + } + + compareResult, isComparable := compare(e1, e2, e1Kind) + if !isComparable { + return Fail(t, fmt.Sprintf("Can not compare type \"%s\"", reflect.TypeOf(e1)), msgAndArgs...) + } + + if !containsValue(allowedComparesResults, compareResult) { + return Fail(t, fmt.Sprintf(failMessage, e1, e2), msgAndArgs...) + } + + return true +} + +func containsValue(values []CompareType, value CompareType) bool { + for _, v := range values { + if v == value { + return true + } + } + + return false +} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go b/vendor/github.com/stretchr/testify/assert/assertion_format.go index e0364e9e7..4dfd1229a 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_format.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_format.go @@ -32,7 +32,8 @@ func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args return Contains(t, s, contains, append([]interface{}{msg}, args...)...) } -// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists. +// DirExistsf checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -92,7 +93,7 @@ func EqualErrorf(t TestingT, theError error, errString string, msg string, args // EqualValuesf asserts that two objects are equal or convertable to the same types // and equal. // -// assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123)) +// assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted") func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -113,6 +114,24 @@ func Errorf(t TestingT, err error, msg string, args ...interface{}) bool { return Error(t, err, append([]interface{}{msg}, args...)...) } +// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return ErrorAs(t, err, target, append([]interface{}{msg}, args...)...) +} + +// ErrorIsf asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return ErrorIs(t, err, target, append([]interface{}{msg}, args...)...) +} + // Eventuallyf asserts that given condition will be met in waitFor time, // periodically checking target function each tick. // @@ -126,7 +145,7 @@ func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick // Exactlyf asserts that two objects are equal in value and type. // -// assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123)) +// assert.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted") func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -160,7 +179,8 @@ func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool { return False(t, value, append([]interface{}{msg}, args...)...) } -// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file. +// FileExistsf checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -171,7 +191,7 @@ func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool // Greaterf asserts that the first element is greater than the second // // assert.Greaterf(t, 2, 1, "error message %s", "formatted") -// assert.Greaterf(t, float64(2, "error message %s", "formatted"), float64(1)) +// assert.Greaterf(t, float64(2), float64(1), "error message %s", "formatted") // assert.Greaterf(t, "b", "a", "error message %s", "formatted") func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { @@ -223,7 +243,7 @@ func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, u // // assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} // -// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false). +// Returns whether the assertion was successful (true) or not (false). func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -235,7 +255,7 @@ func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, // // assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} // -// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false). +// Returns whether the assertion was successful (true) or not (false). func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -243,6 +263,18 @@ func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url stri return HTTPRedirect(t, handler, method, url, values, append([]interface{}{msg}, args...)...) } +// HTTPStatusCodef asserts that a specified handler returns a specified status code. +// +// assert.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return HTTPStatusCode(t, handler, method, url, values, statuscode, append([]interface{}{msg}, args...)...) +} + // HTTPSuccessf asserts that a specified handler returns a success status code. // // assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted") @@ -257,7 +289,7 @@ func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url strin // Implementsf asserts that an object is implemented by the specified interface. // -// assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject)) +// assert.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -267,7 +299,7 @@ func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, ms // InDeltaf asserts that the two numerals are within delta of each other. // -// assert.InDeltaf(t, math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01) +// assert.InDeltaf(t, math.Pi, 22/7.0, 0.01, "error message %s", "formatted") func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -307,6 +339,54 @@ func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsil return InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...) } +// IsDecreasingf asserts that the collection is decreasing +// +// assert.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted") +// assert.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted") +// assert.IsDecreasingf(t, []string{"b", "a"}, "error message %s", "formatted") +func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return IsDecreasing(t, object, append([]interface{}{msg}, args...)...) +} + +// IsIncreasingf asserts that the collection is increasing +// +// assert.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted") +// assert.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted") +// assert.IsIncreasingf(t, []string{"a", "b"}, "error message %s", "formatted") +func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return IsIncreasing(t, object, append([]interface{}{msg}, args...)...) +} + +// IsNonDecreasingf asserts that the collection is not decreasing +// +// assert.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted") +// assert.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted") +// assert.IsNonDecreasingf(t, []string{"a", "b"}, "error message %s", "formatted") +func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return IsNonDecreasing(t, object, append([]interface{}{msg}, args...)...) +} + +// IsNonIncreasingf asserts that the collection is not increasing +// +// assert.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted") +// assert.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted") +// assert.IsNonIncreasingf(t, []string{"b", "a"}, "error message %s", "formatted") +func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return IsNonIncreasing(t, object, append([]interface{}{msg}, args...)...) +} + // IsTypef asserts that the specified objects are of the same type. func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { @@ -325,14 +405,6 @@ func JSONEqf(t TestingT, expected string, actual string, msg string, args ...int return JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...) } -// YAMLEqf asserts that two YAML strings are equivalent. -func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return YAMLEq(t, expected, actual, append([]interface{}{msg}, args...)...) -} - // Lenf asserts that the specified object has specific length. // Lenf also fails if the object has a type that len() not accept. // @@ -347,7 +419,7 @@ func Lenf(t TestingT, object interface{}, length int, msg string, args ...interf // Lessf asserts that the first element is less than the second // // assert.Lessf(t, 1, 2, "error message %s", "formatted") -// assert.Lessf(t, float64(1, "error message %s", "formatted"), float64(2)) +// assert.Lessf(t, float64(1), float64(2), "error message %s", "formatted") // assert.Lessf(t, "a", "b", "error message %s", "formatted") func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { @@ -369,6 +441,28 @@ func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args . return LessOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...) } +// Negativef asserts that the specified element is negative +// +// assert.Negativef(t, -1, "error message %s", "formatted") +// assert.Negativef(t, -1.23, "error message %s", "formatted") +func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Negative(t, e, append([]interface{}{msg}, args...)...) +} + +// Neverf asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// assert.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") +func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Never(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...) +} + // Nilf asserts that the specified object is nil. // // assert.Nilf(t, err, "error message %s", "formatted") @@ -379,6 +473,15 @@ func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool return Nil(t, object, append([]interface{}{msg}, args...)...) } +// NoDirExistsf checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NoDirExists(t, path, append([]interface{}{msg}, args...)...) +} + // NoErrorf asserts that a function returned no error (i.e. `nil`). // // actualObj, err := SomeFunction() @@ -392,6 +495,15 @@ func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool { return NoError(t, err, append([]interface{}{msg}, args...)...) } +// NoFileExistsf checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NoFileExists(t, path, append([]interface{}{msg}, args...)...) +} + // NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the // specified substring or element. // @@ -431,6 +543,25 @@ func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, return NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...) } +// NotEqualValuesf asserts that two objects are not equal even when converted to the same type +// +// assert.NotEqualValuesf(t, obj1, obj2, "error message %s", "formatted") +func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotEqualValues(t, expected, actual, append([]interface{}{msg}, args...)...) +} + +// NotErrorIsf asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotErrorIs(t, err, target, append([]interface{}{msg}, args...)...) +} + // NotNilf asserts that the specified object is not nil. // // assert.NotNilf(t, err, "error message %s", "formatted") @@ -453,7 +584,7 @@ func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bo // NotRegexpf asserts that a specified regexp does not match a string. // -// assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting") +// assert.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted") // assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted") func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { @@ -462,6 +593,19 @@ func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args .. return NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...) } +// NotSamef asserts that two pointers do not reference the same object. +// +// assert.NotSamef(t, ptr1, ptr2, "error message %s", "formatted") +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotSame(t, expected, actual, append([]interface{}{msg}, args...)...) +} + // NotSubsetf asserts that the specified list(array, slice...) contains not all // elements given in the specified subset(array, slice...). // @@ -491,6 +635,18 @@ func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool return Panics(t, f, append([]interface{}{msg}, args...)...) } +// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// assert.PanicsWithErrorf(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") +func PanicsWithErrorf(t TestingT, errString string, f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return PanicsWithError(t, errString, f, append([]interface{}{msg}, args...)...) +} + // PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that // the recovered panic value equals the expected panic value. // @@ -502,9 +658,20 @@ func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg str return PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...) } +// Positivef asserts that the specified element is positive +// +// assert.Positivef(t, 1, "error message %s", "formatted") +// assert.Positivef(t, 1.23, "error message %s", "formatted") +func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Positive(t, e, append([]interface{}{msg}, args...)...) +} + // Regexpf asserts that a specified regexp matches a string. // -// assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting") +// assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted") // assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted") func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { @@ -557,6 +724,14 @@ func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta tim return WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...) } +// YAMLEqf asserts that two YAML strings are equivalent. +func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return YAMLEq(t, expected, actual, append([]interface{}{msg}, args...)...) +} + // Zerof asserts that i is the zero value for its type. func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go index 26830403a..25337a6f0 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go @@ -53,7 +53,8 @@ func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, return Containsf(a.t, s, contains, msg, args...) } -// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists. +// DirExists checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -61,7 +62,8 @@ func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool { return DirExists(a.t, path, msgAndArgs...) } -// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists. +// DirExistsf checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -167,7 +169,7 @@ func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAn // EqualValuesf asserts that two objects are equal or convertable to the same types // and equal. // -// a.EqualValuesf(uint32(123, "error message %s", "formatted"), int32(123)) +// a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted") func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -202,6 +204,42 @@ func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool { return Error(a.t, err, msgAndArgs...) } +// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func (a *Assertions) ErrorAs(err error, target interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return ErrorAs(a.t, err, target, msgAndArgs...) +} + +// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return ErrorAsf(a.t, err, target, msg, args...) +} + +// ErrorIs asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return ErrorIs(a.t, err, target, msgAndArgs...) +} + +// ErrorIsf asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return ErrorIsf(a.t, err, target, msg, args...) +} + // Errorf asserts that a function returned an error (i.e. not `nil`). // // actualObj, err := SomeFunction() @@ -249,7 +287,7 @@ func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArg // Exactlyf asserts that two objects are equal in value and type. // -// a.Exactlyf(int32(123, "error message %s", "formatted"), int64(123)) +// a.Exactlyf(int32(123), int64(123), "error message %s", "formatted") func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -309,7 +347,8 @@ func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool { return Falsef(a.t, value, msg, args...) } -// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file. +// FileExists checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -317,7 +356,8 @@ func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool { return FileExists(a.t, path, msgAndArgs...) } -// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file. +// FileExistsf checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -366,7 +406,7 @@ func (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string, // Greaterf asserts that the first element is greater than the second // // a.Greaterf(2, 1, "error message %s", "formatted") -// a.Greaterf(float64(2, "error message %s", "formatted"), float64(1)) +// a.Greaterf(float64(2), float64(1), "error message %s", "formatted") // a.Greaterf("b", "a", "error message %s", "formatted") func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { @@ -443,7 +483,7 @@ func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url stri // // a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} // -// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false). +// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -467,7 +507,7 @@ func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url s // // a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} // -// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false). +// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -475,6 +515,30 @@ func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url return HTTPRedirectf(a.t, handler, method, url, values, msg, args...) } +// HTTPStatusCode asserts that a specified handler returns a specified status code. +// +// a.HTTPStatusCode(myHandler, "GET", "/notImplemented", nil, 501) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return HTTPStatusCode(a.t, handler, method, url, values, statuscode, msgAndArgs...) +} + +// HTTPStatusCodef asserts that a specified handler returns a specified status code. +// +// a.HTTPStatusCodef(myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPStatusCodef(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return HTTPStatusCodef(a.t, handler, method, url, values, statuscode, msg, args...) +} + // HTTPSuccess asserts that a specified handler returns a success status code. // // a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil) @@ -511,7 +575,7 @@ func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, // Implementsf asserts that an object is implemented by the specified interface. // -// a.Implementsf((*MyInterface, "error message %s", "formatted")(nil), new(MyObject)) +// a.Implementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted") func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -521,7 +585,7 @@ func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{} // InDelta asserts that the two numerals are within delta of each other. // -// a.InDelta(math.Pi, (22 / 7.0), 0.01) +// a.InDelta(math.Pi, 22/7.0, 0.01) func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -563,7 +627,7 @@ func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, del // InDeltaf asserts that the two numerals are within delta of each other. // -// a.InDeltaf(math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01) +// a.InDeltaf(math.Pi, 22/7.0, 0.01, "error message %s", "formatted") func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -603,6 +667,102 @@ func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilo return InEpsilonf(a.t, expected, actual, epsilon, msg, args...) } +// IsDecreasing asserts that the collection is decreasing +// +// a.IsDecreasing([]int{2, 1, 0}) +// a.IsDecreasing([]float{2, 1}) +// a.IsDecreasing([]string{"b", "a"}) +func (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsDecreasing(a.t, object, msgAndArgs...) +} + +// IsDecreasingf asserts that the collection is decreasing +// +// a.IsDecreasingf([]int{2, 1, 0}, "error message %s", "formatted") +// a.IsDecreasingf([]float{2, 1}, "error message %s", "formatted") +// a.IsDecreasingf([]string{"b", "a"}, "error message %s", "formatted") +func (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsDecreasingf(a.t, object, msg, args...) +} + +// IsIncreasing asserts that the collection is increasing +// +// a.IsIncreasing([]int{1, 2, 3}) +// a.IsIncreasing([]float{1, 2}) +// a.IsIncreasing([]string{"a", "b"}) +func (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsIncreasing(a.t, object, msgAndArgs...) +} + +// IsIncreasingf asserts that the collection is increasing +// +// a.IsIncreasingf([]int{1, 2, 3}, "error message %s", "formatted") +// a.IsIncreasingf([]float{1, 2}, "error message %s", "formatted") +// a.IsIncreasingf([]string{"a", "b"}, "error message %s", "formatted") +func (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsIncreasingf(a.t, object, msg, args...) +} + +// IsNonDecreasing asserts that the collection is not decreasing +// +// a.IsNonDecreasing([]int{1, 1, 2}) +// a.IsNonDecreasing([]float{1, 2}) +// a.IsNonDecreasing([]string{"a", "b"}) +func (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNonDecreasing(a.t, object, msgAndArgs...) +} + +// IsNonDecreasingf asserts that the collection is not decreasing +// +// a.IsNonDecreasingf([]int{1, 1, 2}, "error message %s", "formatted") +// a.IsNonDecreasingf([]float{1, 2}, "error message %s", "formatted") +// a.IsNonDecreasingf([]string{"a", "b"}, "error message %s", "formatted") +func (a *Assertions) IsNonDecreasingf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNonDecreasingf(a.t, object, msg, args...) +} + +// IsNonIncreasing asserts that the collection is not increasing +// +// a.IsNonIncreasing([]int{2, 1, 1}) +// a.IsNonIncreasing([]float{2, 1}) +// a.IsNonIncreasing([]string{"b", "a"}) +func (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNonIncreasing(a.t, object, msgAndArgs...) +} + +// IsNonIncreasingf asserts that the collection is not increasing +// +// a.IsNonIncreasingf([]int{2, 1, 1}, "error message %s", "formatted") +// a.IsNonIncreasingf([]float{2, 1}, "error message %s", "formatted") +// a.IsNonIncreasingf([]string{"b", "a"}, "error message %s", "formatted") +func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNonIncreasingf(a.t, object, msg, args...) +} + // IsType asserts that the specified objects are of the same type. func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { @@ -639,22 +799,6 @@ func (a *Assertions) JSONEqf(expected string, actual string, msg string, args .. return JSONEqf(a.t, expected, actual, msg, args...) } -// YAMLEq asserts that two YAML strings are equivalent. -func (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return YAMLEq(a.t, expected, actual, msgAndArgs...) -} - -// YAMLEqf asserts that two YAML strings are equivalent. -func (a *Assertions) YAMLEqf(expected string, actual string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return YAMLEqf(a.t, expected, actual, msg, args...) -} - // Len asserts that the specified object has specific length. // Len also fails if the object has a type that len() not accept. // @@ -718,7 +862,7 @@ func (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, ar // Lessf asserts that the first element is less than the second // // a.Lessf(1, 2, "error message %s", "formatted") -// a.Lessf(float64(1, "error message %s", "formatted"), float64(2)) +// a.Lessf(float64(1), float64(2), "error message %s", "formatted") // a.Lessf("a", "b", "error message %s", "formatted") func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { @@ -727,6 +871,50 @@ func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...i return Lessf(a.t, e1, e2, msg, args...) } +// Negative asserts that the specified element is negative +// +// a.Negative(-1) +// a.Negative(-1.23) +func (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Negative(a.t, e, msgAndArgs...) +} + +// Negativef asserts that the specified element is negative +// +// a.Negativef(-1, "error message %s", "formatted") +// a.Negativef(-1.23, "error message %s", "formatted") +func (a *Assertions) Negativef(e interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Negativef(a.t, e, msg, args...) +} + +// Never asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// a.Never(func() bool { return false; }, time.Second, 10*time.Millisecond) +func (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Never(a.t, condition, waitFor, tick, msgAndArgs...) +} + +// Neverf asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// a.Neverf(func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") +func (a *Assertions) Neverf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Neverf(a.t, condition, waitFor, tick, msg, args...) +} + // Nil asserts that the specified object is nil. // // a.Nil(err) @@ -747,6 +935,24 @@ func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) b return Nilf(a.t, object, msg, args...) } +// NoDirExists checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NoDirExists(a.t, path, msgAndArgs...) +} + +// NoDirExistsf checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NoDirExistsf(a.t, path, msg, args...) +} + // NoError asserts that a function returned no error (i.e. `nil`). // // actualObj, err := SomeFunction() @@ -773,6 +979,24 @@ func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool { return NoErrorf(a.t, err, msg, args...) } +// NoFileExists checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NoFileExists(a.t, path, msgAndArgs...) +} + +// NoFileExistsf checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NoFileExistsf(a.t, path, msg, args...) +} + // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the // specified substring or element. // @@ -838,6 +1062,26 @@ func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndAr return NotEqual(a.t, expected, actual, msgAndArgs...) } +// NotEqualValues asserts that two objects are not equal even when converted to the same type +// +// a.NotEqualValues(obj1, obj2) +func (a *Assertions) NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotEqualValues(a.t, expected, actual, msgAndArgs...) +} + +// NotEqualValuesf asserts that two objects are not equal even when converted to the same type +// +// a.NotEqualValuesf(obj1, obj2, "error message %s", "formatted") +func (a *Assertions) NotEqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotEqualValuesf(a.t, expected, actual, msg, args...) +} + // NotEqualf asserts that the specified values are NOT equal. // // a.NotEqualf(obj1, obj2, "error message %s", "formatted") @@ -851,6 +1095,24 @@ func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg str return NotEqualf(a.t, expected, actual, msg, args...) } +// NotErrorIs asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotErrorIs(a.t, err, target, msgAndArgs...) +} + +// NotErrorIsf asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotErrorIsf(a.t, err, target, msg, args...) +} + // NotNil asserts that the specified object is not nil. // // a.NotNil(err) @@ -904,7 +1166,7 @@ func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...in // NotRegexpf asserts that a specified regexp does not match a string. // -// a.NotRegexpf(regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting") +// a.NotRegexpf(regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted") // a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted") func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { @@ -913,6 +1175,32 @@ func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, arg return NotRegexpf(a.t, rx, str, msg, args...) } +// NotSame asserts that two pointers do not reference the same object. +// +// a.NotSame(ptr1, ptr2) +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func (a *Assertions) NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotSame(a.t, expected, actual, msgAndArgs...) +} + +// NotSamef asserts that two pointers do not reference the same object. +// +// a.NotSamef(ptr1, ptr2, "error message %s", "formatted") +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotSamef(a.t, expected, actual, msg, args...) +} + // NotSubset asserts that the specified list(array, slice...) contains not all // elements given in the specified subset(array, slice...). // @@ -961,6 +1249,30 @@ func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool { return Panics(a.t, f, msgAndArgs...) } +// PanicsWithError asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// a.PanicsWithError("crazy error", func(){ GoCrazy() }) +func (a *Assertions) PanicsWithError(errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return PanicsWithError(a.t, errString, f, msgAndArgs...) +} + +// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// a.PanicsWithErrorf("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") +func (a *Assertions) PanicsWithErrorf(errString string, f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return PanicsWithErrorf(a.t, errString, f, msg, args...) +} + // PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that // the recovered panic value equals the expected panic value. // @@ -993,6 +1305,28 @@ func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) b return Panicsf(a.t, f, msg, args...) } +// Positive asserts that the specified element is positive +// +// a.Positive(1) +// a.Positive(1.23) +func (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Positive(a.t, e, msgAndArgs...) +} + +// Positivef asserts that the specified element is positive +// +// a.Positivef(1, "error message %s", "formatted") +// a.Positivef(1.23, "error message %s", "formatted") +func (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return Positivef(a.t, e, msg, args...) +} + // Regexp asserts that a specified regexp matches a string. // // a.Regexp(regexp.MustCompile("start"), "it's starting") @@ -1006,7 +1340,7 @@ func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...inter // Regexpf asserts that a specified regexp matches a string. // -// a.Regexpf(regexp.MustCompile("start", "error message %s", "formatted"), "it's starting") +// a.Regexpf(regexp.MustCompile("start"), "it's starting", "error message %s", "formatted") // a.Regexpf("start...$", "it's not starting", "error message %s", "formatted") func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { @@ -1103,6 +1437,22 @@ func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta return WithinDurationf(a.t, expected, actual, delta, msg, args...) } +// YAMLEq asserts that two YAML strings are equivalent. +func (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return YAMLEq(a.t, expected, actual, msgAndArgs...) +} + +// YAMLEqf asserts that two YAML strings are equivalent. +func (a *Assertions) YAMLEqf(expected string, actual string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return YAMLEqf(a.t, expected, actual, msg, args...) +} + // Zero asserts that i is the zero value for its type. func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { diff --git a/vendor/github.com/stretchr/testify/assert/assertion_order.go b/vendor/github.com/stretchr/testify/assert/assertion_order.go index 15a486ca6..1c3b47182 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_order.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_order.go @@ -5,305 +5,77 @@ import ( "reflect" ) -func compare(obj1, obj2 interface{}, kind reflect.Kind) (int, bool) { - switch kind { - case reflect.Int: - { - intobj1 := obj1.(int) - intobj2 := obj2.(int) - if intobj1 > intobj2 { - return -1, true - } - if intobj1 == intobj2 { - return 0, true - } - if intobj1 < intobj2 { - return 1, true - } - } - case reflect.Int8: - { - int8obj1 := obj1.(int8) - int8obj2 := obj2.(int8) - if int8obj1 > int8obj2 { - return -1, true - } - if int8obj1 == int8obj2 { - return 0, true - } - if int8obj1 < int8obj2 { - return 1, true - } - } - case reflect.Int16: - { - int16obj1 := obj1.(int16) - int16obj2 := obj2.(int16) - if int16obj1 > int16obj2 { - return -1, true - } - if int16obj1 == int16obj2 { - return 0, true - } - if int16obj1 < int16obj2 { - return 1, true - } - } - case reflect.Int32: - { - int32obj1 := obj1.(int32) - int32obj2 := obj2.(int32) - if int32obj1 > int32obj2 { - return -1, true - } - if int32obj1 == int32obj2 { - return 0, true - } - if int32obj1 < int32obj2 { - return 1, true - } - } - case reflect.Int64: - { - int64obj1 := obj1.(int64) - int64obj2 := obj2.(int64) - if int64obj1 > int64obj2 { - return -1, true - } - if int64obj1 == int64obj2 { - return 0, true - } - if int64obj1 < int64obj2 { - return 1, true - } - } - case reflect.Uint: - { - uintobj1 := obj1.(uint) - uintobj2 := obj2.(uint) - if uintobj1 > uintobj2 { - return -1, true - } - if uintobj1 == uintobj2 { - return 0, true - } - if uintobj1 < uintobj2 { - return 1, true - } - } - case reflect.Uint8: - { - uint8obj1 := obj1.(uint8) - uint8obj2 := obj2.(uint8) - if uint8obj1 > uint8obj2 { - return -1, true - } - if uint8obj1 == uint8obj2 { - return 0, true - } - if uint8obj1 < uint8obj2 { - return 1, true - } - } - case reflect.Uint16: - { - uint16obj1 := obj1.(uint16) - uint16obj2 := obj2.(uint16) - if uint16obj1 > uint16obj2 { - return -1, true - } - if uint16obj1 == uint16obj2 { - return 0, true - } - if uint16obj1 < uint16obj2 { - return 1, true - } - } - case reflect.Uint32: - { - uint32obj1 := obj1.(uint32) - uint32obj2 := obj2.(uint32) - if uint32obj1 > uint32obj2 { - return -1, true - } - if uint32obj1 == uint32obj2 { - return 0, true - } - if uint32obj1 < uint32obj2 { - return 1, true - } - } - case reflect.Uint64: - { - uint64obj1 := obj1.(uint64) - uint64obj2 := obj2.(uint64) - if uint64obj1 > uint64obj2 { - return -1, true - } - if uint64obj1 == uint64obj2 { - return 0, true - } - if uint64obj1 < uint64obj2 { - return 1, true - } - } - case reflect.Float32: - { - float32obj1 := obj1.(float32) - float32obj2 := obj2.(float32) - if float32obj1 > float32obj2 { - return -1, true - } - if float32obj1 == float32obj2 { - return 0, true - } - if float32obj1 < float32obj2 { - return 1, true - } - } - case reflect.Float64: - { - float64obj1 := obj1.(float64) - float64obj2 := obj2.(float64) - if float64obj1 > float64obj2 { - return -1, true - } - if float64obj1 == float64obj2 { - return 0, true - } - if float64obj1 < float64obj2 { - return 1, true - } - } - case reflect.String: - { - stringobj1 := obj1.(string) - stringobj2 := obj2.(string) - if stringobj1 > stringobj2 { - return -1, true - } - if stringobj1 == stringobj2 { - return 0, true - } - if stringobj1 < stringobj2 { - return 1, true - } - } +// isOrdered checks that collection contains orderable elements. +func isOrdered(t TestingT, object interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool { + objKind := reflect.TypeOf(object).Kind() + if objKind != reflect.Slice && objKind != reflect.Array { + return false } - return 0, false -} + objValue := reflect.ValueOf(object) + objLen := objValue.Len() -// Greater asserts that the first element is greater than the second -// -// assert.Greater(t, 2, 1) -// assert.Greater(t, float64(2), float64(1)) -// assert.Greater(t, "b", "a") -func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() + if objLen <= 1 { + return true } - e1Kind := reflect.ValueOf(e1).Kind() - e2Kind := reflect.ValueOf(e2).Kind() - if e1Kind != e2Kind { - return Fail(t, "Elements should be the same type", msgAndArgs...) - } + value := objValue.Index(0) + valueInterface := value.Interface() + firstValueKind := value.Kind() - res, isComparable := compare(e1, e2, e1Kind) - if !isComparable { - return Fail(t, fmt.Sprintf("Can not compare type \"%s\"", reflect.TypeOf(e1)), msgAndArgs...) - } + for i := 1; i < objLen; i++ { + prevValue := value + prevValueInterface := valueInterface - if res != -1 { - return Fail(t, fmt.Sprintf("\"%v\" is not greater than \"%v\"", e1, e2), msgAndArgs...) + value = objValue.Index(i) + valueInterface = value.Interface() + + compareResult, isComparable := compare(prevValueInterface, valueInterface, firstValueKind) + + if !isComparable { + return Fail(t, fmt.Sprintf("Can not compare type \"%s\" and \"%s\"", reflect.TypeOf(value), reflect.TypeOf(prevValue)), msgAndArgs...) + } + + if !containsValue(allowedComparesResults, compareResult) { + return Fail(t, fmt.Sprintf(failMessage, prevValue, value), msgAndArgs...) + } } return true } -// GreaterOrEqual asserts that the first element is greater than or equal to the second +// IsIncreasing asserts that the collection is increasing // -// assert.GreaterOrEqual(t, 2, 1) -// assert.GreaterOrEqual(t, 2, 2) -// assert.GreaterOrEqual(t, "b", "a") -// assert.GreaterOrEqual(t, "b", "b") -func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - e1Kind := reflect.ValueOf(e1).Kind() - e2Kind := reflect.ValueOf(e2).Kind() - if e1Kind != e2Kind { - return Fail(t, "Elements should be the same type", msgAndArgs...) - } - - res, isComparable := compare(e1, e2, e1Kind) - if !isComparable { - return Fail(t, fmt.Sprintf("Can not compare type \"%s\"", reflect.TypeOf(e1)), msgAndArgs...) - } - - if res != -1 && res != 0 { - return Fail(t, fmt.Sprintf("\"%v\" is not greater than or equal to \"%v\"", e1, e2), msgAndArgs...) - } - - return true +// assert.IsIncreasing(t, []int{1, 2, 3}) +// assert.IsIncreasing(t, []float{1, 2}) +// assert.IsIncreasing(t, []string{"a", "b"}) +func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + return isOrdered(t, object, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs) } -// Less asserts that the first element is less than the second +// IsNonIncreasing asserts that the collection is not increasing // -// assert.Less(t, 1, 2) -// assert.Less(t, float64(1), float64(2)) -// assert.Less(t, "a", "b") -func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - e1Kind := reflect.ValueOf(e1).Kind() - e2Kind := reflect.ValueOf(e2).Kind() - if e1Kind != e2Kind { - return Fail(t, "Elements should be the same type", msgAndArgs...) - } - - res, isComparable := compare(e1, e2, e1Kind) - if !isComparable { - return Fail(t, fmt.Sprintf("Can not compare type \"%s\"", reflect.TypeOf(e1)), msgAndArgs...) - } - - if res != 1 { - return Fail(t, fmt.Sprintf("\"%v\" is not less than \"%v\"", e1, e2), msgAndArgs...) - } - - return true +// assert.IsNonIncreasing(t, []int{2, 1, 1}) +// assert.IsNonIncreasing(t, []float{2, 1}) +// assert.IsNonIncreasing(t, []string{"b", "a"}) +func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + return isOrdered(t, object, []CompareType{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs) } -// LessOrEqual asserts that the first element is less than or equal to the second +// IsDecreasing asserts that the collection is decreasing // -// assert.LessOrEqual(t, 1, 2) -// assert.LessOrEqual(t, 2, 2) -// assert.LessOrEqual(t, "a", "b") -// assert.LessOrEqual(t, "b", "b") -func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - e1Kind := reflect.ValueOf(e1).Kind() - e2Kind := reflect.ValueOf(e2).Kind() - if e1Kind != e2Kind { - return Fail(t, "Elements should be the same type", msgAndArgs...) - } - - res, isComparable := compare(e1, e2, e1Kind) - if !isComparable { - return Fail(t, fmt.Sprintf("Can not compare type \"%s\"", reflect.TypeOf(e1)), msgAndArgs...) - } - - if res != 1 && res != 0 { - return Fail(t, fmt.Sprintf("\"%v\" is not less than or equal to \"%v\"", e1, e2), msgAndArgs...) - } - - return true +// assert.IsDecreasing(t, []int{2, 1, 0}) +// assert.IsDecreasing(t, []float{2, 1}) +// assert.IsDecreasing(t, []string{"b", "a"}) +func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + return isOrdered(t, object, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs) +} + +// IsNonDecreasing asserts that the collection is not decreasing +// +// assert.IsNonDecreasing(t, []int{1, 1, 2}) +// assert.IsNonDecreasing(t, []float{1, 2}) +// assert.IsNonDecreasing(t, []string{"a", "b"}) +func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + return isOrdered(t, object, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs) } diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go index 044da8b01..bcac4401f 100644 --- a/vendor/github.com/stretchr/testify/assert/assertions.go +++ b/vendor/github.com/stretchr/testify/assert/assertions.go @@ -11,6 +11,7 @@ import ( "reflect" "regexp" "runtime" + "runtime/debug" "strings" "time" "unicode" @@ -18,10 +19,10 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/pmezard/go-difflib/difflib" - yaml "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v3" ) -//go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_format.go.tmpl +//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_format.go.tmpl" // TestingT is an interface wrapper around *testing.T type TestingT interface { @@ -44,7 +45,7 @@ type BoolAssertionFunc func(TestingT, bool, ...interface{}) bool // for table driven tests. type ErrorAssertionFunc func(TestingT, error, ...interface{}) bool -// Comparison a custom function that returns true on success and false on failure +// Comparison is a custom function that returns true on success and false on failure type Comparison func() (success bool) /* @@ -103,11 +104,11 @@ the problem actually occurred in calling code.*/ // failed. func CallerInfo() []string { - pc := uintptr(0) - file := "" - line := 0 - ok := false - name := "" + var pc uintptr + var ok bool + var file string + var line int + var name string callers := []string{} for i := 0; ; i++ { @@ -171,8 +172,8 @@ func isTest(name, prefix string) bool { if len(name) == len(prefix) { // "Test" is ok return true } - rune, _ := utf8.DecodeRuneInString(name[len(prefix):]) - return !unicode.IsLower(rune) + r, _ := utf8.DecodeRuneInString(name[len(prefix):]) + return !unicode.IsLower(r) } func messageFromMsgAndArgs(msgAndArgs ...interface{}) string { @@ -351,6 +352,19 @@ func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) } +// validateEqualArgs checks whether provided arguments can be safely used in the +// Equal/NotEqual functions. +func validateEqualArgs(expected, actual interface{}) error { + if expected == nil && actual == nil { + return nil + } + + if isFunction(expected) || isFunction(actual) { + return errors.New("cannot take func type as argument") + } + return nil +} + // Same asserts that two pointers reference the same object. // // assert.Same(t, ptr1, ptr2) @@ -362,18 +376,7 @@ func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) b h.Helper() } - expectedPtr, actualPtr := reflect.ValueOf(expected), reflect.ValueOf(actual) - if expectedPtr.Kind() != reflect.Ptr || actualPtr.Kind() != reflect.Ptr { - return Fail(t, "Invalid operation: both arguments must be pointers", msgAndArgs...) - } - - expectedType, actualType := reflect.TypeOf(expected), reflect.TypeOf(actual) - if expectedType != actualType { - return Fail(t, fmt.Sprintf("Pointer expected to be of type %v, but was %v", - expectedType, actualType), msgAndArgs...) - } - - if expected != actual { + if !samePointers(expected, actual) { return Fail(t, fmt.Sprintf("Not same: \n"+ "expected: %p %#v\n"+ "actual : %p %#v", expected, expected, actual, actual), msgAndArgs...) @@ -382,6 +385,42 @@ func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) b return true } +// NotSame asserts that two pointers do not reference the same object. +// +// assert.NotSame(t, ptr1, ptr2) +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + if samePointers(expected, actual) { + return Fail(t, fmt.Sprintf( + "Expected and actual point to the same object: %p %#v", + expected, expected), msgAndArgs...) + } + return true +} + +// samePointers compares two generic interface objects and returns whether +// they point to the same object +func samePointers(first, second interface{}) bool { + firstPtr, secondPtr := reflect.ValueOf(first), reflect.ValueOf(second) + if firstPtr.Kind() != reflect.Ptr || secondPtr.Kind() != reflect.Ptr { + return false + } + + firstType, secondType := reflect.TypeOf(first), reflect.TypeOf(second) + if firstType != secondType { + return false + } + + // compare pointer addresses + return first == second +} + // formatUnequalValues takes two values of arbitrary types and returns string // representations appropriate to be presented to the user. // @@ -390,12 +429,27 @@ func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) b // to a type conversion in the Go grammar. func formatUnequalValues(expected, actual interface{}) (e string, a string) { if reflect.TypeOf(expected) != reflect.TypeOf(actual) { - return fmt.Sprintf("%T(%#v)", expected, expected), - fmt.Sprintf("%T(%#v)", actual, actual) + return fmt.Sprintf("%T(%s)", expected, truncatingFormat(expected)), + fmt.Sprintf("%T(%s)", actual, truncatingFormat(actual)) } + switch expected.(type) { + case time.Duration: + return fmt.Sprintf("%v", expected), fmt.Sprintf("%v", actual) + } + return truncatingFormat(expected), truncatingFormat(actual) +} - return fmt.Sprintf("%#v", expected), - fmt.Sprintf("%#v", actual) +// truncatingFormat formats the data and truncates it if it's too long. +// +// This helps keep formatted error messages lines from exceeding the +// bufio.MaxScanTokenSize max line length that the go testing framework imposes. +func truncatingFormat(data interface{}) string { + value := fmt.Sprintf("%#v", data) + max := bufio.MaxScanTokenSize - 100 // Give us some space the type info too if needed. + if len(value) > max { + value = value[0:max] + "<... truncated>" + } + return value } // EqualValues asserts that two objects are equal or convertable to the same types @@ -442,12 +496,12 @@ func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{} // // assert.NotNil(t, err) func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } if !isNil(object) { return true } + if h, ok := t.(tHelper); ok { + h.Helper() + } return Fail(t, "Expected value not to be nil.", msgAndArgs...) } @@ -488,12 +542,12 @@ func isNil(object interface{}) bool { // // assert.Nil(t, err) func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } if isNil(object) { return true } + if h, ok := t.(tHelper); ok { + h.Helper() + } return Fail(t, fmt.Sprintf("Expected nil, but got: %#v", object), msgAndArgs...) } @@ -530,12 +584,11 @@ func isEmpty(object interface{}) bool { // // assert.Empty(t, obj) func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - pass := isEmpty(object) if !pass { + if h, ok := t.(tHelper); ok { + h.Helper() + } Fail(t, fmt.Sprintf("Should be empty, but was %v", object), msgAndArgs...) } @@ -550,12 +603,11 @@ func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { // assert.Equal(t, "two", obj[1]) // } func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - pass := !isEmpty(object) if !pass { + if h, ok := t.(tHelper); ok { + h.Helper() + } Fail(t, fmt.Sprintf("Should NOT be empty, but was %v", object), msgAndArgs...) } @@ -598,16 +650,10 @@ func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) // // assert.True(t, myBool) func True(t TestingT, value bool, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if h, ok := t.(interface { - Helper() - }); ok { - h.Helper() - } - - if value != true { + if !value { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Fail(t, "Should be true", msgAndArgs...) } @@ -619,11 +665,10 @@ func True(t TestingT, value bool, msgAndArgs ...interface{}) bool { // // assert.False(t, myBool) func False(t TestingT, value bool, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if value != false { + if value { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Fail(t, "Should be false", msgAndArgs...) } @@ -654,6 +699,21 @@ func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{ } +// NotEqualValues asserts that two objects are not equal even when converted to the same type +// +// assert.NotEqualValues(t, obj1, obj2) +func NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + if ObjectsAreEqualValues(expected, actual) { + return Fail(t, fmt.Sprintf("Should not be: %#v\n", actual), msgAndArgs...) + } + + return true +} + // containsElement try loop over the list check if the list includes the element. // return (false, false) if impossible. // return (true, false) if element was not found. @@ -706,10 +766,10 @@ func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bo ok, found := includeElement(s, contains) if !ok { - return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", s), msgAndArgs...) + return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", s), msgAndArgs...) } if !found { - return Fail(t, fmt.Sprintf("\"%s\" does not contain \"%s\"", s, contains), msgAndArgs...) + return Fail(t, fmt.Sprintf("%#v does not contain %#v", s, contains), msgAndArgs...) } return true @@ -840,27 +900,39 @@ func ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface return true } - aKind := reflect.TypeOf(listA).Kind() - bKind := reflect.TypeOf(listB).Kind() - - if aKind != reflect.Array && aKind != reflect.Slice { - return Fail(t, fmt.Sprintf("%q has an unsupported type %s", listA, aKind), msgAndArgs...) + if !isList(t, listA, msgAndArgs...) || !isList(t, listB, msgAndArgs...) { + return false } - if bKind != reflect.Array && bKind != reflect.Slice { - return Fail(t, fmt.Sprintf("%q has an unsupported type %s", listB, bKind), msgAndArgs...) + extraA, extraB := diffLists(listA, listB) + + if len(extraA) == 0 && len(extraB) == 0 { + return true } + return Fail(t, formatListDiff(listA, listB, extraA, extraB), msgAndArgs...) +} + +// isList checks that the provided value is array or slice. +func isList(t TestingT, list interface{}, msgAndArgs ...interface{}) (ok bool) { + kind := reflect.TypeOf(list).Kind() + if kind != reflect.Array && kind != reflect.Slice { + return Fail(t, fmt.Sprintf("%q has an unsupported type %s, expecting array or slice", list, kind), + msgAndArgs...) + } + return true +} + +// diffLists diffs two arrays/slices and returns slices of elements that are only in A and only in B. +// If some element is present multiple times, each instance is counted separately (e.g. if something is 2x in A and +// 5x in B, it will be 0x in extraA and 3x in extraB). The order of items in both lists is ignored. +func diffLists(listA, listB interface{}) (extraA, extraB []interface{}) { aValue := reflect.ValueOf(listA) bValue := reflect.ValueOf(listB) aLen := aValue.Len() bLen := bValue.Len() - if aLen != bLen { - return Fail(t, fmt.Sprintf("lengths don't match: %d != %d", aLen, bLen), msgAndArgs...) - } - // Mark indexes in bValue that we already used visited := make([]bool, bLen) for i := 0; i < aLen; i++ { @@ -877,11 +949,38 @@ func ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface } } if !found { - return Fail(t, fmt.Sprintf("element %s appears more times in %s than in %s", element, aValue, bValue), msgAndArgs...) + extraA = append(extraA, element) } } - return true + for j := 0; j < bLen; j++ { + if visited[j] { + continue + } + extraB = append(extraB, bValue.Index(j).Interface()) + } + + return +} + +func formatListDiff(listA, listB interface{}, extraA, extraB []interface{}) string { + var msg bytes.Buffer + + msg.WriteString("elements differ") + if len(extraA) > 0 { + msg.WriteString("\n\nextra elements in list A:\n") + msg.WriteString(spewConfig.Sdump(extraA)) + } + if len(extraB) > 0 { + msg.WriteString("\n\nextra elements in list B:\n") + msg.WriteString(spewConfig.Sdump(extraB)) + } + msg.WriteString("\n\nlistA:\n") + msg.WriteString(spewConfig.Sdump(listA)) + msg.WriteString("\n\nlistB:\n") + msg.WriteString(spewConfig.Sdump(listB)) + + return msg.String() } // Condition uses a Comparison to assert a complex condition. @@ -901,15 +1000,17 @@ func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool { type PanicTestFunc func() // didPanic returns true if the function passed to it panics. Otherwise, it returns false. -func didPanic(f PanicTestFunc) (bool, interface{}) { +func didPanic(f PanicTestFunc) (bool, interface{}, string) { didPanic := false var message interface{} + var stack string func() { defer func() { if message = recover(); message != nil { didPanic = true + stack = string(debug.Stack()) } }() @@ -918,7 +1019,7 @@ func didPanic(f PanicTestFunc) (bool, interface{}) { }() - return didPanic, message + return didPanic, message, stack } @@ -930,7 +1031,7 @@ func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { h.Helper() } - if funcDidPanic, panicValue := didPanic(f); !funcDidPanic { + if funcDidPanic, panicValue, _ := didPanic(f); !funcDidPanic { return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) } @@ -946,12 +1047,34 @@ func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndAr h.Helper() } - funcDidPanic, panicValue := didPanic(f) + funcDidPanic, panicValue, panickedStack := didPanic(f) if !funcDidPanic { return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) } if panicValue != expected { - return Fail(t, fmt.Sprintf("func %#v should panic with value:\t%#v\n\tPanic value:\t%#v", f, expected, panicValue), msgAndArgs...) + return Fail(t, fmt.Sprintf("func %#v should panic with value:\t%#v\n\tPanic value:\t%#v\n\tPanic stack:\t%s", f, expected, panicValue, panickedStack), msgAndArgs...) + } + + return true +} + +// PanicsWithError asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// assert.PanicsWithError(t, "crazy error", func(){ GoCrazy() }) +func PanicsWithError(t TestingT, errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + funcDidPanic, panicValue, panickedStack := didPanic(f) + if !funcDidPanic { + return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) + } + panicErr, ok := panicValue.(error) + if !ok || panicErr.Error() != errString { + return Fail(t, fmt.Sprintf("func %#v should panic with error message:\t%#v\n\tPanic value:\t%#v\n\tPanic stack:\t%s", f, errString, panicValue, panickedStack), msgAndArgs...) } return true @@ -965,8 +1088,8 @@ func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { h.Helper() } - if funcDidPanic, panicValue := didPanic(f); funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should not panic\n\tPanic value:\t%v", f, panicValue), msgAndArgs...) + if funcDidPanic, panicValue, panickedStack := didPanic(f); funcDidPanic { + return Fail(t, fmt.Sprintf("func %#v should not panic\n\tPanic value:\t%v\n\tPanic stack:\t%s", f, panicValue, panickedStack), msgAndArgs...) } return true @@ -993,6 +1116,8 @@ func toFloat(x interface{}) (float64, bool) { xok := true switch xn := x.(type) { + case uint: + xf = float64(xn) case uint8: xf = float64(xn) case uint16: @@ -1014,7 +1139,7 @@ func toFloat(x interface{}) (float64, bool) { case float32: xf = float64(xn) case float64: - xf = float64(xn) + xf = xn case time.Duration: xf = float64(xn) default: @@ -1026,7 +1151,7 @@ func toFloat(x interface{}) (float64, bool) { // InDelta asserts that the two numerals are within delta of each other. // -// assert.InDelta(t, math.Pi, (22 / 7.0), 0.01) +// assert.InDelta(t, math.Pi, 22/7.0, 0.01) func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -1128,6 +1253,9 @@ func calcRelativeError(expected, actual interface{}) (float64, error) { if !aok { return 0, fmt.Errorf("expected value %q cannot be converted to float", expected) } + if math.IsNaN(af) { + return 0, errors.New("expected value must not be NaN") + } if af == 0 { return 0, fmt.Errorf("expected value must have a value other than zero to calculate the relative error") } @@ -1135,6 +1263,9 @@ func calcRelativeError(expected, actual interface{}) (float64, error) { if !bok { return 0, fmt.Errorf("actual value %q cannot be converted to float", actual) } + if math.IsNaN(bf) { + return 0, errors.New("actual value must not be NaN") + } return math.Abs(af-bf) / math.Abs(af), nil } @@ -1144,6 +1275,9 @@ func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAnd if h, ok := t.(tHelper); ok { h.Helper() } + if math.IsNaN(epsilon) { + return Fail(t, "epsilon must not be NaN") + } actualEpsilon, err := calcRelativeError(expected, actual) if err != nil { return Fail(t, err.Error(), msgAndArgs...) @@ -1191,10 +1325,10 @@ func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, m // assert.Equal(t, expectedObj, actualObj) // } func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } if err != nil { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Fail(t, fmt.Sprintf("Received unexpected error:\n%+v", err), msgAndArgs...) } @@ -1208,11 +1342,10 @@ func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool { // assert.Equal(t, expectedError, err) // } func Error(t TestingT, err error, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if err == nil { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Fail(t, "An error is expected but got nil.", msgAndArgs...) } @@ -1314,7 +1447,8 @@ func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { return true } -// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file. +// FileExists checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. func FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -1332,7 +1466,24 @@ func FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool { return true } -// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists. +// NoFileExists checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + info, err := os.Lstat(path) + if err != nil { + return true + } + if info.IsDir() { + return true + } + return Fail(t, fmt.Sprintf("file %q exists", path), msgAndArgs...) +} + +// DirExists checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. func DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -1350,6 +1501,25 @@ func DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool { return true } +// NoDirExists checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + info, err := os.Lstat(path) + if err != nil { + if os.IsNotExist(err) { + return true + } + return true + } + if !info.IsDir() { + return true + } + return Fail(t, fmt.Sprintf("directory %q exists", path), msgAndArgs...) +} + // JSONEq asserts that two JSON strings are equivalent. // // assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) @@ -1439,15 +1609,6 @@ func diff(expected interface{}, actual interface{}) string { return "\n\nDiff:\n" + diff } -// validateEqualArgs checks whether provided arguments can be safely used in the -// Equal/NotEqual functions. -func validateEqualArgs(expected, actual interface{}) error { - if isFunction(expected) || isFunction(actual) { - return errors.New("cannot take func type as argument") - } - return nil -} - func isFunction(arg interface{}) bool { if arg == nil { return false @@ -1460,6 +1621,8 @@ var spewConfig = spew.ConfigState{ DisablePointerAddresses: true, DisableCapacities: true, SortKeys: true, + DisableMethods: true, + MaxDepth: 10, } type tHelper interface { @@ -1475,24 +1638,137 @@ func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick t h.Helper() } + ch := make(chan bool, 1) + timer := time.NewTimer(waitFor) - ticker := time.NewTicker(tick) - checkPassed := make(chan bool) defer timer.Stop() + + ticker := time.NewTicker(tick) defer ticker.Stop() - defer close(checkPassed) - for { + + for tick := ticker.C; ; { select { case <-timer.C: return Fail(t, "Condition never satisfied", msgAndArgs...) - case result := <-checkPassed: - if result { + case <-tick: + tick = nil + go func() { ch <- condition() }() + case v := <-ch: + if v { return true } - case <-ticker.C: - go func() { - checkPassed <- condition() - }() + tick = ticker.C } } } + +// Never asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// assert.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond) +func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + + ch := make(chan bool, 1) + + timer := time.NewTimer(waitFor) + defer timer.Stop() + + ticker := time.NewTicker(tick) + defer ticker.Stop() + + for tick := ticker.C; ; { + select { + case <-timer.C: + return true + case <-tick: + tick = nil + go func() { ch <- condition() }() + case v := <-ch: + if v { + return Fail(t, "Condition satisfied", msgAndArgs...) + } + tick = ticker.C + } + } +} + +// ErrorIs asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func ErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if errors.Is(err, target) { + return true + } + + var expectedText string + if target != nil { + expectedText = target.Error() + } + + chain := buildErrorChainString(err) + + return Fail(t, fmt.Sprintf("Target error should be in err chain:\n"+ + "expected: %q\n"+ + "in chain: %s", expectedText, chain, + ), msgAndArgs...) +} + +// NotErrorIs asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func NotErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if !errors.Is(err, target) { + return true + } + + var expectedText string + if target != nil { + expectedText = target.Error() + } + + chain := buildErrorChainString(err) + + return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ + "found: %q\n"+ + "in chain: %s", expectedText, chain, + ), msgAndArgs...) +} + +// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if errors.As(err, target) { + return true + } + + chain := buildErrorChainString(err) + + return Fail(t, fmt.Sprintf("Should be in error chain:\n"+ + "expected: %q\n"+ + "in chain: %s", target, chain, + ), msgAndArgs...) +} + +func buildErrorChainString(err error) string { + if err == nil { + return "" + } + + e := errors.Unwrap(err) + chain := fmt.Sprintf("%q", err.Error()) + for e != nil { + chain += fmt.Sprintf("\n\t%q", e.Error()) + e = errors.Unwrap(e) + } + return chain +} diff --git a/vendor/github.com/stretchr/testify/assert/forward_assertions.go b/vendor/github.com/stretchr/testify/assert/forward_assertions.go index 9ad56851d..df189d234 100644 --- a/vendor/github.com/stretchr/testify/assert/forward_assertions.go +++ b/vendor/github.com/stretchr/testify/assert/forward_assertions.go @@ -13,4 +13,4 @@ func New(t TestingT) *Assertions { } } -//go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs +//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs" diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go index df46fa777..4ed341dd2 100644 --- a/vendor/github.com/stretchr/testify/assert/http_assertions.go +++ b/vendor/github.com/stretchr/testify/assert/http_assertions.go @@ -33,7 +33,6 @@ func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, value code, err := httpCode(handler, method, url, values) if err != nil { Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) - return false } isSuccessCode := code >= http.StatusOK && code <= http.StatusPartialContent @@ -56,7 +55,6 @@ func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, valu code, err := httpCode(handler, method, url, values) if err != nil { Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) - return false } isRedirectCode := code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect @@ -79,7 +77,6 @@ func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values code, err := httpCode(handler, method, url, values) if err != nil { Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) - return false } isErrorCode := code >= http.StatusBadRequest @@ -90,6 +87,28 @@ func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values return isErrorCode } +// HTTPStatusCode asserts that a specified handler returns a specified status code. +// +// assert.HTTPStatusCode(t, myHandler, "GET", "/notImplemented", nil, 501) +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + code, err := httpCode(handler, method, url, values) + if err != nil { + Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) + } + + successful := code == statuscode + if !successful { + Fail(t, fmt.Sprintf("Expected HTTP status code %d for %q but received %d", statuscode, url+"?"+values.Encode(), code)) + } + + return successful +} + // HTTPBody is a helper that returns HTTP body of the response. It returns // empty string if building a new request fails. func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string { diff --git a/vendor/github.com/xo/terminfo/.gitignore b/vendor/github.com/xo/terminfo/.gitignore new file mode 100644 index 000000000..368e0c06c --- /dev/null +++ b/vendor/github.com/xo/terminfo/.gitignore @@ -0,0 +1,9 @@ +/.cache/ + +/cmd/infocmp/infocmp +/cmd/infocmp/.out/ + +/infocmp +/.out/ + +*.txt diff --git a/vendor/github.com/xo/terminfo/LICENSE b/vendor/github.com/xo/terminfo/LICENSE new file mode 100644 index 000000000..197dadb12 --- /dev/null +++ b/vendor/github.com/xo/terminfo/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Anmol Sethi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/xo/terminfo/README.md b/vendor/github.com/xo/terminfo/README.md new file mode 100644 index 000000000..e5002d239 --- /dev/null +++ b/vendor/github.com/xo/terminfo/README.md @@ -0,0 +1,139 @@ +# About terminfo [![GoDoc][1]][2] + +Package `terminfo` provides a pure-Go implementation of reading information +from the terminfo database. + +`terminfo` is meant as a replacement for `ncurses` in simple Go programs. + +## Installing + +Install in the usual Go way: + +```sh +$ go get -u github.com/xo/terminfo +``` + +## Using + +Please see the [GoDoc API listing][2] for more information on using `terminfo`. + +```go +// _examples/simple/main.go +package main + +import ( + "bytes" + "fmt" + "log" + "os" + "os/signal" + "strings" + "sync" + "syscall" + + "github.com/xo/terminfo" +) + +func main() { + //r := rand.New(nil) + + // load terminfo + ti, err := terminfo.LoadFromEnv() + if err != nil { + log.Fatal(err) + } + + // cleanup + defer func() { + err := recover() + termreset(ti) + if err != nil { + log.Fatal(err) + } + }() + + terminit(ti) + termtitle(ti, "simple example!") + termputs(ti, 3, 3, "Ctrl-C to exit") + maxColors := termcolors(ti) + if maxColors > 256 { + maxColors = 256 + } + for i := 0; i < maxColors; i++ { + termputs(ti, 5+i/16, 5+i%16, ti.Colorf(i, 0, "█")) + } + + // wait for signal + sigs := make(chan os.Signal, 1) + signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) + <-sigs +} + +// terminit initializes the special CA mode on the terminal, and makes the +// cursor invisible. +func terminit(ti *terminfo.Terminfo) { + buf := new(bytes.Buffer) + // set the cursor invisible + ti.Fprintf(buf, terminfo.CursorInvisible) + // enter special mode + ti.Fprintf(buf, terminfo.EnterCaMode) + // clear the screen + ti.Fprintf(buf, terminfo.ClearScreen) + os.Stdout.Write(buf.Bytes()) +} + +// termreset is the inverse of terminit. +func termreset(ti *terminfo.Terminfo) { + buf := new(bytes.Buffer) + ti.Fprintf(buf, terminfo.ExitCaMode) + ti.Fprintf(buf, terminfo.CursorNormal) + os.Stdout.Write(buf.Bytes()) +} + +// termputs puts a string at row, col, interpolating v. +func termputs(ti *terminfo.Terminfo, row, col int, s string, v ...interface{}) { + buf := new(bytes.Buffer) + ti.Fprintf(buf, terminfo.CursorAddress, row, col) + fmt.Fprintf(buf, s, v...) + os.Stdout.Write(buf.Bytes()) +} + +// sl is the status line terminfo. +var sl *terminfo.Terminfo + +// termtitle sets the window title. +func termtitle(ti *terminfo.Terminfo, s string) { + var once sync.Once + once.Do(func() { + if ti.Has(terminfo.HasStatusLine) { + return + } + // load the sl xterm if terminal is an xterm or has COLORTERM + if strings.Contains(strings.ToLower(os.Getenv("TERM")), "xterm") || os.Getenv("COLORTERM") == "truecolor" { + sl, _ = terminfo.Load("xterm+sl") + } + }) + if sl != nil { + ti = sl + } + if !ti.Has(terminfo.HasStatusLine) { + return + } + buf := new(bytes.Buffer) + ti.Fprintf(buf, terminfo.ToStatusLine) + fmt.Fprint(buf, s) + ti.Fprintf(buf, terminfo.FromStatusLine) + os.Stdout.Write(buf.Bytes()) +} + +// termcolors returns the maximum colors available for the terminal. +func termcolors(ti *terminfo.Terminfo) int { + if colors := ti.Num(terminfo.MaxColors); colors > 0 { + return colors + } + return int(terminfo.ColorLevelBasic) +} +``` + +[1]: https://godoc.org/github.com/xo/terminfo?status.svg +[2]: https://godoc.org/github.com/xo/terminfo diff --git a/vendor/github.com/xo/terminfo/caps.go b/vendor/github.com/xo/terminfo/caps.go new file mode 100644 index 000000000..9674aaa7b --- /dev/null +++ b/vendor/github.com/xo/terminfo/caps.go @@ -0,0 +1,33 @@ +package terminfo + +//go:generate go run gen.go + +// BoolCapName returns the bool capability name. +func BoolCapName(i int) string { + return boolCapNames[2*i] +} + +// BoolCapNameShort returns the short bool capability name. +func BoolCapNameShort(i int) string { + return boolCapNames[2*i+1] +} + +// NumCapName returns the num capability name. +func NumCapName(i int) string { + return numCapNames[2*i] +} + +// NumCapNameShort returns the short num capability name. +func NumCapNameShort(i int) string { + return numCapNames[2*i+1] +} + +// StringCapName returns the string capability name. +func StringCapName(i int) string { + return stringCapNames[2*i] +} + +// StringCapNameShort returns the short string capability name. +func StringCapNameShort(i int) string { + return stringCapNames[2*i+1] +} diff --git a/vendor/github.com/xo/terminfo/capvals.go b/vendor/github.com/xo/terminfo/capvals.go new file mode 100644 index 000000000..8528740ea --- /dev/null +++ b/vendor/github.com/xo/terminfo/capvals.go @@ -0,0 +1,2023 @@ +package terminfo + +// Code generated by gen.go. DO NOT EDIT. + +// Bool capabilities. +const ( + // The AutoLeftMargin [auto_left_margin, bw] bool capability indicates cub1 wraps from column 0 to last column. + AutoLeftMargin = iota + + // The AutoRightMargin [auto_right_margin, am] bool capability indicates terminal has automatic margins. + AutoRightMargin + + // The NoEscCtlc [no_esc_ctlc, xsb] bool capability indicates beehive (f1=escape, f2=ctrl C). + NoEscCtlc + + // The CeolStandoutGlitch [ceol_standout_glitch, xhp] bool capability indicates standout not erased by overwriting (hp). + CeolStandoutGlitch + + // The EatNewlineGlitch [eat_newline_glitch, xenl] bool capability indicates newline ignored after 80 cols (concept). + EatNewlineGlitch + + // The EraseOverstrike [erase_overstrike, eo] bool capability indicates can erase overstrikes with a blank. + EraseOverstrike + + // The GenericType [generic_type, gn] bool capability indicates generic line type. + GenericType + + // The HardCopy [hard_copy, hc] bool capability indicates hardcopy terminal. + HardCopy + + // The HasMetaKey [has_meta_key, km] bool capability indicates Has a meta key (i.e., sets 8th-bit). + HasMetaKey + + // The HasStatusLine [has_status_line, hs] bool capability indicates has extra status line. + HasStatusLine + + // The InsertNullGlitch [insert_null_glitch, in] bool capability indicates insert mode distinguishes nulls. + InsertNullGlitch + + // The MemoryAbove [memory_above, da] bool capability indicates display may be retained above the screen. + MemoryAbove + + // The MemoryBelow [memory_below, db] bool capability indicates display may be retained below the screen. + MemoryBelow + + // The MoveInsertMode [move_insert_mode, mir] bool capability indicates safe to move while in insert mode. + MoveInsertMode + + // The MoveStandoutMode [move_standout_mode, msgr] bool capability indicates safe to move while in standout mode. + MoveStandoutMode + + // The OverStrike [over_strike, os] bool capability indicates terminal can overstrike. + OverStrike + + // The StatusLineEscOk [status_line_esc_ok, eslok] bool capability indicates escape can be used on the status line. + StatusLineEscOk + + // The DestTabsMagicSmso [dest_tabs_magic_smso, xt] bool capability indicates tabs destructive, magic so char (t1061). + DestTabsMagicSmso + + // The TildeGlitch [tilde_glitch, hz] bool capability indicates cannot print ~'s (Hazeltine). + TildeGlitch + + // The TransparentUnderline [transparent_underline, ul] bool capability indicates underline character overstrikes. + TransparentUnderline + + // The XonXoff [xon_xoff, xon] bool capability indicates terminal uses xon/xoff handshaking. + XonXoff + + // The NeedsXonXoff [needs_xon_xoff, nxon] bool capability indicates padding will not work, xon/xoff required. + NeedsXonXoff + + // The PrtrSilent [prtr_silent, mc5i] bool capability indicates printer will not echo on screen. + PrtrSilent + + // The HardCursor [hard_cursor, chts] bool capability indicates cursor is hard to see. + HardCursor + + // The NonRevRmcup [non_rev_rmcup, nrrmc] bool capability indicates smcup does not reverse rmcup. + NonRevRmcup + + // The NoPadChar [no_pad_char, npc] bool capability indicates pad character does not exist. + NoPadChar + + // The NonDestScrollRegion [non_dest_scroll_region, ndscr] bool capability indicates scrolling region is non-destructive. + NonDestScrollRegion + + // The CanChange [can_change, ccc] bool capability indicates terminal can re-define existing colors. + CanChange + + // The BackColorErase [back_color_erase, bce] bool capability indicates screen erased with background color. + BackColorErase + + // The HueLightnessSaturation [hue_lightness_saturation, hls] bool capability indicates terminal uses only HLS color notation (Tektronix). + HueLightnessSaturation + + // The ColAddrGlitch [col_addr_glitch, xhpa] bool capability indicates only positive motion for hpa/mhpa caps. + ColAddrGlitch + + // The CrCancelsMicroMode [cr_cancels_micro_mode, crxm] bool capability indicates using cr turns off micro mode. + CrCancelsMicroMode + + // The HasPrintWheel [has_print_wheel, daisy] bool capability indicates printer needs operator to change character set. + HasPrintWheel + + // The RowAddrGlitch [row_addr_glitch, xvpa] bool capability indicates only positive motion for vpa/mvpa caps. + RowAddrGlitch + + // The SemiAutoRightMargin [semi_auto_right_margin, sam] bool capability indicates printing in last column causes cr. + SemiAutoRightMargin + + // The CpiChangesRes [cpi_changes_res, cpix] bool capability indicates changing character pitch changes resolution. + CpiChangesRes + + // The LpiChangesRes [lpi_changes_res, lpix] bool capability indicates changing line pitch changes resolution. + LpiChangesRes + + // The BackspacesWithBs [backspaces_with_bs, OTbs] bool capability indicates uses ^H to move left. + BackspacesWithBs + + // The CrtNoScrolling [crt_no_scrolling, OTns] bool capability indicates crt cannot scroll. + CrtNoScrolling + + // The NoCorrectlyWorkingCr [no_correctly_working_cr, OTnc] bool capability indicates no way to go to start of line. + NoCorrectlyWorkingCr + + // The GnuHasMetaKey [gnu_has_meta_key, OTMT] bool capability indicates has meta key. + GnuHasMetaKey + + // The LinefeedIsNewline [linefeed_is_newline, OTNL] bool capability indicates move down with \n. + LinefeedIsNewline + + // The HasHardwareTabs [has_hardware_tabs, OTpt] bool capability indicates has 8-char tabs invoked with ^I. + HasHardwareTabs + + // The ReturnDoesClrEol [return_does_clr_eol, OTxr] bool capability indicates return clears the line. + ReturnDoesClrEol +) + +// Num capabilities. +const ( + // The Columns [columns, cols] num capability is number of columns in a line. + Columns = iota + + // The InitTabs [init_tabs, it] num capability is tabs initially every # spaces. + InitTabs + + // The Lines [lines, lines] num capability is number of lines on screen or page. + Lines + + // The LinesOfMemory [lines_of_memory, lm] num capability is lines of memory if > line. 0 means varies. + LinesOfMemory + + // The MagicCookieGlitch [magic_cookie_glitch, xmc] num capability is number of blank characters left by smso or rmso. + MagicCookieGlitch + + // The PaddingBaudRate [padding_baud_rate, pb] num capability is lowest baud rate where padding needed. + PaddingBaudRate + + // The VirtualTerminal [virtual_terminal, vt] num capability is virtual terminal number (CB/unix). + VirtualTerminal + + // The WidthStatusLine [width_status_line, wsl] num capability is number of columns in status line. + WidthStatusLine + + // The NumLabels [num_labels, nlab] num capability is number of labels on screen. + NumLabels + + // The LabelHeight [label_height, lh] num capability is rows in each label. + LabelHeight + + // The LabelWidth [label_width, lw] num capability is columns in each label. + LabelWidth + + // The MaxAttributes [max_attributes, ma] num capability is maximum combined attributes terminal can handle. + MaxAttributes + + // The MaximumWindows [maximum_windows, wnum] num capability is maximum number of definable windows. + MaximumWindows + + // The MaxColors [max_colors, colors] num capability is maximum number of colors on screen. + MaxColors + + // The MaxPairs [max_pairs, pairs] num capability is maximum number of color-pairs on the screen. + MaxPairs + + // The NoColorVideo [no_color_video, ncv] num capability is video attributes that cannot be used with colors. + NoColorVideo + + // The BufferCapacity [buffer_capacity, bufsz] num capability is numbers of bytes buffered before printing. + BufferCapacity + + // The DotVertSpacing [dot_vert_spacing, spinv] num capability is spacing of pins vertically in pins per inch. + DotVertSpacing + + // The DotHorzSpacing [dot_horz_spacing, spinh] num capability is spacing of dots horizontally in dots per inch. + DotHorzSpacing + + // The MaxMicroAddress [max_micro_address, maddr] num capability is maximum value in micro_..._address. + MaxMicroAddress + + // The MaxMicroJump [max_micro_jump, mjump] num capability is maximum value in parm_..._micro. + MaxMicroJump + + // The MicroColSize [micro_col_size, mcs] num capability is character step size when in micro mode. + MicroColSize + + // The MicroLineSize [micro_line_size, mls] num capability is line step size when in micro mode. + MicroLineSize + + // The NumberOfPins [number_of_pins, npins] num capability is numbers of pins in print-head. + NumberOfPins + + // The OutputResChar [output_res_char, orc] num capability is horizontal resolution in units per line. + OutputResChar + + // The OutputResLine [output_res_line, orl] num capability is vertical resolution in units per line. + OutputResLine + + // The OutputResHorzInch [output_res_horz_inch, orhi] num capability is horizontal resolution in units per inch. + OutputResHorzInch + + // The OutputResVertInch [output_res_vert_inch, orvi] num capability is vertical resolution in units per inch. + OutputResVertInch + + // The PrintRate [print_rate, cps] num capability is print rate in characters per second. + PrintRate + + // The WideCharSize [wide_char_size, widcs] num capability is character step size when in double wide mode. + WideCharSize + + // The Buttons [buttons, btns] num capability is number of buttons on mouse. + Buttons + + // The BitImageEntwining [bit_image_entwining, bitwin] num capability is number of passes for each bit-image row. + BitImageEntwining + + // The BitImageType [bit_image_type, bitype] num capability is type of bit-image device. + BitImageType + + // The MagicCookieGlitchUl [magic_cookie_glitch_ul, OTug] num capability is number of blanks left by ul. + MagicCookieGlitchUl + + // The CarriageReturnDelay [carriage_return_delay, OTdC] num capability is pad needed for CR. + CarriageReturnDelay + + // The NewLineDelay [new_line_delay, OTdN] num capability is pad needed for LF. + NewLineDelay + + // The BackspaceDelay [backspace_delay, OTdB] num capability is padding required for ^H. + BackspaceDelay + + // The HorizontalTabDelay [horizontal_tab_delay, OTdT] num capability is padding required for ^I. + HorizontalTabDelay + + // The NumberOfFunctionKeys [number_of_function_keys, OTkn] num capability is count of function keys. + NumberOfFunctionKeys +) + +// String capabilities. +const ( + // The BackTab [back_tab, cbt] string capability is the back tab (P). + BackTab = iota + + // The Bell [bell, bel] string capability is the audible signal (bell) (P). + Bell + + // The CarriageReturn [carriage_return, cr] string capability is the carriage return (P*) (P*). + CarriageReturn + + // The ChangeScrollRegion [change_scroll_region, csr] string capability is the change region to line #1 to line #2 (P). + ChangeScrollRegion + + // The ClearAllTabs [clear_all_tabs, tbc] string capability is the clear all tab stops (P). + ClearAllTabs + + // The ClearScreen [clear_screen, clear] string capability is the clear screen and home cursor (P*). + ClearScreen + + // The ClrEol [clr_eol, el] string capability is the clear to end of line (P). + ClrEol + + // The ClrEos [clr_eos, ed] string capability is the clear to end of screen (P*). + ClrEos + + // The ColumnAddress [column_address, hpa] string capability is the horizontal position #1, absolute (P). + ColumnAddress + + // The CommandCharacter [command_character, cmdch] string capability is the terminal settable cmd character in prototype !?. + CommandCharacter + + // The CursorAddress [cursor_address, cup] string capability is the move to row #1 columns #2. + CursorAddress + + // The CursorDown [cursor_down, cud1] string capability is the down one line. + CursorDown + + // The CursorHome [cursor_home, home] string capability is the home cursor (if no cup). + CursorHome + + // The CursorInvisible [cursor_invisible, civis] string capability is the make cursor invisible. + CursorInvisible + + // The CursorLeft [cursor_left, cub1] string capability is the move left one space. + CursorLeft + + // The CursorMemAddress [cursor_mem_address, mrcup] string capability is the memory relative cursor addressing, move to row #1 columns #2. + CursorMemAddress + + // The CursorNormal [cursor_normal, cnorm] string capability is the make cursor appear normal (undo civis/cvvis). + CursorNormal + + // The CursorRight [cursor_right, cuf1] string capability is the non-destructive space (move right one space). + CursorRight + + // The CursorToLl [cursor_to_ll, ll] string capability is the last line, first column (if no cup). + CursorToLl + + // The CursorUp [cursor_up, cuu1] string capability is the up one line. + CursorUp + + // The CursorVisible [cursor_visible, cvvis] string capability is the make cursor very visible. + CursorVisible + + // The DeleteCharacter [delete_character, dch1] string capability is the delete character (P*). + DeleteCharacter + + // The DeleteLine [delete_line, dl1] string capability is the delete line (P*). + DeleteLine + + // The DisStatusLine [dis_status_line, dsl] string capability is the disable status line. + DisStatusLine + + // The DownHalfLine [down_half_line, hd] string capability is the half a line down. + DownHalfLine + + // The EnterAltCharsetMode [enter_alt_charset_mode, smacs] string capability is the start alternate character set (P). + EnterAltCharsetMode + + // The EnterBlinkMode [enter_blink_mode, blink] string capability is the turn on blinking. + EnterBlinkMode + + // The EnterBoldMode [enter_bold_mode, bold] string capability is the turn on bold (extra bright) mode. + EnterBoldMode + + // The EnterCaMode [enter_ca_mode, smcup] string capability is the string to start programs using cup. + EnterCaMode + + // The EnterDeleteMode [enter_delete_mode, smdc] string capability is the enter delete mode. + EnterDeleteMode + + // The EnterDimMode [enter_dim_mode, dim] string capability is the turn on half-bright mode. + EnterDimMode + + // The EnterInsertMode [enter_insert_mode, smir] string capability is the enter insert mode. + EnterInsertMode + + // The EnterSecureMode [enter_secure_mode, invis] string capability is the turn on blank mode (characters invisible). + EnterSecureMode + + // The EnterProtectedMode [enter_protected_mode, prot] string capability is the turn on protected mode. + EnterProtectedMode + + // The EnterReverseMode [enter_reverse_mode, rev] string capability is the turn on reverse video mode. + EnterReverseMode + + // The EnterStandoutMode [enter_standout_mode, smso] string capability is the begin standout mode. + EnterStandoutMode + + // The EnterUnderlineMode [enter_underline_mode, smul] string capability is the begin underline mode. + EnterUnderlineMode + + // The EraseChars [erase_chars, ech] string capability is the erase #1 characters (P). + EraseChars + + // The ExitAltCharsetMode [exit_alt_charset_mode, rmacs] string capability is the end alternate character set (P). + ExitAltCharsetMode + + // The ExitAttributeMode [exit_attribute_mode, sgr0] string capability is the turn off all attributes. + ExitAttributeMode + + // The ExitCaMode [exit_ca_mode, rmcup] string capability is the strings to end programs using cup. + ExitCaMode + + // The ExitDeleteMode [exit_delete_mode, rmdc] string capability is the end delete mode. + ExitDeleteMode + + // The ExitInsertMode [exit_insert_mode, rmir] string capability is the exit insert mode. + ExitInsertMode + + // The ExitStandoutMode [exit_standout_mode, rmso] string capability is the exit standout mode. + ExitStandoutMode + + // The ExitUnderlineMode [exit_underline_mode, rmul] string capability is the exit underline mode. + ExitUnderlineMode + + // The FlashScreen [flash_screen, flash] string capability is the visible bell (may not move cursor). + FlashScreen + + // The FormFeed [form_feed, ff] string capability is the hardcopy terminal page eject (P*). + FormFeed + + // The FromStatusLine [from_status_line, fsl] string capability is the return from status line. + FromStatusLine + + // The Init1string [init_1string, is1] string capability is the initialization string. + Init1string + + // The Init2string [init_2string, is2] string capability is the initialization string. + Init2string + + // The Init3string [init_3string, is3] string capability is the initialization string. + Init3string + + // The InitFile [init_file, if] string capability is the name of initialization file. + InitFile + + // The InsertCharacter [insert_character, ich1] string capability is the insert character (P). + InsertCharacter + + // The InsertLine [insert_line, il1] string capability is the insert line (P*). + InsertLine + + // The InsertPadding [insert_padding, ip] string capability is the insert padding after inserted character. + InsertPadding + + // The KeyBackspace [key_backspace, kbs] string capability is the backspace key. + KeyBackspace + + // The KeyCatab [key_catab, ktbc] string capability is the clear-all-tabs key. + KeyCatab + + // The KeyClear [key_clear, kclr] string capability is the clear-screen or erase key. + KeyClear + + // The KeyCtab [key_ctab, kctab] string capability is the clear-tab key. + KeyCtab + + // The KeyDc [key_dc, kdch1] string capability is the delete-character key. + KeyDc + + // The KeyDl [key_dl, kdl1] string capability is the delete-line key. + KeyDl + + // The KeyDown [key_down, kcud1] string capability is the down-arrow key. + KeyDown + + // The KeyEic [key_eic, krmir] string capability is the sent by rmir or smir in insert mode. + KeyEic + + // The KeyEol [key_eol, kel] string capability is the clear-to-end-of-line key. + KeyEol + + // The KeyEos [key_eos, ked] string capability is the clear-to-end-of-screen key. + KeyEos + + // The KeyF0 [key_f0, kf0] string capability is the F0 function key. + KeyF0 + + // The KeyF1 [key_f1, kf1] string capability is the F1 function key. + KeyF1 + + // The KeyF10 [key_f10, kf10] string capability is the F10 function key. + KeyF10 + + // The KeyF2 [key_f2, kf2] string capability is the F2 function key. + KeyF2 + + // The KeyF3 [key_f3, kf3] string capability is the F3 function key. + KeyF3 + + // The KeyF4 [key_f4, kf4] string capability is the F4 function key. + KeyF4 + + // The KeyF5 [key_f5, kf5] string capability is the F5 function key. + KeyF5 + + // The KeyF6 [key_f6, kf6] string capability is the F6 function key. + KeyF6 + + // The KeyF7 [key_f7, kf7] string capability is the F7 function key. + KeyF7 + + // The KeyF8 [key_f8, kf8] string capability is the F8 function key. + KeyF8 + + // The KeyF9 [key_f9, kf9] string capability is the F9 function key. + KeyF9 + + // The KeyHome [key_home, khome] string capability is the home key. + KeyHome + + // The KeyIc [key_ic, kich1] string capability is the insert-character key. + KeyIc + + // The KeyIl [key_il, kil1] string capability is the insert-line key. + KeyIl + + // The KeyLeft [key_left, kcub1] string capability is the left-arrow key. + KeyLeft + + // The KeyLl [key_ll, kll] string capability is the lower-left key (home down). + KeyLl + + // The KeyNpage [key_npage, knp] string capability is the next-page key. + KeyNpage + + // The KeyPpage [key_ppage, kpp] string capability is the previous-page key. + KeyPpage + + // The KeyRight [key_right, kcuf1] string capability is the right-arrow key. + KeyRight + + // The KeySf [key_sf, kind] string capability is the scroll-forward key. + KeySf + + // The KeySr [key_sr, kri] string capability is the scroll-backward key. + KeySr + + // The KeyStab [key_stab, khts] string capability is the set-tab key. + KeyStab + + // The KeyUp [key_up, kcuu1] string capability is the up-arrow key. + KeyUp + + // The KeypadLocal [keypad_local, rmkx] string capability is the leave 'keyboard_transmit' mode. + KeypadLocal + + // The KeypadXmit [keypad_xmit, smkx] string capability is the enter 'keyboard_transmit' mode. + KeypadXmit + + // The LabF0 [lab_f0, lf0] string capability is the label on function key f0 if not f0. + LabF0 + + // The LabF1 [lab_f1, lf1] string capability is the label on function key f1 if not f1. + LabF1 + + // The LabF10 [lab_f10, lf10] string capability is the label on function key f10 if not f10. + LabF10 + + // The LabF2 [lab_f2, lf2] string capability is the label on function key f2 if not f2. + LabF2 + + // The LabF3 [lab_f3, lf3] string capability is the label on function key f3 if not f3. + LabF3 + + // The LabF4 [lab_f4, lf4] string capability is the label on function key f4 if not f4. + LabF4 + + // The LabF5 [lab_f5, lf5] string capability is the label on function key f5 if not f5. + LabF5 + + // The LabF6 [lab_f6, lf6] string capability is the label on function key f6 if not f6. + LabF6 + + // The LabF7 [lab_f7, lf7] string capability is the label on function key f7 if not f7. + LabF7 + + // The LabF8 [lab_f8, lf8] string capability is the label on function key f8 if not f8. + LabF8 + + // The LabF9 [lab_f9, lf9] string capability is the label on function key f9 if not f9. + LabF9 + + // The MetaOff [meta_off, rmm] string capability is the turn off meta mode. + MetaOff + + // The MetaOn [meta_on, smm] string capability is the turn on meta mode (8th-bit on). + MetaOn + + // The Newline [newline, nel] string capability is the newline (behave like cr followed by lf). + Newline + + // The PadChar [pad_char, pad] string capability is the padding char (instead of null). + PadChar + + // The ParmDch [parm_dch, dch] string capability is the delete #1 characters (P*). + ParmDch + + // The ParmDeleteLine [parm_delete_line, dl] string capability is the delete #1 lines (P*). + ParmDeleteLine + + // The ParmDownCursor [parm_down_cursor, cud] string capability is the down #1 lines (P*). + ParmDownCursor + + // The ParmIch [parm_ich, ich] string capability is the insert #1 characters (P*). + ParmIch + + // The ParmIndex [parm_index, indn] string capability is the scroll forward #1 lines (P). + ParmIndex + + // The ParmInsertLine [parm_insert_line, il] string capability is the insert #1 lines (P*). + ParmInsertLine + + // The ParmLeftCursor [parm_left_cursor, cub] string capability is the move #1 characters to the left (P). + ParmLeftCursor + + // The ParmRightCursor [parm_right_cursor, cuf] string capability is the move #1 characters to the right (P*). + ParmRightCursor + + // The ParmRindex [parm_rindex, rin] string capability is the scroll back #1 lines (P). + ParmRindex + + // The ParmUpCursor [parm_up_cursor, cuu] string capability is the up #1 lines (P*). + ParmUpCursor + + // The PkeyKey [pkey_key, pfkey] string capability is the program function key #1 to type string #2. + PkeyKey + + // The PkeyLocal [pkey_local, pfloc] string capability is the program function key #1 to execute string #2. + PkeyLocal + + // The PkeyXmit [pkey_xmit, pfx] string capability is the program function key #1 to transmit string #2. + PkeyXmit + + // The PrintScreen [print_screen, mc0] string capability is the print contents of screen. + PrintScreen + + // The PrtrOff [prtr_off, mc4] string capability is the turn off printer. + PrtrOff + + // The PrtrOn [prtr_on, mc5] string capability is the turn on printer. + PrtrOn + + // The RepeatChar [repeat_char, rep] string capability is the repeat char #1 #2 times (P*). + RepeatChar + + // The Reset1string [reset_1string, rs1] string capability is the reset string. + Reset1string + + // The Reset2string [reset_2string, rs2] string capability is the reset string. + Reset2string + + // The Reset3string [reset_3string, rs3] string capability is the reset string. + Reset3string + + // The ResetFile [reset_file, rf] string capability is the name of reset file. + ResetFile + + // The RestoreCursor [restore_cursor, rc] string capability is the restore cursor to position of last save_cursor. + RestoreCursor + + // The RowAddress [row_address, vpa] string capability is the vertical position #1 absolute (P). + RowAddress + + // The SaveCursor [save_cursor, sc] string capability is the save current cursor position (P). + SaveCursor + + // The ScrollForward [scroll_forward, ind] string capability is the scroll text up (P). + ScrollForward + + // The ScrollReverse [scroll_reverse, ri] string capability is the scroll text down (P). + ScrollReverse + + // The SetAttributes [set_attributes, sgr] string capability is the define video attributes #1-#9 (PG9). + SetAttributes + + // The SetTab [set_tab, hts] string capability is the set a tab in every row, current columns. + SetTab + + // The SetWindow [set_window, wind] string capability is the current window is lines #1-#2 cols #3-#4. + SetWindow + + // The Tab [tab, ht] string capability is the tab to next 8-space hardware tab stop. + Tab + + // The ToStatusLine [to_status_line, tsl] string capability is the move to status line, column #1. + ToStatusLine + + // The UnderlineChar [underline_char, uc] string capability is the underline char and move past it. + UnderlineChar + + // The UpHalfLine [up_half_line, hu] string capability is the half a line up. + UpHalfLine + + // The InitProg [init_prog, iprog] string capability is the path name of program for initialization. + InitProg + + // The KeyA1 [key_a1, ka1] string capability is the upper left of keypad. + KeyA1 + + // The KeyA3 [key_a3, ka3] string capability is the upper right of keypad. + KeyA3 + + // The KeyB2 [key_b2, kb2] string capability is the center of keypad. + KeyB2 + + // The KeyC1 [key_c1, kc1] string capability is the lower left of keypad. + KeyC1 + + // The KeyC3 [key_c3, kc3] string capability is the lower right of keypad. + KeyC3 + + // The PrtrNon [prtr_non, mc5p] string capability is the turn on printer for #1 bytes. + PrtrNon + + // The CharPadding [char_padding, rmp] string capability is the like ip but when in insert mode. + CharPadding + + // The AcsChars [acs_chars, acsc] string capability is the graphics charset pairs, based on vt100. + AcsChars + + // The PlabNorm [plab_norm, pln] string capability is the program label #1 to show string #2. + PlabNorm + + // The KeyBtab [key_btab, kcbt] string capability is the back-tab key. + KeyBtab + + // The EnterXonMode [enter_xon_mode, smxon] string capability is the turn on xon/xoff handshaking. + EnterXonMode + + // The ExitXonMode [exit_xon_mode, rmxon] string capability is the turn off xon/xoff handshaking. + ExitXonMode + + // The EnterAmMode [enter_am_mode, smam] string capability is the turn on automatic margins. + EnterAmMode + + // The ExitAmMode [exit_am_mode, rmam] string capability is the turn off automatic margins. + ExitAmMode + + // The XonCharacter [xon_character, xonc] string capability is the XON character. + XonCharacter + + // The XoffCharacter [xoff_character, xoffc] string capability is the XOFF character. + XoffCharacter + + // The EnaAcs [ena_acs, enacs] string capability is the enable alternate char set. + EnaAcs + + // The LabelOn [label_on, smln] string capability is the turn on soft labels. + LabelOn + + // The LabelOff [label_off, rmln] string capability is the turn off soft labels. + LabelOff + + // The KeyBeg [key_beg, kbeg] string capability is the begin key. + KeyBeg + + // The KeyCancel [key_cancel, kcan] string capability is the cancel key. + KeyCancel + + // The KeyClose [key_close, kclo] string capability is the close key. + KeyClose + + // The KeyCommand [key_command, kcmd] string capability is the command key. + KeyCommand + + // The KeyCopy [key_copy, kcpy] string capability is the copy key. + KeyCopy + + // The KeyCreate [key_create, kcrt] string capability is the create key. + KeyCreate + + // The KeyEnd [key_end, kend] string capability is the end key. + KeyEnd + + // The KeyEnter [key_enter, kent] string capability is the enter/send key. + KeyEnter + + // The KeyExit [key_exit, kext] string capability is the exit key. + KeyExit + + // The KeyFind [key_find, kfnd] string capability is the find key. + KeyFind + + // The KeyHelp [key_help, khlp] string capability is the help key. + KeyHelp + + // The KeyMark [key_mark, kmrk] string capability is the mark key. + KeyMark + + // The KeyMessage [key_message, kmsg] string capability is the message key. + KeyMessage + + // The KeyMove [key_move, kmov] string capability is the move key. + KeyMove + + // The KeyNext [key_next, knxt] string capability is the next key. + KeyNext + + // The KeyOpen [key_open, kopn] string capability is the open key. + KeyOpen + + // The KeyOptions [key_options, kopt] string capability is the options key. + KeyOptions + + // The KeyPrevious [key_previous, kprv] string capability is the previous key. + KeyPrevious + + // The KeyPrint [key_print, kprt] string capability is the print key. + KeyPrint + + // The KeyRedo [key_redo, krdo] string capability is the redo key. + KeyRedo + + // The KeyReference [key_reference, kref] string capability is the reference key. + KeyReference + + // The KeyRefresh [key_refresh, krfr] string capability is the refresh key. + KeyRefresh + + // The KeyReplace [key_replace, krpl] string capability is the replace key. + KeyReplace + + // The KeyRestart [key_restart, krst] string capability is the restart key. + KeyRestart + + // The KeyResume [key_resume, kres] string capability is the resume key. + KeyResume + + // The KeySave [key_save, ksav] string capability is the save key. + KeySave + + // The KeySuspend [key_suspend, kspd] string capability is the suspend key. + KeySuspend + + // The KeyUndo [key_undo, kund] string capability is the undo key. + KeyUndo + + // The KeySbeg [key_sbeg, kBEG] string capability is the shifted begin key. + KeySbeg + + // The KeyScancel [key_scancel, kCAN] string capability is the shifted cancel key. + KeyScancel + + // The KeyScommand [key_scommand, kCMD] string capability is the shifted command key. + KeyScommand + + // The KeyScopy [key_scopy, kCPY] string capability is the shifted copy key. + KeyScopy + + // The KeyScreate [key_screate, kCRT] string capability is the shifted create key. + KeyScreate + + // The KeySdc [key_sdc, kDC] string capability is the shifted delete-character key. + KeySdc + + // The KeySdl [key_sdl, kDL] string capability is the shifted delete-line key. + KeySdl + + // The KeySelect [key_select, kslt] string capability is the select key. + KeySelect + + // The KeySend [key_send, kEND] string capability is the shifted end key. + KeySend + + // The KeySeol [key_seol, kEOL] string capability is the shifted clear-to-end-of-line key. + KeySeol + + // The KeySexit [key_sexit, kEXT] string capability is the shifted exit key. + KeySexit + + // The KeySfind [key_sfind, kFND] string capability is the shifted find key. + KeySfind + + // The KeyShelp [key_shelp, kHLP] string capability is the shifted help key. + KeyShelp + + // The KeyShome [key_shome, kHOM] string capability is the shifted home key. + KeyShome + + // The KeySic [key_sic, kIC] string capability is the shifted insert-character key. + KeySic + + // The KeySleft [key_sleft, kLFT] string capability is the shifted left-arrow key. + KeySleft + + // The KeySmessage [key_smessage, kMSG] string capability is the shifted message key. + KeySmessage + + // The KeySmove [key_smove, kMOV] string capability is the shifted move key. + KeySmove + + // The KeySnext [key_snext, kNXT] string capability is the shifted next key. + KeySnext + + // The KeySoptions [key_soptions, kOPT] string capability is the shifted options key. + KeySoptions + + // The KeySprevious [key_sprevious, kPRV] string capability is the shifted previous key. + KeySprevious + + // The KeySprint [key_sprint, kPRT] string capability is the shifted print key. + KeySprint + + // The KeySredo [key_sredo, kRDO] string capability is the shifted redo key. + KeySredo + + // The KeySreplace [key_sreplace, kRPL] string capability is the shifted replace key. + KeySreplace + + // The KeySright [key_sright, kRIT] string capability is the shifted right-arrow key. + KeySright + + // The KeySrsume [key_srsume, kRES] string capability is the shifted resume key. + KeySrsume + + // The KeySsave [key_ssave, kSAV] string capability is the shifted save key. + KeySsave + + // The KeySsuspend [key_ssuspend, kSPD] string capability is the shifted suspend key. + KeySsuspend + + // The KeySundo [key_sundo, kUND] string capability is the shifted undo key. + KeySundo + + // The ReqForInput [req_for_input, rfi] string capability is the send next input char (for ptys). + ReqForInput + + // The KeyF11 [key_f11, kf11] string capability is the F11 function key. + KeyF11 + + // The KeyF12 [key_f12, kf12] string capability is the F12 function key. + KeyF12 + + // The KeyF13 [key_f13, kf13] string capability is the F13 function key. + KeyF13 + + // The KeyF14 [key_f14, kf14] string capability is the F14 function key. + KeyF14 + + // The KeyF15 [key_f15, kf15] string capability is the F15 function key. + KeyF15 + + // The KeyF16 [key_f16, kf16] string capability is the F16 function key. + KeyF16 + + // The KeyF17 [key_f17, kf17] string capability is the F17 function key. + KeyF17 + + // The KeyF18 [key_f18, kf18] string capability is the F18 function key. + KeyF18 + + // The KeyF19 [key_f19, kf19] string capability is the F19 function key. + KeyF19 + + // The KeyF20 [key_f20, kf20] string capability is the F20 function key. + KeyF20 + + // The KeyF21 [key_f21, kf21] string capability is the F21 function key. + KeyF21 + + // The KeyF22 [key_f22, kf22] string capability is the F22 function key. + KeyF22 + + // The KeyF23 [key_f23, kf23] string capability is the F23 function key. + KeyF23 + + // The KeyF24 [key_f24, kf24] string capability is the F24 function key. + KeyF24 + + // The KeyF25 [key_f25, kf25] string capability is the F25 function key. + KeyF25 + + // The KeyF26 [key_f26, kf26] string capability is the F26 function key. + KeyF26 + + // The KeyF27 [key_f27, kf27] string capability is the F27 function key. + KeyF27 + + // The KeyF28 [key_f28, kf28] string capability is the F28 function key. + KeyF28 + + // The KeyF29 [key_f29, kf29] string capability is the F29 function key. + KeyF29 + + // The KeyF30 [key_f30, kf30] string capability is the F30 function key. + KeyF30 + + // The KeyF31 [key_f31, kf31] string capability is the F31 function key. + KeyF31 + + // The KeyF32 [key_f32, kf32] string capability is the F32 function key. + KeyF32 + + // The KeyF33 [key_f33, kf33] string capability is the F33 function key. + KeyF33 + + // The KeyF34 [key_f34, kf34] string capability is the F34 function key. + KeyF34 + + // The KeyF35 [key_f35, kf35] string capability is the F35 function key. + KeyF35 + + // The KeyF36 [key_f36, kf36] string capability is the F36 function key. + KeyF36 + + // The KeyF37 [key_f37, kf37] string capability is the F37 function key. + KeyF37 + + // The KeyF38 [key_f38, kf38] string capability is the F38 function key. + KeyF38 + + // The KeyF39 [key_f39, kf39] string capability is the F39 function key. + KeyF39 + + // The KeyF40 [key_f40, kf40] string capability is the F40 function key. + KeyF40 + + // The KeyF41 [key_f41, kf41] string capability is the F41 function key. + KeyF41 + + // The KeyF42 [key_f42, kf42] string capability is the F42 function key. + KeyF42 + + // The KeyF43 [key_f43, kf43] string capability is the F43 function key. + KeyF43 + + // The KeyF44 [key_f44, kf44] string capability is the F44 function key. + KeyF44 + + // The KeyF45 [key_f45, kf45] string capability is the F45 function key. + KeyF45 + + // The KeyF46 [key_f46, kf46] string capability is the F46 function key. + KeyF46 + + // The KeyF47 [key_f47, kf47] string capability is the F47 function key. + KeyF47 + + // The KeyF48 [key_f48, kf48] string capability is the F48 function key. + KeyF48 + + // The KeyF49 [key_f49, kf49] string capability is the F49 function key. + KeyF49 + + // The KeyF50 [key_f50, kf50] string capability is the F50 function key. + KeyF50 + + // The KeyF51 [key_f51, kf51] string capability is the F51 function key. + KeyF51 + + // The KeyF52 [key_f52, kf52] string capability is the F52 function key. + KeyF52 + + // The KeyF53 [key_f53, kf53] string capability is the F53 function key. + KeyF53 + + // The KeyF54 [key_f54, kf54] string capability is the F54 function key. + KeyF54 + + // The KeyF55 [key_f55, kf55] string capability is the F55 function key. + KeyF55 + + // The KeyF56 [key_f56, kf56] string capability is the F56 function key. + KeyF56 + + // The KeyF57 [key_f57, kf57] string capability is the F57 function key. + KeyF57 + + // The KeyF58 [key_f58, kf58] string capability is the F58 function key. + KeyF58 + + // The KeyF59 [key_f59, kf59] string capability is the F59 function key. + KeyF59 + + // The KeyF60 [key_f60, kf60] string capability is the F60 function key. + KeyF60 + + // The KeyF61 [key_f61, kf61] string capability is the F61 function key. + KeyF61 + + // The KeyF62 [key_f62, kf62] string capability is the F62 function key. + KeyF62 + + // The KeyF63 [key_f63, kf63] string capability is the F63 function key. + KeyF63 + + // The ClrBol [clr_bol, el1] string capability is the Clear to beginning of line. + ClrBol + + // The ClearMargins [clear_margins, mgc] string capability is the clear right and left soft margins. + ClearMargins + + // The SetLeftMargin [set_left_margin, smgl] string capability is the set left soft margin at current column. See smgl. (ML is not in BSD termcap). + SetLeftMargin + + // The SetRightMargin [set_right_margin, smgr] string capability is the set right soft margin at current column. + SetRightMargin + + // The LabelFormat [label_format, fln] string capability is the label format. + LabelFormat + + // The SetClock [set_clock, sclk] string capability is the set clock, #1 hrs #2 mins #3 secs. + SetClock + + // The DisplayClock [display_clock, dclk] string capability is the display clock. + DisplayClock + + // The RemoveClock [remove_clock, rmclk] string capability is the remove clock. + RemoveClock + + // The CreateWindow [create_window, cwin] string capability is the define a window #1 from #2,#3 to #4,#5. + CreateWindow + + // The GotoWindow [goto_window, wingo] string capability is the go to window #1. + GotoWindow + + // The Hangup [hangup, hup] string capability is the hang-up phone. + Hangup + + // The DialPhone [dial_phone, dial] string capability is the dial number #1. + DialPhone + + // The QuickDial [quick_dial, qdial] string capability is the dial number #1 without checking. + QuickDial + + // The Tone [tone, tone] string capability is the select touch tone dialing. + Tone + + // The Pulse [pulse, pulse] string capability is the select pulse dialing. + Pulse + + // The FlashHook [flash_hook, hook] string capability is the flash switch hook. + FlashHook + + // The FixedPause [fixed_pause, pause] string capability is the pause for 2-3 seconds. + FixedPause + + // The WaitTone [wait_tone, wait] string capability is the wait for dial-tone. + WaitTone + + // The User0 [user0, u0] string capability is the User string #0. + User0 + + // The User1 [user1, u1] string capability is the User string #1. + User1 + + // The User2 [user2, u2] string capability is the User string #2. + User2 + + // The User3 [user3, u3] string capability is the User string #3. + User3 + + // The User4 [user4, u4] string capability is the User string #4. + User4 + + // The User5 [user5, u5] string capability is the User string #5. + User5 + + // The User6 [user6, u6] string capability is the User string #6. + User6 + + // The User7 [user7, u7] string capability is the User string #7. + User7 + + // The User8 [user8, u8] string capability is the User string #8. + User8 + + // The User9 [user9, u9] string capability is the User string #9. + User9 + + // The OrigPair [orig_pair, op] string capability is the Set default pair to its original value. + OrigPair + + // The OrigColors [orig_colors, oc] string capability is the Set all color pairs to the original ones. + OrigColors + + // The InitializeColor [initialize_color, initc] string capability is the initialize color #1 to (#2,#3,#4). + InitializeColor + + // The InitializePair [initialize_pair, initp] string capability is the Initialize color pair #1 to fg=(#2,#3,#4), bg=(#5,#6,#7). + InitializePair + + // The SetColorPair [set_color_pair, scp] string capability is the Set current color pair to #1. + SetColorPair + + // The SetForeground [set_foreground, setf] string capability is the Set foreground color #1. + SetForeground + + // The SetBackground [set_background, setb] string capability is the Set background color #1. + SetBackground + + // The ChangeCharPitch [change_char_pitch, cpi] string capability is the Change number of characters per inch to #1. + ChangeCharPitch + + // The ChangeLinePitch [change_line_pitch, lpi] string capability is the Change number of lines per inch to #1. + ChangeLinePitch + + // The ChangeResHorz [change_res_horz, chr] string capability is the Change horizontal resolution to #1. + ChangeResHorz + + // The ChangeResVert [change_res_vert, cvr] string capability is the Change vertical resolution to #1. + ChangeResVert + + // The DefineChar [define_char, defc] string capability is the Define a character #1, #2 dots wide, descender #3. + DefineChar + + // The EnterDoublewideMode [enter_doublewide_mode, swidm] string capability is the Enter double-wide mode. + EnterDoublewideMode + + // The EnterDraftQuality [enter_draft_quality, sdrfq] string capability is the Enter draft-quality mode. + EnterDraftQuality + + // The EnterItalicsMode [enter_italics_mode, sitm] string capability is the Enter italic mode. + EnterItalicsMode + + // The EnterLeftwardMode [enter_leftward_mode, slm] string capability is the Start leftward carriage motion. + EnterLeftwardMode + + // The EnterMicroMode [enter_micro_mode, smicm] string capability is the Start micro-motion mode. + EnterMicroMode + + // The EnterNearLetterQuality [enter_near_letter_quality, snlq] string capability is the Enter NLQ mode. + EnterNearLetterQuality + + // The EnterNormalQuality [enter_normal_quality, snrmq] string capability is the Enter normal-quality mode. + EnterNormalQuality + + // The EnterShadowMode [enter_shadow_mode, sshm] string capability is the Enter shadow-print mode. + EnterShadowMode + + // The EnterSubscriptMode [enter_subscript_mode, ssubm] string capability is the Enter subscript mode. + EnterSubscriptMode + + // The EnterSuperscriptMode [enter_superscript_mode, ssupm] string capability is the Enter superscript mode. + EnterSuperscriptMode + + // The EnterUpwardMode [enter_upward_mode, sum] string capability is the Start upward carriage motion. + EnterUpwardMode + + // The ExitDoublewideMode [exit_doublewide_mode, rwidm] string capability is the End double-wide mode. + ExitDoublewideMode + + // The ExitItalicsMode [exit_italics_mode, ritm] string capability is the End italic mode. + ExitItalicsMode + + // The ExitLeftwardMode [exit_leftward_mode, rlm] string capability is the End left-motion mode. + ExitLeftwardMode + + // The ExitMicroMode [exit_micro_mode, rmicm] string capability is the End micro-motion mode. + ExitMicroMode + + // The ExitShadowMode [exit_shadow_mode, rshm] string capability is the End shadow-print mode. + ExitShadowMode + + // The ExitSubscriptMode [exit_subscript_mode, rsubm] string capability is the End subscript mode. + ExitSubscriptMode + + // The ExitSuperscriptMode [exit_superscript_mode, rsupm] string capability is the End superscript mode. + ExitSuperscriptMode + + // The ExitUpwardMode [exit_upward_mode, rum] string capability is the End reverse character motion. + ExitUpwardMode + + // The MicroColumnAddress [micro_column_address, mhpa] string capability is the Like column_address in micro mode. + MicroColumnAddress + + // The MicroDown [micro_down, mcud1] string capability is the Like cursor_down in micro mode. + MicroDown + + // The MicroLeft [micro_left, mcub1] string capability is the Like cursor_left in micro mode. + MicroLeft + + // The MicroRight [micro_right, mcuf1] string capability is the Like cursor_right in micro mode. + MicroRight + + // The MicroRowAddress [micro_row_address, mvpa] string capability is the Like row_address #1 in micro mode. + MicroRowAddress + + // The MicroUp [micro_up, mcuu1] string capability is the Like cursor_up in micro mode. + MicroUp + + // The OrderOfPins [order_of_pins, porder] string capability is the Match software bits to print-head pins. + OrderOfPins + + // The ParmDownMicro [parm_down_micro, mcud] string capability is the Like parm_down_cursor in micro mode. + ParmDownMicro + + // The ParmLeftMicro [parm_left_micro, mcub] string capability is the Like parm_left_cursor in micro mode. + ParmLeftMicro + + // The ParmRightMicro [parm_right_micro, mcuf] string capability is the Like parm_right_cursor in micro mode. + ParmRightMicro + + // The ParmUpMicro [parm_up_micro, mcuu] string capability is the Like parm_up_cursor in micro mode. + ParmUpMicro + + // The SelectCharSet [select_char_set, scs] string capability is the Select character set, #1. + SelectCharSet + + // The SetBottomMargin [set_bottom_margin, smgb] string capability is the Set bottom margin at current line. + SetBottomMargin + + // The SetBottomMarginParm [set_bottom_margin_parm, smgbp] string capability is the Set bottom margin at line #1 or (if smgtp is not given) #2 lines from bottom. + SetBottomMarginParm + + // The SetLeftMarginParm [set_left_margin_parm, smglp] string capability is the Set left (right) margin at column #1. + SetLeftMarginParm + + // The SetRightMarginParm [set_right_margin_parm, smgrp] string capability is the Set right margin at column #1. + SetRightMarginParm + + // The SetTopMargin [set_top_margin, smgt] string capability is the Set top margin at current line. + SetTopMargin + + // The SetTopMarginParm [set_top_margin_parm, smgtp] string capability is the Set top (bottom) margin at row #1. + SetTopMarginParm + + // The StartBitImage [start_bit_image, sbim] string capability is the Start printing bit image graphics. + StartBitImage + + // The StartCharSetDef [start_char_set_def, scsd] string capability is the Start character set definition #1, with #2 characters in the set. + StartCharSetDef + + // The StopBitImage [stop_bit_image, rbim] string capability is the Stop printing bit image graphics. + StopBitImage + + // The StopCharSetDef [stop_char_set_def, rcsd] string capability is the End definition of character set #1. + StopCharSetDef + + // The SubscriptCharacters [subscript_characters, subcs] string capability is the List of subscriptable characters. + SubscriptCharacters + + // The SuperscriptCharacters [superscript_characters, supcs] string capability is the List of superscriptable characters. + SuperscriptCharacters + + // The TheseCauseCr [these_cause_cr, docr] string capability is the Printing any of these characters causes CR. + TheseCauseCr + + // The ZeroMotion [zero_motion, zerom] string capability is the No motion for subsequent character. + ZeroMotion + + // The CharSetNames [char_set_names, csnm] string capability is the Produce #1'th item from list of character set names. + CharSetNames + + // The KeyMouse [key_mouse, kmous] string capability is the Mouse event has occurred. + KeyMouse + + // The MouseInfo [mouse_info, minfo] string capability is the Mouse status information. + MouseInfo + + // The ReqMousePos [req_mouse_pos, reqmp] string capability is the Request mouse position. + ReqMousePos + + // The GetMouse [get_mouse, getm] string capability is the Curses should get button events, parameter #1 not documented. + GetMouse + + // The SetAForeground [set_a_foreground, setaf] string capability is the Set foreground color to #1, using ANSI escape. + SetAForeground + + // The SetABackground [set_a_background, setab] string capability is the Set background color to #1, using ANSI escape. + SetABackground + + // The PkeyPlab [pkey_plab, pfxl] string capability is the Program function key #1 to type string #2 and show string #3. + PkeyPlab + + // The DeviceType [device_type, devt] string capability is the Indicate language/codeset support. + DeviceType + + // The CodeSetInit [code_set_init, csin] string capability is the Init sequence for multiple codesets. + CodeSetInit + + // The Set0DesSeq [set0_des_seq, s0ds] string capability is the Shift to codeset 0 (EUC set 0, ASCII). + Set0DesSeq + + // The Set1DesSeq [set1_des_seq, s1ds] string capability is the Shift to codeset 1. + Set1DesSeq + + // The Set2DesSeq [set2_des_seq, s2ds] string capability is the Shift to codeset 2. + Set2DesSeq + + // The Set3DesSeq [set3_des_seq, s3ds] string capability is the Shift to codeset 3. + Set3DesSeq + + // The SetLrMargin [set_lr_margin, smglr] string capability is the Set both left and right margins to #1, #2. (ML is not in BSD termcap). + SetLrMargin + + // The SetTbMargin [set_tb_margin, smgtb] string capability is the Sets both top and bottom margins to #1, #2. + SetTbMargin + + // The BitImageRepeat [bit_image_repeat, birep] string capability is the Repeat bit image cell #1 #2 times. + BitImageRepeat + + // The BitImageNewline [bit_image_newline, binel] string capability is the Move to next row of the bit image. + BitImageNewline + + // The BitImageCarriageReturn [bit_image_carriage_return, bicr] string capability is the Move to beginning of same row. + BitImageCarriageReturn + + // The ColorNames [color_names, colornm] string capability is the Give name for color #1. + ColorNames + + // The DefineBitImageRegion [define_bit_image_region, defbi] string capability is the Define rectangular bit image region. + DefineBitImageRegion + + // The EndBitImageRegion [end_bit_image_region, endbi] string capability is the End a bit-image region. + EndBitImageRegion + + // The SetColorBand [set_color_band, setcolor] string capability is the Change to ribbon color #1. + SetColorBand + + // The SetPageLength [set_page_length, slines] string capability is the Set page length to #1 lines. + SetPageLength + + // The DisplayPcChar [display_pc_char, dispc] string capability is the Display PC character #1. + DisplayPcChar + + // The EnterPcCharsetMode [enter_pc_charset_mode, smpch] string capability is the Enter PC character display mode. + EnterPcCharsetMode + + // The ExitPcCharsetMode [exit_pc_charset_mode, rmpch] string capability is the Exit PC character display mode. + ExitPcCharsetMode + + // The EnterScancodeMode [enter_scancode_mode, smsc] string capability is the Enter PC scancode mode. + EnterScancodeMode + + // The ExitScancodeMode [exit_scancode_mode, rmsc] string capability is the Exit PC scancode mode. + ExitScancodeMode + + // The PcTermOptions [pc_term_options, pctrm] string capability is the PC terminal options. + PcTermOptions + + // The ScancodeEscape [scancode_escape, scesc] string capability is the Escape for scancode emulation. + ScancodeEscape + + // The AltScancodeEsc [alt_scancode_esc, scesa] string capability is the Alternate escape for scancode emulation. + AltScancodeEsc + + // The EnterHorizontalHlMode [enter_horizontal_hl_mode, ehhlm] string capability is the Enter horizontal highlight mode. + EnterHorizontalHlMode + + // The EnterLeftHlMode [enter_left_hl_mode, elhlm] string capability is the Enter left highlight mode. + EnterLeftHlMode + + // The EnterLowHlMode [enter_low_hl_mode, elohlm] string capability is the Enter low highlight mode. + EnterLowHlMode + + // The EnterRightHlMode [enter_right_hl_mode, erhlm] string capability is the Enter right highlight mode. + EnterRightHlMode + + // The EnterTopHlMode [enter_top_hl_mode, ethlm] string capability is the Enter top highlight mode. + EnterTopHlMode + + // The EnterVerticalHlMode [enter_vertical_hl_mode, evhlm] string capability is the Enter vertical highlight mode. + EnterVerticalHlMode + + // The SetAAttributes [set_a_attributes, sgr1] string capability is the Define second set of video attributes #1-#6. + SetAAttributes + + // The SetPglenInch [set_pglen_inch, slength] string capability is the Set page length to #1 hundredth of an inch (some implementations use sL for termcap). + SetPglenInch + + // The TermcapInit2 [termcap_init2, OTi2] string capability is the secondary initialization string. + TermcapInit2 + + // The TermcapReset [termcap_reset, OTrs] string capability is the terminal reset string. + TermcapReset + + // The LinefeedIfNotLf [linefeed_if_not_lf, OTnl] string capability is the use to move down. + LinefeedIfNotLf + + // The BackspaceIfNotBs [backspace_if_not_bs, OTbc] string capability is the move left, if not ^H. + BackspaceIfNotBs + + // The OtherNonFunctionKeys [other_non_function_keys, OTko] string capability is the list of self-mapped keycaps. + OtherNonFunctionKeys + + // The ArrowKeyMap [arrow_key_map, OTma] string capability is the map motion-keys for vi version 2. + ArrowKeyMap + + // The AcsUlcorner [acs_ulcorner, OTG2] string capability is the single upper left. + AcsUlcorner + + // The AcsLlcorner [acs_llcorner, OTG3] string capability is the single lower left. + AcsLlcorner + + // The AcsUrcorner [acs_urcorner, OTG1] string capability is the single upper right. + AcsUrcorner + + // The AcsLrcorner [acs_lrcorner, OTG4] string capability is the single lower right. + AcsLrcorner + + // The AcsLtee [acs_ltee, OTGR] string capability is the tee pointing right. + AcsLtee + + // The AcsRtee [acs_rtee, OTGL] string capability is the tee pointing left. + AcsRtee + + // The AcsBtee [acs_btee, OTGU] string capability is the tee pointing up. + AcsBtee + + // The AcsTtee [acs_ttee, OTGD] string capability is the tee pointing down. + AcsTtee + + // The AcsHline [acs_hline, OTGH] string capability is the single horizontal line. + AcsHline + + // The AcsVline [acs_vline, OTGV] string capability is the single vertical line. + AcsVline + + // The AcsPlus [acs_plus, OTGC] string capability is the single intersection. + AcsPlus + + // The MemoryLock [memory_lock, meml] string capability is the lock memory above cursor. + MemoryLock + + // The MemoryUnlock [memory_unlock, memu] string capability is the unlock memory. + MemoryUnlock + + // The BoxChars1 [box_chars_1, box1] string capability is the box characters primary set. + BoxChars1 +) + +const ( + // CapCountBool is the count of bool capabilities. + CapCountBool = ReturnDoesClrEol + 1 + + // CapCountNum is the count of num capabilities. + CapCountNum = NumberOfFunctionKeys + 1 + + // CapCountString is the count of string capabilities. + CapCountString = BoxChars1 + 1 +) + +// boolCapNames are the bool term cap names. +var boolCapNames = [...]string{ + "auto_left_margin", "bw", + "auto_right_margin", "am", + "no_esc_ctlc", "xsb", + "ceol_standout_glitch", "xhp", + "eat_newline_glitch", "xenl", + "erase_overstrike", "eo", + "generic_type", "gn", + "hard_copy", "hc", + "has_meta_key", "km", + "has_status_line", "hs", + "insert_null_glitch", "in", + "memory_above", "da", + "memory_below", "db", + "move_insert_mode", "mir", + "move_standout_mode", "msgr", + "over_strike", "os", + "status_line_esc_ok", "eslok", + "dest_tabs_magic_smso", "xt", + "tilde_glitch", "hz", + "transparent_underline", "ul", + "xon_xoff", "xon", + "needs_xon_xoff", "nxon", + "prtr_silent", "mc5i", + "hard_cursor", "chts", + "non_rev_rmcup", "nrrmc", + "no_pad_char", "npc", + "non_dest_scroll_region", "ndscr", + "can_change", "ccc", + "back_color_erase", "bce", + "hue_lightness_saturation", "hls", + "col_addr_glitch", "xhpa", + "cr_cancels_micro_mode", "crxm", + "has_print_wheel", "daisy", + "row_addr_glitch", "xvpa", + "semi_auto_right_margin", "sam", + "cpi_changes_res", "cpix", + "lpi_changes_res", "lpix", + "backspaces_with_bs", "OTbs", + "crt_no_scrolling", "OTns", + "no_correctly_working_cr", "OTnc", + "gnu_has_meta_key", "OTMT", + "linefeed_is_newline", "OTNL", + "has_hardware_tabs", "OTpt", + "return_does_clr_eol", "OTxr", +} + +// numCapNames are the num term cap names. +var numCapNames = [...]string{ + "columns", "cols", + "init_tabs", "it", + "lines", "lines", + "lines_of_memory", "lm", + "magic_cookie_glitch", "xmc", + "padding_baud_rate", "pb", + "virtual_terminal", "vt", + "width_status_line", "wsl", + "num_labels", "nlab", + "label_height", "lh", + "label_width", "lw", + "max_attributes", "ma", + "maximum_windows", "wnum", + "max_colors", "colors", + "max_pairs", "pairs", + "no_color_video", "ncv", + "buffer_capacity", "bufsz", + "dot_vert_spacing", "spinv", + "dot_horz_spacing", "spinh", + "max_micro_address", "maddr", + "max_micro_jump", "mjump", + "micro_col_size", "mcs", + "micro_line_size", "mls", + "number_of_pins", "npins", + "output_res_char", "orc", + "output_res_line", "orl", + "output_res_horz_inch", "orhi", + "output_res_vert_inch", "orvi", + "print_rate", "cps", + "wide_char_size", "widcs", + "buttons", "btns", + "bit_image_entwining", "bitwin", + "bit_image_type", "bitype", + "magic_cookie_glitch_ul", "OTug", + "carriage_return_delay", "OTdC", + "new_line_delay", "OTdN", + "backspace_delay", "OTdB", + "horizontal_tab_delay", "OTdT", + "number_of_function_keys", "OTkn", +} + +// stringCapNames are the string term cap names. +var stringCapNames = [...]string{ + "back_tab", "cbt", + "bell", "bel", + "carriage_return", "cr", + "change_scroll_region", "csr", + "clear_all_tabs", "tbc", + "clear_screen", "clear", + "clr_eol", "el", + "clr_eos", "ed", + "column_address", "hpa", + "command_character", "cmdch", + "cursor_address", "cup", + "cursor_down", "cud1", + "cursor_home", "home", + "cursor_invisible", "civis", + "cursor_left", "cub1", + "cursor_mem_address", "mrcup", + "cursor_normal", "cnorm", + "cursor_right", "cuf1", + "cursor_to_ll", "ll", + "cursor_up", "cuu1", + "cursor_visible", "cvvis", + "delete_character", "dch1", + "delete_line", "dl1", + "dis_status_line", "dsl", + "down_half_line", "hd", + "enter_alt_charset_mode", "smacs", + "enter_blink_mode", "blink", + "enter_bold_mode", "bold", + "enter_ca_mode", "smcup", + "enter_delete_mode", "smdc", + "enter_dim_mode", "dim", + "enter_insert_mode", "smir", + "enter_secure_mode", "invis", + "enter_protected_mode", "prot", + "enter_reverse_mode", "rev", + "enter_standout_mode", "smso", + "enter_underline_mode", "smul", + "erase_chars", "ech", + "exit_alt_charset_mode", "rmacs", + "exit_attribute_mode", "sgr0", + "exit_ca_mode", "rmcup", + "exit_delete_mode", "rmdc", + "exit_insert_mode", "rmir", + "exit_standout_mode", "rmso", + "exit_underline_mode", "rmul", + "flash_screen", "flash", + "form_feed", "ff", + "from_status_line", "fsl", + "init_1string", "is1", + "init_2string", "is2", + "init_3string", "is3", + "init_file", "if", + "insert_character", "ich1", + "insert_line", "il1", + "insert_padding", "ip", + "key_backspace", "kbs", + "key_catab", "ktbc", + "key_clear", "kclr", + "key_ctab", "kctab", + "key_dc", "kdch1", + "key_dl", "kdl1", + "key_down", "kcud1", + "key_eic", "krmir", + "key_eol", "kel", + "key_eos", "ked", + "key_f0", "kf0", + "key_f1", "kf1", + "key_f10", "kf10", + "key_f2", "kf2", + "key_f3", "kf3", + "key_f4", "kf4", + "key_f5", "kf5", + "key_f6", "kf6", + "key_f7", "kf7", + "key_f8", "kf8", + "key_f9", "kf9", + "key_home", "khome", + "key_ic", "kich1", + "key_il", "kil1", + "key_left", "kcub1", + "key_ll", "kll", + "key_npage", "knp", + "key_ppage", "kpp", + "key_right", "kcuf1", + "key_sf", "kind", + "key_sr", "kri", + "key_stab", "khts", + "key_up", "kcuu1", + "keypad_local", "rmkx", + "keypad_xmit", "smkx", + "lab_f0", "lf0", + "lab_f1", "lf1", + "lab_f10", "lf10", + "lab_f2", "lf2", + "lab_f3", "lf3", + "lab_f4", "lf4", + "lab_f5", "lf5", + "lab_f6", "lf6", + "lab_f7", "lf7", + "lab_f8", "lf8", + "lab_f9", "lf9", + "meta_off", "rmm", + "meta_on", "smm", + "newline", "nel", + "pad_char", "pad", + "parm_dch", "dch", + "parm_delete_line", "dl", + "parm_down_cursor", "cud", + "parm_ich", "ich", + "parm_index", "indn", + "parm_insert_line", "il", + "parm_left_cursor", "cub", + "parm_right_cursor", "cuf", + "parm_rindex", "rin", + "parm_up_cursor", "cuu", + "pkey_key", "pfkey", + "pkey_local", "pfloc", + "pkey_xmit", "pfx", + "print_screen", "mc0", + "prtr_off", "mc4", + "prtr_on", "mc5", + "repeat_char", "rep", + "reset_1string", "rs1", + "reset_2string", "rs2", + "reset_3string", "rs3", + "reset_file", "rf", + "restore_cursor", "rc", + "row_address", "vpa", + "save_cursor", "sc", + "scroll_forward", "ind", + "scroll_reverse", "ri", + "set_attributes", "sgr", + "set_tab", "hts", + "set_window", "wind", + "tab", "ht", + "to_status_line", "tsl", + "underline_char", "uc", + "up_half_line", "hu", + "init_prog", "iprog", + "key_a1", "ka1", + "key_a3", "ka3", + "key_b2", "kb2", + "key_c1", "kc1", + "key_c3", "kc3", + "prtr_non", "mc5p", + "char_padding", "rmp", + "acs_chars", "acsc", + "plab_norm", "pln", + "key_btab", "kcbt", + "enter_xon_mode", "smxon", + "exit_xon_mode", "rmxon", + "enter_am_mode", "smam", + "exit_am_mode", "rmam", + "xon_character", "xonc", + "xoff_character", "xoffc", + "ena_acs", "enacs", + "label_on", "smln", + "label_off", "rmln", + "key_beg", "kbeg", + "key_cancel", "kcan", + "key_close", "kclo", + "key_command", "kcmd", + "key_copy", "kcpy", + "key_create", "kcrt", + "key_end", "kend", + "key_enter", "kent", + "key_exit", "kext", + "key_find", "kfnd", + "key_help", "khlp", + "key_mark", "kmrk", + "key_message", "kmsg", + "key_move", "kmov", + "key_next", "knxt", + "key_open", "kopn", + "key_options", "kopt", + "key_previous", "kprv", + "key_print", "kprt", + "key_redo", "krdo", + "key_reference", "kref", + "key_refresh", "krfr", + "key_replace", "krpl", + "key_restart", "krst", + "key_resume", "kres", + "key_save", "ksav", + "key_suspend", "kspd", + "key_undo", "kund", + "key_sbeg", "kBEG", + "key_scancel", "kCAN", + "key_scommand", "kCMD", + "key_scopy", "kCPY", + "key_screate", "kCRT", + "key_sdc", "kDC", + "key_sdl", "kDL", + "key_select", "kslt", + "key_send", "kEND", + "key_seol", "kEOL", + "key_sexit", "kEXT", + "key_sfind", "kFND", + "key_shelp", "kHLP", + "key_shome", "kHOM", + "key_sic", "kIC", + "key_sleft", "kLFT", + "key_smessage", "kMSG", + "key_smove", "kMOV", + "key_snext", "kNXT", + "key_soptions", "kOPT", + "key_sprevious", "kPRV", + "key_sprint", "kPRT", + "key_sredo", "kRDO", + "key_sreplace", "kRPL", + "key_sright", "kRIT", + "key_srsume", "kRES", + "key_ssave", "kSAV", + "key_ssuspend", "kSPD", + "key_sundo", "kUND", + "req_for_input", "rfi", + "key_f11", "kf11", + "key_f12", "kf12", + "key_f13", "kf13", + "key_f14", "kf14", + "key_f15", "kf15", + "key_f16", "kf16", + "key_f17", "kf17", + "key_f18", "kf18", + "key_f19", "kf19", + "key_f20", "kf20", + "key_f21", "kf21", + "key_f22", "kf22", + "key_f23", "kf23", + "key_f24", "kf24", + "key_f25", "kf25", + "key_f26", "kf26", + "key_f27", "kf27", + "key_f28", "kf28", + "key_f29", "kf29", + "key_f30", "kf30", + "key_f31", "kf31", + "key_f32", "kf32", + "key_f33", "kf33", + "key_f34", "kf34", + "key_f35", "kf35", + "key_f36", "kf36", + "key_f37", "kf37", + "key_f38", "kf38", + "key_f39", "kf39", + "key_f40", "kf40", + "key_f41", "kf41", + "key_f42", "kf42", + "key_f43", "kf43", + "key_f44", "kf44", + "key_f45", "kf45", + "key_f46", "kf46", + "key_f47", "kf47", + "key_f48", "kf48", + "key_f49", "kf49", + "key_f50", "kf50", + "key_f51", "kf51", + "key_f52", "kf52", + "key_f53", "kf53", + "key_f54", "kf54", + "key_f55", "kf55", + "key_f56", "kf56", + "key_f57", "kf57", + "key_f58", "kf58", + "key_f59", "kf59", + "key_f60", "kf60", + "key_f61", "kf61", + "key_f62", "kf62", + "key_f63", "kf63", + "clr_bol", "el1", + "clear_margins", "mgc", + "set_left_margin", "smgl", + "set_right_margin", "smgr", + "label_format", "fln", + "set_clock", "sclk", + "display_clock", "dclk", + "remove_clock", "rmclk", + "create_window", "cwin", + "goto_window", "wingo", + "hangup", "hup", + "dial_phone", "dial", + "quick_dial", "qdial", + "tone", "tone", + "pulse", "pulse", + "flash_hook", "hook", + "fixed_pause", "pause", + "wait_tone", "wait", + "user0", "u0", + "user1", "u1", + "user2", "u2", + "user3", "u3", + "user4", "u4", + "user5", "u5", + "user6", "u6", + "user7", "u7", + "user8", "u8", + "user9", "u9", + "orig_pair", "op", + "orig_colors", "oc", + "initialize_color", "initc", + "initialize_pair", "initp", + "set_color_pair", "scp", + "set_foreground", "setf", + "set_background", "setb", + "change_char_pitch", "cpi", + "change_line_pitch", "lpi", + "change_res_horz", "chr", + "change_res_vert", "cvr", + "define_char", "defc", + "enter_doublewide_mode", "swidm", + "enter_draft_quality", "sdrfq", + "enter_italics_mode", "sitm", + "enter_leftward_mode", "slm", + "enter_micro_mode", "smicm", + "enter_near_letter_quality", "snlq", + "enter_normal_quality", "snrmq", + "enter_shadow_mode", "sshm", + "enter_subscript_mode", "ssubm", + "enter_superscript_mode", "ssupm", + "enter_upward_mode", "sum", + "exit_doublewide_mode", "rwidm", + "exit_italics_mode", "ritm", + "exit_leftward_mode", "rlm", + "exit_micro_mode", "rmicm", + "exit_shadow_mode", "rshm", + "exit_subscript_mode", "rsubm", + "exit_superscript_mode", "rsupm", + "exit_upward_mode", "rum", + "micro_column_address", "mhpa", + "micro_down", "mcud1", + "micro_left", "mcub1", + "micro_right", "mcuf1", + "micro_row_address", "mvpa", + "micro_up", "mcuu1", + "order_of_pins", "porder", + "parm_down_micro", "mcud", + "parm_left_micro", "mcub", + "parm_right_micro", "mcuf", + "parm_up_micro", "mcuu", + "select_char_set", "scs", + "set_bottom_margin", "smgb", + "set_bottom_margin_parm", "smgbp", + "set_left_margin_parm", "smglp", + "set_right_margin_parm", "smgrp", + "set_top_margin", "smgt", + "set_top_margin_parm", "smgtp", + "start_bit_image", "sbim", + "start_char_set_def", "scsd", + "stop_bit_image", "rbim", + "stop_char_set_def", "rcsd", + "subscript_characters", "subcs", + "superscript_characters", "supcs", + "these_cause_cr", "docr", + "zero_motion", "zerom", + "char_set_names", "csnm", + "key_mouse", "kmous", + "mouse_info", "minfo", + "req_mouse_pos", "reqmp", + "get_mouse", "getm", + "set_a_foreground", "setaf", + "set_a_background", "setab", + "pkey_plab", "pfxl", + "device_type", "devt", + "code_set_init", "csin", + "set0_des_seq", "s0ds", + "set1_des_seq", "s1ds", + "set2_des_seq", "s2ds", + "set3_des_seq", "s3ds", + "set_lr_margin", "smglr", + "set_tb_margin", "smgtb", + "bit_image_repeat", "birep", + "bit_image_newline", "binel", + "bit_image_carriage_return", "bicr", + "color_names", "colornm", + "define_bit_image_region", "defbi", + "end_bit_image_region", "endbi", + "set_color_band", "setcolor", + "set_page_length", "slines", + "display_pc_char", "dispc", + "enter_pc_charset_mode", "smpch", + "exit_pc_charset_mode", "rmpch", + "enter_scancode_mode", "smsc", + "exit_scancode_mode", "rmsc", + "pc_term_options", "pctrm", + "scancode_escape", "scesc", + "alt_scancode_esc", "scesa", + "enter_horizontal_hl_mode", "ehhlm", + "enter_left_hl_mode", "elhlm", + "enter_low_hl_mode", "elohlm", + "enter_right_hl_mode", "erhlm", + "enter_top_hl_mode", "ethlm", + "enter_vertical_hl_mode", "evhlm", + "set_a_attributes", "sgr1", + "set_pglen_inch", "slength", + "termcap_init2", "OTi2", + "termcap_reset", "OTrs", + "linefeed_if_not_lf", "OTnl", + "backspace_if_not_bs", "OTbc", + "other_non_function_keys", "OTko", + "arrow_key_map", "OTma", + "acs_ulcorner", "OTG2", + "acs_llcorner", "OTG3", + "acs_urcorner", "OTG1", + "acs_lrcorner", "OTG4", + "acs_ltee", "OTGR", + "acs_rtee", "OTGL", + "acs_btee", "OTGU", + "acs_ttee", "OTGD", + "acs_hline", "OTGH", + "acs_vline", "OTGV", + "acs_plus", "OTGC", + "memory_lock", "meml", + "memory_unlock", "memu", + "box_chars_1", "box1", +} diff --git a/vendor/github.com/xo/terminfo/color.go b/vendor/github.com/xo/terminfo/color.go new file mode 100644 index 000000000..453c29c24 --- /dev/null +++ b/vendor/github.com/xo/terminfo/color.go @@ -0,0 +1,91 @@ +package terminfo + +import ( + "os" + "strconv" + "strings" +) + +// ColorLevel is the color level supported by a terminal. +type ColorLevel uint + +// ColorLevel values. +const ( + ColorLevelNone ColorLevel = iota + ColorLevelBasic + ColorLevelHundreds + ColorLevelMillions +) + +// String satisfies the Stringer interface. +func (c ColorLevel) String() string { + switch c { + case ColorLevelBasic: + return "basic" + case ColorLevelHundreds: + return "hundreds" + case ColorLevelMillions: + return "millions" + } + return "none" +} + +// ChromaFormatterName returns the github.com/alecthomas/chroma compatible +// formatter name for the color level. +func (c ColorLevel) ChromaFormatterName() string { + switch c { + case ColorLevelBasic: + return "terminal" + case ColorLevelHundreds: + return "terminal256" + case ColorLevelMillions: + return "terminal16m" + } + return "noop" +} + +// ColorLevelFromEnv returns the color level COLORTERM, FORCE_COLOR, +// TERM_PROGRAM, or determined from the TERM environment variable. +func ColorLevelFromEnv() (ColorLevel, error) { + // check for overriding environment variables + colorTerm, termProg, forceColor := os.Getenv("COLORTERM"), os.Getenv("TERM_PROGRAM"), os.Getenv("FORCE_COLOR") + switch { + case strings.Contains(colorTerm, "truecolor") || strings.Contains(colorTerm, "24bit") || termProg == "Hyper": + return ColorLevelMillions, nil + case colorTerm != "" || forceColor != "": + return ColorLevelBasic, nil + case termProg == "Apple_Terminal": + return ColorLevelHundreds, nil + case termProg == "iTerm.app": + ver := os.Getenv("TERM_PROGRAM_VERSION") + if ver == "" { + return ColorLevelHundreds, nil + } + i, err := strconv.Atoi(strings.Split(ver, ".")[0]) + if err != nil { + return ColorLevelNone, ErrInvalidTermProgramVersion + } + if i == 3 { + return ColorLevelMillions, nil + } + return ColorLevelHundreds, nil + } + + // otherwise determine from TERM's max_colors capability + if term := os.Getenv("TERM"); term != "" { + ti, err := Load(term) + if err != nil { + return ColorLevelNone, err + } + + v, ok := ti.Nums[MaxColors] + switch { + case !ok || v <= 16: + return ColorLevelNone, nil + case ok && v >= 256: + return ColorLevelHundreds, nil + } + } + + return ColorLevelBasic, nil +} diff --git a/vendor/github.com/xo/terminfo/go.mod b/vendor/github.com/xo/terminfo/go.mod new file mode 100644 index 000000000..7a3a7597a --- /dev/null +++ b/vendor/github.com/xo/terminfo/go.mod @@ -0,0 +1,3 @@ +module github.com/xo/terminfo + +go 1.15 diff --git a/vendor/github.com/xo/terminfo/go.sum b/vendor/github.com/xo/terminfo/go.sum new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/xo/terminfo/load.go b/vendor/github.com/xo/terminfo/load.go new file mode 100644 index 000000000..9b0b94286 --- /dev/null +++ b/vendor/github.com/xo/terminfo/load.go @@ -0,0 +1,72 @@ +package terminfo + +import ( + "os" + "os/user" + "path" + "strings" + "sync" +) + +// termCache is the terminfo cache. +var termCache = struct { + db map[string]*Terminfo + sync.RWMutex +}{ + db: make(map[string]*Terminfo), +} + +// Load follows the behavior described in terminfo(5) to find correct the +// terminfo file using the name, reads the file and then returns a Terminfo +// struct that describes the file. +func Load(name string) (*Terminfo, error) { + if name == "" { + return nil, ErrEmptyTermName + } + + termCache.RLock() + ti, ok := termCache.db[name] + termCache.RUnlock() + + if ok { + return ti, nil + } + + var checkDirs []string + + // check $TERMINFO + if dir := os.Getenv("TERMINFO"); dir != "" { + checkDirs = append(checkDirs, dir) + } + + // check $HOME/.terminfo + u, err := user.Current() + if err != nil { + return nil, err + } + checkDirs = append(checkDirs, path.Join(u.HomeDir, ".terminfo")) + + // check $TERMINFO_DIRS + if dirs := os.Getenv("TERMINFO_DIRS"); dirs != "" { + checkDirs = append(checkDirs, strings.Split(dirs, ":")...) + } + + // check fallback directories + checkDirs = append(checkDirs, "/etc/terminfo", "/lib/terminfo", "/usr/share/terminfo") + for _, dir := range checkDirs { + ti, err = Open(dir, name) + if err != nil && err != ErrFileNotFound && !os.IsNotExist(err) { + return nil, err + } else if err == nil { + return ti, nil + } + } + + return nil, ErrDatabaseDirectoryNotFound +} + +// LoadFromEnv loads the terminal info based on the name contained in +// environment variable TERM. +func LoadFromEnv() (*Terminfo, error) { + return Load(os.Getenv("TERM")) +} diff --git a/vendor/github.com/xo/terminfo/param.go b/vendor/github.com/xo/terminfo/param.go new file mode 100644 index 000000000..e6b8a1bc0 --- /dev/null +++ b/vendor/github.com/xo/terminfo/param.go @@ -0,0 +1,490 @@ +package terminfo + +import ( + "bytes" + "fmt" + "io" + "strconv" + "strings" + "sync" +) + +// parametizer represents the a scan state for a parameterized string. +type parametizer struct { + // z is the string to parameterize + z []byte + + // pos is the current position in s. + pos int + + // nest is the current nest level. + nest int + + // s is the variable stack. + s stack + + // skipElse keeps the state of skipping else. + skipElse bool + + // buf is the result buffer. + buf *bytes.Buffer + + // params are the parameters to interpolate. + params [9]interface{} + + // vars are dynamic variables. + vars [26]interface{} +} + +// staticVars are the static, global variables. +var staticVars = struct { + vars [26]interface{} + sync.Mutex +}{} + +var parametizerPool = sync.Pool{ + New: func() interface{} { + p := new(parametizer) + p.buf = bytes.NewBuffer(make([]byte, 0, 45)) + return p + }, +} + +// newParametizer returns a new initialized parametizer from the pool. +func newParametizer(z []byte) *parametizer { + p := parametizerPool.Get().(*parametizer) + p.z = z + + return p +} + +// reset resets the parametizer. +func (p *parametizer) reset() { + p.pos, p.nest = 0, 0 + + p.s.reset() + p.buf.Reset() + + p.params, p.vars = [9]interface{}{}, [26]interface{}{} + + parametizerPool.Put(p) +} + +// stateFn represents the state of the scanner as a function that returns the +// next state. +type stateFn func() stateFn + +// exec executes the parameterizer, interpolating the supplied parameters. +func (p *parametizer) exec() string { + for state := p.scanTextFn; state != nil; { + state = state() + } + return p.buf.String() +} + +// peek returns the next byte. +func (p *parametizer) peek() (byte, error) { + if p.pos >= len(p.z) { + return 0, io.EOF + } + return p.z[p.pos], nil +} + +// writeFrom writes the characters from ppos to pos to the buffer. +func (p *parametizer) writeFrom(ppos int) { + if p.pos > ppos { + // append remaining characters. + p.buf.Write(p.z[ppos:p.pos]) + } +} + +func (p *parametizer) scanTextFn() stateFn { + ppos := p.pos + for { + ch, err := p.peek() + if err != nil { + p.writeFrom(ppos) + return nil + } + + if ch == '%' { + p.writeFrom(ppos) + p.pos++ + return p.scanCodeFn + } + + p.pos++ + } +} + +func (p *parametizer) scanCodeFn() stateFn { + ch, err := p.peek() + if err != nil { + return nil + } + + switch ch { + case '%': + p.buf.WriteByte('%') + + case ':': + // this character is used to avoid interpreting "%-" and "%+" as operators. + // the next character is where the format really begins. + p.pos++ + _, err = p.peek() + if err != nil { + return nil + } + return p.scanFormatFn + + case '#', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.': + return p.scanFormatFn + + case 'o': + p.buf.WriteString(strconv.FormatInt(int64(p.s.popInt()), 8)) + + case 'd': + p.buf.WriteString(strconv.Itoa(p.s.popInt())) + + case 'x': + p.buf.WriteString(strconv.FormatInt(int64(p.s.popInt()), 16)) + + case 'X': + p.buf.WriteString(strings.ToUpper(strconv.FormatInt(int64(p.s.popInt()), 16))) + + case 's': + p.buf.WriteString(p.s.popString()) + + case 'c': + p.buf.WriteByte(p.s.popByte()) + + case 'p': + p.pos++ + return p.pushParamFn + + case 'P': + p.pos++ + return p.setDsVarFn + + case 'g': + p.pos++ + return p.getDsVarFn + + case '\'': + p.pos++ + ch, err = p.peek() + if err != nil { + return nil + } + + p.s.push(ch) + + // skip the '\'' + p.pos++ + + case '{': + p.pos++ + return p.pushIntfn + + case 'l': + p.s.push(len(p.s.popString())) + + case '+': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai + bi) + + case '-': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai - bi) + + case '*': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai * bi) + + case '/': + bi, ai := p.s.popInt(), p.s.popInt() + if bi != 0 { + p.s.push(ai / bi) + } else { + p.s.push(0) + } + + case 'm': + bi, ai := p.s.popInt(), p.s.popInt() + if bi != 0 { + p.s.push(ai % bi) + } else { + p.s.push(0) + } + + case '&': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai & bi) + + case '|': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai | bi) + + case '^': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai ^ bi) + + case '=': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai == bi) + + case '>': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai > bi) + + case '<': + bi, ai := p.s.popInt(), p.s.popInt() + p.s.push(ai < bi) + + case 'A': + bi, ai := p.s.popBool(), p.s.popBool() + p.s.push(ai && bi) + + case 'O': + bi, ai := p.s.popBool(), p.s.popBool() + p.s.push(ai || bi) + + case '!': + p.s.push(!p.s.popBool()) + + case '~': + p.s.push(^p.s.popInt()) + + case 'i': + for i := range p.params[:2] { + if n, ok := p.params[i].(int); ok { + p.params[i] = n + 1 + } + } + + case '?', ';': + + case 't': + return p.scanThenFn + + case 'e': + p.skipElse = true + return p.skipTextFn + } + + p.pos++ + + return p.scanTextFn +} + +func (p *parametizer) scanFormatFn() stateFn { + // the character was already read, so no need to check the error. + ch, _ := p.peek() + + // 6 should be the maximum length of a format string, for example "%:-9.9d". + f := []byte{'%', ch, 0, 0, 0, 0} + + var err error + + for { + p.pos++ + ch, err = p.peek() + if err != nil { + return nil + } + + f = append(f, ch) + switch ch { + case 'o', 'd', 'x', 'X': + fmt.Fprintf(p.buf, string(f), p.s.popInt()) + break + + case 's': + fmt.Fprintf(p.buf, string(f), p.s.popString()) + break + + case 'c': + fmt.Fprintf(p.buf, string(f), p.s.popByte()) + break + } + } + + p.pos++ + + return p.scanTextFn +} + +func (p *parametizer) pushParamFn() stateFn { + ch, err := p.peek() + if err != nil { + return nil + } + + if ai := int(ch - '1'); ai >= 0 && ai < len(p.params) { + p.s.push(p.params[ai]) + } else { + p.s.push(0) + } + + // skip the '}' + p.pos++ + + return p.scanTextFn +} + +func (p *parametizer) setDsVarFn() stateFn { + ch, err := p.peek() + if err != nil { + return nil + } + + if ch >= 'A' && ch <= 'Z' { + staticVars.Lock() + staticVars.vars[int(ch-'A')] = p.s.pop() + staticVars.Unlock() + } else if ch >= 'a' && ch <= 'z' { + p.vars[int(ch-'a')] = p.s.pop() + } + + p.pos++ + return p.scanTextFn +} + +func (p *parametizer) getDsVarFn() stateFn { + ch, err := p.peek() + if err != nil { + return nil + } + + var a byte + if ch >= 'A' && ch <= 'Z' { + a = 'A' + } else if ch >= 'a' && ch <= 'z' { + a = 'a' + } + + staticVars.Lock() + p.s.push(staticVars.vars[int(ch-a)]) + staticVars.Unlock() + + p.pos++ + + return p.scanTextFn +} + +func (p *parametizer) pushIntfn() stateFn { + var ai int + for { + ch, err := p.peek() + if err != nil { + return nil + } + + p.pos++ + if ch < '0' || ch > '9' { + p.s.push(ai) + return p.scanTextFn + } + + ai = (ai * 10) + int(ch-'0') + } +} + +func (p *parametizer) scanThenFn() stateFn { + p.pos++ + + if p.s.popBool() { + return p.scanTextFn + } + + p.skipElse = false + + return p.skipTextFn +} + +func (p *parametizer) skipTextFn() stateFn { + for { + ch, err := p.peek() + if err != nil { + return nil + } + + p.pos++ + if ch == '%' { + break + } + } + + if p.skipElse { + return p.skipElseFn + } + + return p.skipThenFn +} + +func (p *parametizer) skipThenFn() stateFn { + ch, err := p.peek() + if err != nil { + return nil + } + + p.pos++ + switch ch { + case ';': + if p.nest == 0 { + return p.scanTextFn + } + p.nest-- + + case '?': + p.nest++ + + case 'e': + if p.nest == 0 { + return p.scanTextFn + } + } + + return p.skipTextFn +} + +func (p *parametizer) skipElseFn() stateFn { + ch, err := p.peek() + if err != nil { + return nil + } + + p.pos++ + switch ch { + case ';': + if p.nest == 0 { + return p.scanTextFn + } + p.nest-- + + case '?': + p.nest++ + } + + return p.skipTextFn +} + +// Printf evaluates a parameterized terminfo value z, interpolating params. +func Printf(z []byte, params ...interface{}) string { + p := newParametizer(z) + defer p.reset() + + // make sure we always have 9 parameters -- makes it easier + // later to skip checks and its faster + for i := 0; i < len(p.params) && i < len(params); i++ { + p.params[i] = params[i] + } + + return p.exec() +} + +// Fprintf evaluates a parameterized terminfo value z, interpolating params and +// writing to w. +func Fprintf(w io.Writer, z []byte, params ...interface{}) { + w.Write([]byte(Printf(z, params...))) +} diff --git a/vendor/github.com/xo/terminfo/stack.go b/vendor/github.com/xo/terminfo/stack.go new file mode 100644 index 000000000..a6de39503 --- /dev/null +++ b/vendor/github.com/xo/terminfo/stack.go @@ -0,0 +1,48 @@ +package terminfo + +type stack []interface{} + +func (s *stack) push(v interface{}) { + *s = append(*s, v) +} + +func (s *stack) pop() interface{} { + if len(*s) == 0 { + return nil + } + v := (*s)[len(*s)-1] + *s = (*s)[:len(*s)-1] + return v +} + +func (s *stack) popInt() int { + if i, ok := s.pop().(int); ok { + return i + } + return 0 +} + +func (s *stack) popBool() bool { + if b, ok := s.pop().(bool); ok { + return b + } + return false +} + +func (s *stack) popByte() byte { + if b, ok := s.pop().(byte); ok { + return b + } + return 0 +} + +func (s *stack) popString() string { + if a, ok := s.pop().(string); ok { + return a + } + return "" +} + +func (s *stack) reset() { + *s = (*s)[:0] +} diff --git a/vendor/github.com/xo/terminfo/terminfo.go b/vendor/github.com/xo/terminfo/terminfo.go new file mode 100644 index 000000000..8ebbf9599 --- /dev/null +++ b/vendor/github.com/xo/terminfo/terminfo.go @@ -0,0 +1,538 @@ +// Package terminfo implements reading terminfo files in pure go. +package terminfo + +import ( + "io" + "io/ioutil" + "path" + "strconv" + "strings" +) + +// Error is a terminfo error. +type Error string + +// Error satisfies the error interface. +func (err Error) Error() string { + return string(err) +} + +const ( + // ErrInvalidFileSize is the invalid file size error. + ErrInvalidFileSize Error = "invalid file size" + + // ErrUnexpectedFileEnd is the unexpected file end error. + ErrUnexpectedFileEnd Error = "unexpected file end" + + // ErrInvalidStringTable is the invalid string table error. + ErrInvalidStringTable Error = "invalid string table" + + // ErrInvalidMagic is the invalid magic error. + ErrInvalidMagic Error = "invalid magic" + + // ErrInvalidHeader is the invalid header error. + ErrInvalidHeader Error = "invalid header" + + // ErrInvalidNames is the invalid names error. + ErrInvalidNames Error = "invalid names" + + // ErrInvalidExtendedHeader is the invalid extended header error. + ErrInvalidExtendedHeader Error = "invalid extended header" + + // ErrEmptyTermName is the empty term name error. + ErrEmptyTermName Error = "empty term name" + + // ErrDatabaseDirectoryNotFound is the database directory not found error. + ErrDatabaseDirectoryNotFound Error = "database directory not found" + + // ErrFileNotFound is the file not found error. + ErrFileNotFound Error = "file not found" + + // ErrInvalidTermProgramVersion is the invalid TERM_PROGRAM_VERSION error. + ErrInvalidTermProgramVersion Error = "invalid TERM_PROGRAM_VERSION" +) + +// Terminfo describes a terminal's capabilities. +type Terminfo struct { + // File is the original source file. + File string + + // Names are the provided cap names. + Names []string + + // Bools are the bool capabilities. + Bools map[int]bool + + // BoolsM are the missing bool capabilities. + BoolsM map[int]bool + + // Nums are the num capabilities. + Nums map[int]int + + // NumsM are the missing num capabilities. + NumsM map[int]bool + + // Strings are the string capabilities. + Strings map[int][]byte + + // StringsM are the missing string capabilities. + StringsM map[int]bool + + // ExtBools are the extended bool capabilities. + ExtBools map[int]bool + + // ExtBoolsNames is the map of extended bool capabilities to their index. + ExtBoolNames map[int][]byte + + // ExtNums are the extended num capabilities. + ExtNums map[int]int + + // ExtNumsNames is the map of extended num capabilities to their index. + ExtNumNames map[int][]byte + + // ExtStrings are the extended string capabilities. + ExtStrings map[int][]byte + + // ExtStringsNames is the map of extended string capabilities to their index. + ExtStringNames map[int][]byte +} + +// Decode decodes the terminfo data contained in buf. +func Decode(buf []byte) (*Terminfo, error) { + var err error + + // check max file length + if len(buf) >= maxFileLength { + return nil, ErrInvalidFileSize + } + + d := &decoder{ + buf: buf, + len: len(buf), + } + + // read header + h, err := d.readInts(6, 16) + if err != nil { + return nil, err + } + + var numWidth int + + // check magic + if h[fieldMagic] == magic { + numWidth = 16 + } else if h[fieldMagic] == magicExtended { + numWidth = 32 + } else { + return nil, ErrInvalidMagic + } + + // check header + if hasInvalidCaps(h) { + return nil, ErrInvalidHeader + } + + // check remaining length + if d.len-d.pos < capLength(h) { + return nil, ErrUnexpectedFileEnd + } + + // read names + names, err := d.readBytes(h[fieldNameSize]) + if err != nil { + return nil, err + } + + // check name is terminated properly + i := findNull(names, 0) + if i == -1 { + return nil, ErrInvalidNames + } + names = names[:i] + + // read bool caps + bools, boolsM, err := d.readBools(h[fieldBoolCount]) + if err != nil { + return nil, err + } + + // read num caps + nums, numsM, err := d.readNums(h[fieldNumCount], numWidth) + if err != nil { + return nil, err + } + + // read string caps + strs, strsM, err := d.readStrings(h[fieldStringCount], h[fieldTableSize]) + if err != nil { + return nil, err + } + + ti := &Terminfo{ + Names: strings.Split(string(names), "|"), + Bools: bools, + BoolsM: boolsM, + Nums: nums, + NumsM: numsM, + Strings: strs, + StringsM: strsM, + } + + // at the end of file, so no extended caps + if d.pos >= d.len { + return ti, nil + } + + // decode extended header + eh, err := d.readInts(5, 16) + if err != nil { + return nil, err + } + + // check extended offset field + if hasInvalidExtOffset(eh) { + return nil, ErrInvalidExtendedHeader + } + + // check extended cap lengths + if d.len-d.pos != extCapLength(eh, numWidth) { + return nil, ErrInvalidExtendedHeader + } + + // read extended bool caps + ti.ExtBools, _, err = d.readBools(eh[fieldExtBoolCount]) + if err != nil { + return nil, err + } + + // read extended num caps + ti.ExtNums, _, err = d.readNums(eh[fieldExtNumCount], numWidth) + if err != nil { + return nil, err + } + + // read extended string data table indexes + extIndexes, err := d.readInts(eh[fieldExtOffsetCount], 16) + if err != nil { + return nil, err + } + + // read string data table + extData, err := d.readBytes(eh[fieldExtTableSize]) + if err != nil { + return nil, err + } + + // precautionary check that exactly at end of file + if d.pos != d.len { + return nil, ErrUnexpectedFileEnd + } + + var last int + // read extended string caps + ti.ExtStrings, last, err = readStrings(extIndexes, extData, eh[fieldExtStringCount]) + if err != nil { + return nil, err + } + extIndexes, extData = extIndexes[eh[fieldExtStringCount]:], extData[last:] + + // read extended bool names + ti.ExtBoolNames, _, err = readStrings(extIndexes, extData, eh[fieldExtBoolCount]) + if err != nil { + return nil, err + } + extIndexes = extIndexes[eh[fieldExtBoolCount]:] + + // read extended num names + ti.ExtNumNames, _, err = readStrings(extIndexes, extData, eh[fieldExtNumCount]) + if err != nil { + return nil, err + } + extIndexes = extIndexes[eh[fieldExtNumCount]:] + + // read extended string names + ti.ExtStringNames, _, err = readStrings(extIndexes, extData, eh[fieldExtStringCount]) + if err != nil { + return nil, err + } + //extIndexes = extIndexes[eh[fieldExtStringCount]:] + + return ti, nil +} + +// Open reads the terminfo file name from the specified directory dir. +func Open(dir, name string) (*Terminfo, error) { + var err error + var buf []byte + var filename string + for _, f := range []string{ + path.Join(dir, name[0:1], name), + path.Join(dir, strconv.FormatUint(uint64(name[0]), 16), name), + } { + buf, err = ioutil.ReadFile(f) + if err == nil { + filename = f + break + } + } + if buf == nil { + return nil, ErrFileNotFound + } + + // decode + ti, err := Decode(buf) + if err != nil { + return nil, err + } + + // save original file name + ti.File = filename + + // add to cache + termCache.Lock() + for _, n := range ti.Names { + termCache.db[n] = ti + } + termCache.Unlock() + + return ti, nil +} + +// boolCaps returns all bool and extended capabilities using f to format the +// index key. +func (ti *Terminfo) boolCaps(f func(int) string, extended bool) map[string]bool { + m := make(map[string]bool, len(ti.Bools)+len(ti.ExtBools)) + if !extended { + for k, v := range ti.Bools { + m[f(k)] = v + } + } else { + for k, v := range ti.ExtBools { + m[string(ti.ExtBoolNames[k])] = v + } + } + return m +} + +// BoolCaps returns all bool capabilities. +func (ti *Terminfo) BoolCaps() map[string]bool { + return ti.boolCaps(BoolCapName, false) +} + +// BoolCapsShort returns all bool capabilities, using the short name as the +// index. +func (ti *Terminfo) BoolCapsShort() map[string]bool { + return ti.boolCaps(BoolCapNameShort, false) +} + +// ExtBoolCaps returns all extended bool capabilities. +func (ti *Terminfo) ExtBoolCaps() map[string]bool { + return ti.boolCaps(BoolCapName, true) +} + +// ExtBoolCapsShort returns all extended bool capabilities, using the short +// name as the index. +func (ti *Terminfo) ExtBoolCapsShort() map[string]bool { + return ti.boolCaps(BoolCapNameShort, true) +} + +// numCaps returns all num and extended capabilities using f to format the +// index key. +func (ti *Terminfo) numCaps(f func(int) string, extended bool) map[string]int { + m := make(map[string]int, len(ti.Nums)+len(ti.ExtNums)) + if !extended { + for k, v := range ti.Nums { + m[f(k)] = v + } + } else { + for k, v := range ti.ExtNums { + m[string(ti.ExtNumNames[k])] = v + } + } + return m +} + +// NumCaps returns all num capabilities. +func (ti *Terminfo) NumCaps() map[string]int { + return ti.numCaps(NumCapName, false) +} + +// NumCapsShort returns all num capabilities, using the short name as the +// index. +func (ti *Terminfo) NumCapsShort() map[string]int { + return ti.numCaps(NumCapNameShort, false) +} + +// ExtNumCaps returns all extended num capabilities. +func (ti *Terminfo) ExtNumCaps() map[string]int { + return ti.numCaps(NumCapName, true) +} + +// ExtNumCapsShort returns all extended num capabilities, using the short +// name as the index. +func (ti *Terminfo) ExtNumCapsShort() map[string]int { + return ti.numCaps(NumCapNameShort, true) +} + +// stringCaps returns all string and extended capabilities using f to format the +// index key. +func (ti *Terminfo) stringCaps(f func(int) string, extended bool) map[string][]byte { + m := make(map[string][]byte, len(ti.Strings)+len(ti.ExtStrings)) + if !extended { + for k, v := range ti.Strings { + m[f(k)] = v + } + } else { + for k, v := range ti.ExtStrings { + m[string(ti.ExtStringNames[k])] = v + } + } + return m +} + +// StringCaps returns all string capabilities. +func (ti *Terminfo) StringCaps() map[string][]byte { + return ti.stringCaps(StringCapName, false) +} + +// StringCapsShort returns all string capabilities, using the short name as the +// index. +func (ti *Terminfo) StringCapsShort() map[string][]byte { + return ti.stringCaps(StringCapNameShort, false) +} + +// ExtStringCaps returns all extended string capabilities. +func (ti *Terminfo) ExtStringCaps() map[string][]byte { + return ti.stringCaps(StringCapName, true) +} + +// ExtStringCapsShort returns all extended string capabilities, using the short +// name as the index. +func (ti *Terminfo) ExtStringCapsShort() map[string][]byte { + return ti.stringCaps(StringCapNameShort, true) +} + +// Has determines if the bool cap i is present. +func (ti *Terminfo) Has(i int) bool { + return ti.Bools[i] +} + +// Num returns the num cap i, or -1 if not present. +func (ti *Terminfo) Num(i int) int { + n, ok := ti.Nums[i] + if !ok { + return -1 + } + return n +} + +// Printf formats the string cap i, interpolating parameters v. +func (ti *Terminfo) Printf(i int, v ...interface{}) string { + return Printf(ti.Strings[i], v...) +} + +// Fprintf prints the string cap i to writer w, interpolating parameters v. +func (ti *Terminfo) Fprintf(w io.Writer, i int, v ...interface{}) { + Fprintf(w, ti.Strings[i], v...) +} + +// Color takes a foreground and background color and returns string that sets +// them for this terminal. +func (ti *Terminfo) Colorf(fg, bg int, str string) string { + maxColors := int(ti.Nums[MaxColors]) + + // map bright colors to lower versions if the color table only holds 8. + if maxColors == 8 { + if fg > 7 && fg < 16 { + fg -= 8 + } + if bg > 7 && bg < 16 { + bg -= 8 + } + } + + var s string + if maxColors > fg && fg >= 0 { + s += ti.Printf(SetAForeground, fg) + } + if maxColors > bg && bg >= 0 { + s += ti.Printf(SetABackground, bg) + } + return s + str + ti.Printf(ExitAttributeMode) +} + +// Goto returns a string suitable for addressing the cursor at the given +// row and column. The origin 0, 0 is in the upper left corner of the screen. +func (ti *Terminfo) Goto(row, col int) string { + return Printf(ti.Strings[CursorAddress], row, col) +} + +// Puts emits the string to the writer, but expands inline padding indications +// (of the form $<[delay]> where [delay] is msec) to a suitable number of +// padding characters (usually null bytes) based upon the supplied baud. At +// high baud rates, more padding characters will be inserted. +/*func (ti *Terminfo) Puts(w io.Writer, s string, lines, baud int) (int, error) { + var err error + for { + start := strings.Index(s, "$<") + if start == -1 { + // most strings don't need padding, which is good news! + return io.WriteString(w, s) + } + + end := strings.Index(s, ">") + if end == -1 { + // unterminated... just emit bytes unadulterated. + return io.WriteString(w, "$<"+s) + } + + var c int + c, err = io.WriteString(w, s[:start]) + if err != nil { + return n + c, err + } + n += c + + s = s[start+2:] + val := s[:end] + s = s[end+1:] + var ms int + var dot, mandatory, asterisk bool + unit := 1000 + for _, ch := range val { + switch { + case ch >= '0' && ch <= '9': + ms = (ms * 10) + int(ch-'0') + if dot { + unit *= 10 + } + case ch == '.' && !dot: + dot = true + case ch == '*' && !asterisk: + ms *= lines + asterisk = true + case ch == '/': + mandatory = true + default: + break + } + } + + z, pad := ((baud/8)/unit)*ms, ti.Strings[PadChar] + b := make([]byte, len(pad)*z) + for bp := copy(b, pad); bp < len(b); bp *= 2 { + copy(b[bp:], b[:bp]) + } + + if (!ti.Bools[XonXoff] && baud > int(ti.Nums[PaddingBaudRate])) || mandatory { + c, err = w.Write(b) + if err != nil { + return n + c, err + } + n += c + } + } + + return n, nil +}*/ diff --git a/vendor/github.com/xo/terminfo/util.go b/vendor/github.com/xo/terminfo/util.go new file mode 100644 index 000000000..56f47e811 --- /dev/null +++ b/vendor/github.com/xo/terminfo/util.go @@ -0,0 +1,266 @@ +package terminfo + +import ( + "sort" +) + +const ( + // maxFileLength is the max file length. + maxFileLength = 4096 + + // magic is the file magic for terminfo files. + magic = 0432 + + // magicExtended is the file magic for terminfo files with the extended number format. + magicExtended = 01036 +) + +// header fields. +const ( + fieldMagic = iota + fieldNameSize + fieldBoolCount + fieldNumCount + fieldStringCount + fieldTableSize +) + +// header extended fields. +const ( + fieldExtBoolCount = iota + fieldExtNumCount + fieldExtStringCount + fieldExtOffsetCount + fieldExtTableSize +) + +// hasInvalidCaps determines if the capabilities in h are invalid. +func hasInvalidCaps(h []int) bool { + return h[fieldBoolCount] > CapCountBool || + h[fieldNumCount] > CapCountNum || + h[fieldStringCount] > CapCountString +} + +// capLength returns the total length of the capabilities in bytes. +func capLength(h []int) int { + return h[fieldNameSize] + + h[fieldBoolCount] + + (h[fieldNameSize]+h[fieldBoolCount])%2 + // account for word align + h[fieldNumCount]*2 + + h[fieldStringCount]*2 + + h[fieldTableSize] +} + +// hasInvalidExtOffset determines if the extended offset field is valid. +func hasInvalidExtOffset(h []int) bool { + return h[fieldExtBoolCount]+ + h[fieldExtNumCount]+ + h[fieldExtStringCount]*2 != h[fieldExtOffsetCount] +} + +// extCapLength returns the total length of extended capabilities in bytes. +func extCapLength(h []int, numWidth int) int { + return h[fieldExtBoolCount] + + h[fieldExtBoolCount]%2 + // account for word align + h[fieldExtNumCount]*(numWidth/8) + + h[fieldExtOffsetCount]*2 + + h[fieldExtTableSize] +} + +// findNull finds the position of null in buf. +func findNull(buf []byte, i int) int { + for ; i < len(buf); i++ { + if buf[i] == 0 { + return i + } + } + return -1 +} + +// readStrings decodes n strings from string data table buf using the indexes in idx. +func readStrings(idx []int, buf []byte, n int) (map[int][]byte, int, error) { + var last int + m := make(map[int][]byte) + for i := 0; i < n; i++ { + start := idx[i] + if start < 0 { + continue + } + if end := findNull(buf, start); end != -1 { + m[i], last = buf[start:end], end+1 + } else { + return nil, 0, ErrInvalidStringTable + } + } + return m, last, nil +} + +// decoder holds state info while decoding a terminfo file. +type decoder struct { + buf []byte + pos int + len int +} + +// readBytes reads the next n bytes of buf, incrementing pos by n. +func (d *decoder) readBytes(n int) ([]byte, error) { + if d.len < d.pos+n { + return nil, ErrUnexpectedFileEnd + } + n, d.pos = d.pos, d.pos+n + return d.buf[n:d.pos], nil +} + +// readInts reads n number of ints with width w. +func (d *decoder) readInts(n, w int) ([]int, error) { + w /= 8 + l := n * w + + buf, err := d.readBytes(l) + if err != nil { + return nil, err + } + + // align + d.pos += d.pos % 2 + + z := make([]int, n) + for i, j := 0, 0; i < l; i, j = i+w, j+1 { + switch w { + case 1: + z[i] = int(buf[i]) + case 2: + z[j] = int(int16(buf[i+1])<<8 | int16(buf[i])) + case 4: + z[j] = int(buf[i+3])<<24 | int(buf[i+2])<<16 | int(buf[i+1])<<8 | int(buf[i]) + } + } + + return z, nil +} + +// readBools reads the next n bools. +func (d *decoder) readBools(n int) (map[int]bool, map[int]bool, error) { + buf, err := d.readInts(n, 8) + if err != nil { + return nil, nil, err + } + + // process + bools, boolsM := make(map[int]bool), make(map[int]bool) + for i, b := range buf { + bools[i] = b == 1 + if int8(b) == -2 { + boolsM[i] = true + } + } + + return bools, boolsM, nil +} + +// readNums reads the next n nums. +func (d *decoder) readNums(n, w int) (map[int]int, map[int]bool, error) { + buf, err := d.readInts(n, w) + if err != nil { + return nil, nil, err + } + + // process + nums, numsM := make(map[int]int), make(map[int]bool) + for i := 0; i < n; i++ { + nums[i] = buf[i] + if buf[i] == -2 { + numsM[i] = true + } + } + + return nums, numsM, nil +} + +// readStringTable reads the string data for n strings and the accompanying data +// table of length sz. +func (d *decoder) readStringTable(n, sz int) ([][]byte, []int, error) { + buf, err := d.readInts(n, 16) + if err != nil { + return nil, nil, err + } + + // read string data table + data, err := d.readBytes(sz) + if err != nil { + return nil, nil, err + } + + // align + d.pos += d.pos % 2 + + // process + s := make([][]byte, n) + var m []int + for i := 0; i < n; i++ { + start := buf[i] + if start == -2 { + m = append(m, i) + } else if start >= 0 { + if end := findNull(data, start); end != -1 { + s[i] = data[start:end] + } else { + return nil, nil, ErrInvalidStringTable + } + } + } + + return s, m, nil +} + +// readStrings reads the next n strings and processes the string data table of +// length sz. +func (d *decoder) readStrings(n, sz int) (map[int][]byte, map[int]bool, error) { + s, m, err := d.readStringTable(n, sz) + if err != nil { + return nil, nil, err + } + + strs := make(map[int][]byte) + for k, v := range s { + if k == AcsChars { + v = canonicalizeAscChars(v) + } + strs[k] = v + } + + strsM := make(map[int]bool, len(m)) + for _, k := range m { + strsM[k] = true + } + + return strs, strsM, nil +} + +// canonicalizeAscChars reorders chars to be unique, in order. +// +// see repair_ascc in ncurses-6.0/progs/dump_entry.c +func canonicalizeAscChars(z []byte) []byte { + var c chars + enc := make(map[byte]byte, len(z)/2) + for i := 0; i < len(z); i += 2 { + if _, ok := enc[z[i]]; !ok { + a, b := z[i], z[i+1] + //log.Printf(">>> a: %d %c, b: %d %c", a, a, b, b) + c, enc[a] = append(c, b), b + } + } + sort.Sort(c) + + r := make([]byte, 2*len(c)) + for i := 0; i < len(c); i++ { + r[i*2], r[i*2+1] = c[i], enc[c[i]] + } + return r +} + +type chars []byte + +func (c chars) Len() int { return len(c) } +func (c chars) Swap(i, j int) { c[i], c[j] = c[j], c[i] } +func (c chars) Less(i, j int) bool { return c[i] < c[j] } diff --git a/vendor/golang.org/x/sys/cpu/cpu.go b/vendor/golang.org/x/sys/cpu/cpu.go index abbec2d44..b56886f26 100644 --- a/vendor/golang.org/x/sys/cpu/cpu.go +++ b/vendor/golang.org/x/sys/cpu/cpu.go @@ -56,6 +56,7 @@ var X86 struct { HasAVX512BF16 bool // Advanced vector extension 512 BFloat16 Instructions HasBMI1 bool // Bit manipulation instruction set 1 HasBMI2 bool // Bit manipulation instruction set 2 + HasCX16 bool // Compare and exchange 16 Bytes HasERMS bool // Enhanced REP for MOVSB and STOSB HasFMA bool // Fused-multiply-add instructions HasOSXSAVE bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers. diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.go b/vendor/golang.org/x/sys/cpu/cpu_x86.go index 54ca4667f..5ea287b7e 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_x86.go +++ b/vendor/golang.org/x/sys/cpu/cpu_x86.go @@ -39,6 +39,7 @@ func initOptions() { {Name: "avx512bf16", Feature: &X86.HasAVX512BF16}, {Name: "bmi1", Feature: &X86.HasBMI1}, {Name: "bmi2", Feature: &X86.HasBMI2}, + {Name: "cx16", Feature: &X86.HasCX16}, {Name: "erms", Feature: &X86.HasERMS}, {Name: "fma", Feature: &X86.HasFMA}, {Name: "osxsave", Feature: &X86.HasOSXSAVE}, @@ -73,6 +74,7 @@ func archInit() { X86.HasPCLMULQDQ = isSet(1, ecx1) X86.HasSSSE3 = isSet(9, ecx1) X86.HasFMA = isSet(12, ecx1) + X86.HasCX16 = isSet(13, ecx1) X86.HasSSE41 = isSet(19, ecx1) X86.HasSSE42 = isSet(20, ecx1) X86.HasPOPCNT = isSet(23, ecx1) diff --git a/vendor/golang.org/x/sys/unix/ifreq_linux.go b/vendor/golang.org/x/sys/unix/ifreq_linux.go new file mode 100644 index 000000000..934af313c --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ifreq_linux.go @@ -0,0 +1,149 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build linux +// +build linux + +package unix + +import ( + "bytes" + "unsafe" +) + +// Helpers for dealing with ifreq since it contains a union and thus requires a +// lot of unsafe.Pointer casts to use properly. + +// An Ifreq is a type-safe wrapper around the raw ifreq struct. An Ifreq +// contains an interface name and a union of arbitrary data which can be +// accessed using the Ifreq's methods. To create an Ifreq, use the NewIfreq +// function. +// +// Use the Name method to access the stored interface name. The union data +// fields can be get and set using the following methods: +// - Uint16/SetUint16: flags +// - Uint32/SetUint32: ifindex, metric, mtu +type Ifreq struct{ raw ifreq } + +// NewIfreq creates an Ifreq with the input network interface name after +// validating the name does not exceed IFNAMSIZ-1 (trailing NULL required) +// bytes. +func NewIfreq(name string) (*Ifreq, error) { + // Leave room for terminating NULL byte. + if len(name) >= IFNAMSIZ { + return nil, EINVAL + } + + var ifr ifreq + copy(ifr.Ifrn[:], name) + + return &Ifreq{raw: ifr}, nil +} + +// TODO(mdlayher): get/set methods for hardware address sockaddr, char array, etc. + +// Name returns the interface name associated with the Ifreq. +func (ifr *Ifreq) Name() string { + // BytePtrToString requires a NULL terminator or the program may crash. If + // one is not present, just return the empty string. + if !bytes.Contains(ifr.raw.Ifrn[:], []byte{0x00}) { + return "" + } + + return BytePtrToString(&ifr.raw.Ifrn[0]) +} + +// According to netdevice(7), only AF_INET addresses are returned for numerous +// sockaddr ioctls. For convenience, we expose these as Inet4Addr since the Port +// field and other data is always empty. + +// Inet4Addr returns the Ifreq union data from an embedded sockaddr as a C +// in_addr/Go []byte (4-byte IPv4 address) value. If the sockaddr family is not +// AF_INET, an error is returned. +func (ifr *Ifreq) Inet4Addr() ([]byte, error) { + raw := *(*RawSockaddrInet4)(unsafe.Pointer(&ifr.raw.Ifru[:SizeofSockaddrInet4][0])) + if raw.Family != AF_INET { + // Cannot safely interpret raw.Addr bytes as an IPv4 address. + return nil, EINVAL + } + + return raw.Addr[:], nil +} + +// SetInet4Addr sets a C in_addr/Go []byte (4-byte IPv4 address) value in an +// embedded sockaddr within the Ifreq's union data. v must be 4 bytes in length +// or an error will be returned. +func (ifr *Ifreq) SetInet4Addr(v []byte) error { + if len(v) != 4 { + return EINVAL + } + + var addr [4]byte + copy(addr[:], v) + + ifr.clear() + *(*RawSockaddrInet4)( + unsafe.Pointer(&ifr.raw.Ifru[:SizeofSockaddrInet4][0]), + ) = RawSockaddrInet4{ + // Always set IP family as ioctls would require it anyway. + Family: AF_INET, + Addr: addr, + } + + return nil +} + +// Uint16 returns the Ifreq union data as a C short/Go uint16 value. +func (ifr *Ifreq) Uint16() uint16 { + return *(*uint16)(unsafe.Pointer(&ifr.raw.Ifru[:2][0])) +} + +// SetUint16 sets a C short/Go uint16 value as the Ifreq's union data. +func (ifr *Ifreq) SetUint16(v uint16) { + ifr.clear() + *(*uint16)(unsafe.Pointer(&ifr.raw.Ifru[:2][0])) = v +} + +// Uint32 returns the Ifreq union data as a C int/Go uint32 value. +func (ifr *Ifreq) Uint32() uint32 { + return *(*uint32)(unsafe.Pointer(&ifr.raw.Ifru[:4][0])) +} + +// SetUint32 sets a C int/Go uint32 value as the Ifreq's union data. +func (ifr *Ifreq) SetUint32(v uint32) { + ifr.clear() + *(*uint32)(unsafe.Pointer(&ifr.raw.Ifru[:4][0])) = v +} + +// clear zeroes the ifreq's union field to prevent trailing garbage data from +// being sent to the kernel if an ifreq is reused. +func (ifr *Ifreq) clear() { + for i := range ifr.raw.Ifru { + ifr.raw.Ifru[i] = 0 + } +} + +// TODO(mdlayher): export as IfreqData? For now we can provide helpers such as +// IoctlGetEthtoolDrvinfo which use these APIs under the hood. + +// An ifreqData is an Ifreq which carries pointer data. To produce an ifreqData, +// use the Ifreq.withData method. +type ifreqData struct { + name [IFNAMSIZ]byte + // A type separate from ifreq is required in order to comply with the + // unsafe.Pointer rules since the "pointer-ness" of data would not be + // preserved if it were cast into the byte array of a raw ifreq. + data unsafe.Pointer + // Pad to the same size as ifreq. + _ [len(ifreq{}.Ifru) - SizeofPtr]byte +} + +// withData produces an ifreqData with the pointer p set for ioctls which require +// arbitrary pointer data. +func (ifr Ifreq) withData(p unsafe.Pointer) ifreqData { + return ifreqData{ + name: ifr.raw.Ifrn, + data: p, + } +} diff --git a/vendor/golang.org/x/sys/unix/ioctl_linux.go b/vendor/golang.org/x/sys/unix/ioctl_linux.go index 48773f730..1dadead21 100644 --- a/vendor/golang.org/x/sys/unix/ioctl_linux.go +++ b/vendor/golang.org/x/sys/unix/ioctl_linux.go @@ -5,7 +5,6 @@ package unix import ( - "runtime" "unsafe" ) @@ -22,56 +21,42 @@ func IoctlRetInt(fd int, req uint) (int, error) { func IoctlGetUint32(fd int, req uint) (uint32, error) { var value uint32 - err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + err := ioctlPtr(fd, req, unsafe.Pointer(&value)) return value, err } func IoctlGetRTCTime(fd int) (*RTCTime, error) { var value RTCTime - err := ioctl(fd, RTC_RD_TIME, uintptr(unsafe.Pointer(&value))) + err := ioctlPtr(fd, RTC_RD_TIME, unsafe.Pointer(&value)) return &value, err } func IoctlSetRTCTime(fd int, value *RTCTime) error { - err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value))) - runtime.KeepAlive(value) - return err + return ioctlPtr(fd, RTC_SET_TIME, unsafe.Pointer(value)) } func IoctlGetRTCWkAlrm(fd int) (*RTCWkAlrm, error) { var value RTCWkAlrm - err := ioctl(fd, RTC_WKALM_RD, uintptr(unsafe.Pointer(&value))) + err := ioctlPtr(fd, RTC_WKALM_RD, unsafe.Pointer(&value)) return &value, err } func IoctlSetRTCWkAlrm(fd int, value *RTCWkAlrm) error { - err := ioctl(fd, RTC_WKALM_SET, uintptr(unsafe.Pointer(value))) - runtime.KeepAlive(value) - return err -} - -type ifreqEthtool struct { - name [IFNAMSIZ]byte - data unsafe.Pointer + return ioctlPtr(fd, RTC_WKALM_SET, unsafe.Pointer(value)) } // IoctlGetEthtoolDrvinfo fetches ethtool driver information for the network // device specified by ifname. func IoctlGetEthtoolDrvinfo(fd int, ifname string) (*EthtoolDrvinfo, error) { - // Leave room for terminating NULL byte. - if len(ifname) >= IFNAMSIZ { - return nil, EINVAL + ifr, err := NewIfreq(ifname) + if err != nil { + return nil, err } - value := EthtoolDrvinfo{ - Cmd: ETHTOOL_GDRVINFO, - } - ifreq := ifreqEthtool{ - data: unsafe.Pointer(&value), - } - copy(ifreq.name[:], ifname) - err := ioctl(fd, SIOCETHTOOL, uintptr(unsafe.Pointer(&ifreq))) - runtime.KeepAlive(ifreq) + value := EthtoolDrvinfo{Cmd: ETHTOOL_GDRVINFO} + ifrd := ifr.withData(unsafe.Pointer(&value)) + + err = ioctlIfreqData(fd, SIOCETHTOOL, &ifrd) return &value, err } @@ -80,7 +65,7 @@ func IoctlGetEthtoolDrvinfo(fd int, ifname string) (*EthtoolDrvinfo, error) { // https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html. func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) { var value WatchdogInfo - err := ioctl(fd, WDIOC_GETSUPPORT, uintptr(unsafe.Pointer(&value))) + err := ioctlPtr(fd, WDIOC_GETSUPPORT, unsafe.Pointer(&value)) return &value, err } @@ -88,6 +73,7 @@ func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) { // more information, see: // https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html. func IoctlWatchdogKeepalive(fd int) error { + // arg is ignored and not a pointer, so ioctl is fine instead of ioctlPtr. return ioctl(fd, WDIOC_KEEPALIVE, 0) } @@ -95,9 +81,7 @@ func IoctlWatchdogKeepalive(fd int) error { // range of data conveyed in value to the file associated with the file // descriptor destFd. See the ioctl_ficlonerange(2) man page for details. func IoctlFileCloneRange(destFd int, value *FileCloneRange) error { - err := ioctl(destFd, FICLONERANGE, uintptr(unsafe.Pointer(value))) - runtime.KeepAlive(value) - return err + return ioctlPtr(destFd, FICLONERANGE, unsafe.Pointer(value)) } // IoctlFileClone performs an FICLONE ioctl operation to clone the entire file @@ -148,7 +132,7 @@ func IoctlFileDedupeRange(srcFd int, value *FileDedupeRange) error { rawinfo.Reserved = value.Info[i].Reserved } - err := ioctl(srcFd, FIDEDUPERANGE, uintptr(unsafe.Pointer(&buf[0]))) + err := ioctlPtr(srcFd, FIDEDUPERANGE, unsafe.Pointer(&buf[0])) // Output for i := range value.Info { @@ -166,31 +150,47 @@ func IoctlFileDedupeRange(srcFd int, value *FileDedupeRange) error { } func IoctlHIDGetDesc(fd int, value *HIDRawReportDescriptor) error { - err := ioctl(fd, HIDIOCGRDESC, uintptr(unsafe.Pointer(value))) - runtime.KeepAlive(value) - return err + return ioctlPtr(fd, HIDIOCGRDESC, unsafe.Pointer(value)) } func IoctlHIDGetRawInfo(fd int) (*HIDRawDevInfo, error) { var value HIDRawDevInfo - err := ioctl(fd, HIDIOCGRAWINFO, uintptr(unsafe.Pointer(&value))) + err := ioctlPtr(fd, HIDIOCGRAWINFO, unsafe.Pointer(&value)) return &value, err } func IoctlHIDGetRawName(fd int) (string, error) { var value [_HIDIOCGRAWNAME_LEN]byte - err := ioctl(fd, _HIDIOCGRAWNAME, uintptr(unsafe.Pointer(&value[0]))) + err := ioctlPtr(fd, _HIDIOCGRAWNAME, unsafe.Pointer(&value[0])) return ByteSliceToString(value[:]), err } func IoctlHIDGetRawPhys(fd int) (string, error) { var value [_HIDIOCGRAWPHYS_LEN]byte - err := ioctl(fd, _HIDIOCGRAWPHYS, uintptr(unsafe.Pointer(&value[0]))) + err := ioctlPtr(fd, _HIDIOCGRAWPHYS, unsafe.Pointer(&value[0])) return ByteSliceToString(value[:]), err } func IoctlHIDGetRawUniq(fd int) (string, error) { var value [_HIDIOCGRAWUNIQ_LEN]byte - err := ioctl(fd, _HIDIOCGRAWUNIQ, uintptr(unsafe.Pointer(&value[0]))) + err := ioctlPtr(fd, _HIDIOCGRAWUNIQ, unsafe.Pointer(&value[0])) return ByteSliceToString(value[:]), err } + +// IoctlIfreq performs an ioctl using an Ifreq structure for input and/or +// output. See the netdevice(7) man page for details. +func IoctlIfreq(fd int, req uint, value *Ifreq) error { + // It is possible we will add more fields to *Ifreq itself later to prevent + // misuse, so pass the raw *ifreq directly. + return ioctlPtr(fd, req, unsafe.Pointer(&value.raw)) +} + +// TODO(mdlayher): export if and when IfreqData is exported. + +// ioctlIfreqData performs an ioctl using an ifreqData structure for input +// and/or output. See the netdevice(7) man page for details. +func ioctlIfreqData(fd int, req uint, value *ifreqData) error { + // The memory layout of IfreqData (type-safe) and ifreq (not type-safe) are + // identical so pass *IfreqData directly. + return ioctlPtr(fd, req, unsafe.Pointer(value)) +} diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 3f670faba..a74ef58f8 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -54,7 +54,7 @@ includes_AIX=' includes_Darwin=' #define _DARWIN_C_SOURCE -#define KERNEL +#define KERNEL 1 #define _DARWIN_USE_64_BIT_INODE #define __APPLE_USE_RFC_3542 #include @@ -75,6 +75,7 @@ includes_Darwin=' #include #include #include +#include #include #include #include @@ -82,6 +83,9 @@ includes_Darwin=' #include #include #include + +// for backwards compatibility because moved TIOCREMOTE to Kernel.framework after MacOSX12.0.sdk. +#define TIOCREMOTE 0x80047469 ' includes_DragonFly=' @@ -217,8 +221,6 @@ struct ltchars { #include #include #include -#include -#include #include #include #include @@ -231,6 +233,7 @@ struct ltchars { #include #include #include +#include #include #include #include @@ -467,7 +470,6 @@ ccflags="$@" $2 !~ /^EQUIV_/ && $2 !~ /^EXPR_/ && $2 !~ /^EVIOC/ && - $2 !~ /^EV_/ && $2 ~ /^E[A-Z0-9_]+$/ || $2 ~ /^B[0-9_]+$/ || $2 ~ /^(OLD|NEW)DEV$/ || @@ -499,10 +501,11 @@ ccflags="$@" $2 ~ /^O?XTABS$/ || $2 ~ /^TC[IO](ON|OFF)$/ || $2 ~ /^IN_/ || + $2 ~ /^LANDLOCK_/ || $2 ~ /^LOCK_(SH|EX|NB|UN)$/ || $2 ~ /^LO_(KEY|NAME)_SIZE$/ || $2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ || - $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL)_/ || + $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT)_/ || $2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ || $2 ~ /^NFC_.*_(MAX)?SIZE$/ || $2 ~ /^RAW_PAYLOAD_/ || @@ -563,6 +566,7 @@ ccflags="$@" $2 ~ /^KEYCTL_/ || $2 ~ /^PERF_/ || $2 ~ /^SECCOMP_MODE_/ || + $2 ~ /^SEEK_/ || $2 ~ /^SPLICE_/ || $2 ~ /^SYNC_FILE_RANGE_/ || $2 !~ /^AUDIT_RECORD_MAGIC/ && diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 9945e5f96..a8c13317d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -13,6 +13,7 @@ package unix import ( + "fmt" "runtime" "syscall" "unsafe" @@ -47,6 +48,30 @@ func (sa *SockaddrCtl) sockaddr() (unsafe.Pointer, _Socklen, error) { return unsafe.Pointer(&sa.raw), SizeofSockaddrCtl, nil } +// SockaddrVM implements the Sockaddr interface for AF_VSOCK type sockets. +// SockaddrVM provides access to Darwin VM sockets: a mechanism that enables +// bidirectional communication between a hypervisor and its guest virtual +// machines. +type SockaddrVM struct { + // CID and Port specify a context ID and port address for a VM socket. + // Guests have a unique CID, and hosts may have a well-known CID of: + // - VMADDR_CID_HYPERVISOR: refers to the hypervisor process. + // - VMADDR_CID_LOCAL: refers to local communication (loopback). + // - VMADDR_CID_HOST: refers to other processes on the host. + CID uint32 + Port uint32 + raw RawSockaddrVM +} + +func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) { + sa.raw.Len = SizeofSockaddrVM + sa.raw.Family = AF_VSOCK + sa.raw.Port = sa.Port + sa.raw.Cid = sa.CID + + return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil +} + func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { switch rsa.Addr.Family { case AF_SYSTEM: @@ -57,6 +82,13 @@ func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { sa.Unit = pp.Sc_unit return sa, nil } + case AF_VSOCK: + pp := (*RawSockaddrVM)(unsafe.Pointer(rsa)) + sa := &SockaddrVM{ + CID: pp.Cid, + Port: pp.Port, + } + return sa, nil } return nil, EAFNOSUPPORT } @@ -398,8 +430,45 @@ func GetsockoptXucred(fd, level, opt int) (*Xucred, error) { return x, err } +func SysctlKinfoProcSlice(name string) ([]KinfoProc, error) { + mib, err := sysctlmib(name) + if err != nil { + return nil, err + } + + // Find size. + n := uintptr(0) + if err := sysctl(mib, nil, &n, nil, 0); err != nil { + return nil, err + } + if n == 0 { + return nil, nil + } + if n%SizeofKinfoProc != 0 { + return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc) + } + + // Read into buffer of that size. + buf := make([]KinfoProc, n/SizeofKinfoProc) + if err := sysctl(mib, (*byte)(unsafe.Pointer(&buf[0])), &n, nil, 0); err != nil { + return nil, err + } + if n%SizeofKinfoProc != 0 { + return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc) + } + + // The actual call may return less than the original reported required + // size so ensure we deal with that. + return buf[:n/SizeofKinfoProc], nil +} + //sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) +//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error) +//sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) +//sys shmdt(addr uintptr) (err error) +//sys shmget(key int, size int, flag int) (id int, err error) + /* * Exposed directly */ @@ -557,10 +626,6 @@ func GetsockoptXucred(fd, level, opt int) (*Xucred, error) { // Msgget // Msgsnd // Msgrcv -// Shmat -// Shmctl -// Shmdt -// Shmget // Shm_open // Shm_unlink // Sem_open diff --git a/vendor/golang.org/x/sys/unix/syscall_illumos.go b/vendor/golang.org/x/sys/unix/syscall_illumos.go index 8c5357683..8d5f294c4 100644 --- a/vendor/golang.org/x/sys/unix/syscall_illumos.go +++ b/vendor/golang.org/x/sys/unix/syscall_illumos.go @@ -162,6 +162,14 @@ func (l *Lifreq) GetLifruInt() int { return *(*int)(unsafe.Pointer(&l.Lifru[0])) } +func (l *Lifreq) SetLifruUint(d uint) { + *(*uint)(unsafe.Pointer(&l.Lifru[0])) = d +} + +func (l *Lifreq) GetLifruUint() uint { + return *(*uint)(unsafe.Pointer(&l.Lifru[0])) +} + func IoctlLifreq(fd int, req uint, l *Lifreq) error { return ioctl(fd, req, uintptr(unsafe.Pointer(l))) } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 41b91fdfb..fff38a84c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -13,7 +13,6 @@ package unix import ( "encoding/binary" - "runtime" "syscall" "unsafe" ) @@ -38,6 +37,13 @@ func Creat(path string, mode uint32) (fd int, err error) { return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode) } +func EpollCreate(size int) (fd int, err error) { + if size <= 0 { + return -1, EINVAL + } + return EpollCreate1(0) +} + //sys FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) //sys fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) @@ -66,11 +72,22 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { return fchmodat(dirfd, path, mode) } -//sys ioctl(fd int, req uint, arg uintptr) (err error) +func InotifyInit() (fd int, err error) { + return InotifyInit1(0) +} -// ioctl itself should not be exposed directly, but additional get/set -// functions for specific types are permissible. -// These are defined in ioctl.go and ioctl_linux.go. +//sys ioctl(fd int, req uint, arg uintptr) (err error) = SYS_IOCTL +//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL + +// ioctl itself should not be exposed directly, but additional get/set functions +// for specific types are permissible. These are defined in ioctl.go and +// ioctl_linux.go. +// +// The third argument to ioctl is often a pointer but sometimes an integer. +// Callers should use ioctlPtr when the third argument is a pointer and ioctl +// when the third argument is an integer. +// +// TODO: some existing code incorrectly uses ioctl when it should use ioctlPtr. //sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) @@ -102,6 +119,23 @@ func Openat2(dirfd int, path string, how *OpenHow) (fd int, err error) { return openat2(dirfd, path, how, SizeofOpenHow) } +func Pipe(p []int) error { + return Pipe2(p, 0) +} + +//sysnb pipe2(p *[2]_C_int, flags int) (err error) + +func Pipe2(p []int, flags int) error { + if len(p) != 2 { + return EINVAL + } + var pp [2]_C_int + err := pipe2(&pp, flags) + p[0] = int(pp[0]) + p[1] = int(pp[1]) + return err +} + //sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { @@ -111,6 +145,15 @@ func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error return ppoll(&fds[0], len(fds), timeout, sigmask) } +func Poll(fds []PollFd, timeout int) (n int, err error) { + var ts *Timespec + if timeout >= 0 { + ts = new(Timespec) + *ts = NsecToTimespec(int64(timeout) * 1e6) + } + return Ppoll(fds, ts, nil) +} + //sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error) func Readlink(path string, buf []byte) (n int, err error) { @@ -161,27 +204,7 @@ func Utimes(path string, tv []Timeval) error { //sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) func UtimesNano(path string, ts []Timespec) error { - if ts == nil { - err := utimensat(AT_FDCWD, path, nil, 0) - if err != ENOSYS { - return err - } - return utimes(path, nil) - } - if len(ts) != 2 { - return EINVAL - } - err := utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) - if err != ENOSYS { - return err - } - // If the utimensat syscall isn't available (utimensat was added to Linux - // in 2.6.22, Released, 8 July 2007) then fall back to utimes - var tv [2]Timeval - for i := 0; i < 2; i++ { - tv[i] = NsecToTimeval(TimespecToNsec(ts[i])) - } - return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) + return UtimesNanoAt(AT_FDCWD, path, ts, 0) } func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error { @@ -1222,11 +1245,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { func Accept(fd int) (nfd int, sa Sockaddr, err error) { var rsa RawSockaddrAny var len _Socklen = SizeofSockaddrAny - // Try accept4 first for Android, then try accept for kernel older than 2.6.28 nfd, err = accept4(fd, &rsa, &len, 0) - if err == ENOSYS { - nfd, err = accept(fd, &rsa, &len) - } if err != nil { return } @@ -1348,6 +1367,13 @@ func SetsockoptTpacketReq3(fd, level, opt int, tp *TpacketReq3) error { return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp)) } +func SetsockoptTCPRepairOpt(fd, level, opt int, o []TCPRepairOpt) (err error) { + if len(o) == 0 { + return EINVAL + } + return setsockopt(fd, level, opt, unsafe.Pointer(&o[0]), uintptr(SizeofTCPRepairOpt*len(o))) +} + // Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html) // KeyctlInt calls keyctl commands in which each argument is an int. @@ -1802,11 +1828,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Dup(oldfd int) (fd int, err error) func Dup2(oldfd, newfd int) error { - // Android O and newer blocks dup2; riscv and arm64 don't implement dup2. - if runtime.GOOS == "android" || runtime.GOARCH == "riscv64" || runtime.GOARCH == "arm64" { - return Dup3(oldfd, newfd, 0) - } - return dup2(oldfd, newfd) + return Dup3(oldfd, newfd, 0) } //sys Dup3(oldfd int, newfd int, flags int) (err error) @@ -1859,7 +1881,7 @@ func Getpgrp() (pid int) { //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) //sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT -//sysnb prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64 +//sysnb Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64 //sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) //sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6 //sys read(fd int, p []byte) (n int, err error) @@ -2294,6 +2316,14 @@ type RemoteIovec struct { //sys ProcessVMReadv(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_READV //sys ProcessVMWritev(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_WRITEV +//sys PidfdOpen(pid int, flags int) (fd int, err error) = SYS_PIDFD_OPEN +//sys PidfdGetfd(pidfd int, targetfd int, flags int) (fd int, err error) = SYS_PIDFD_GETFD + +//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error) +//sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) +//sys shmdt(addr uintptr) (err error) +//sys shmget(key int, size int, flag int) (id int, err error) + /* * Unimplemented */ @@ -2375,10 +2405,6 @@ type RemoteIovec struct { // SetRobustList // SetThreadArea // SetTidAddress -// Shmat -// Shmctl -// Shmdt -// Shmget // Sigaltstack // Swapoff // Swapon diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_386.go index b430536c8..5f757e8aa 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_386.go @@ -19,36 +19,8 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: int32(sec), Usec: int32(usec)} } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - // 64-bit file system and 32-bit uid calls // (386 default is 32-bit file system and 16-bit uid). -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64_64 //sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32 @@ -59,7 +31,6 @@ func Pipe2(p []int, flags int) (err error) { //sysnb Geteuid() (euid int) = SYS_GETEUID32 //sysnb Getgid() (gid int) = SYS_GETGID32 //sysnb Getuid() (uid int) = SYS_GETUID32 -//sysnb InotifyInit() (fd int, err error) //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) //sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32 @@ -105,7 +76,7 @@ const rlimInf32 = ^uint32(0) const rlimInf64 = ^uint64(0) func Getrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, nil, rlim) + err = Prlimit(0, resource, nil, rlim) if err != ENOSYS { return err } @@ -133,7 +104,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { //sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT func Setrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, rlim, nil) + err = Prlimit(0, resource, rlim, nil) if err != ENOSYS { return err } @@ -381,12 +352,3 @@ func (cmsg *Cmsghdr) SetLen(length int) { func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { rsa.Service_name_len = uint32(length) } - -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go index 85cd97da0..4299125aa 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go @@ -7,8 +7,6 @@ package unix -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -21,17 +19,6 @@ package unix //sysnb Getgid() (gid int) //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) //sysnb Getuid() (uid int) -//sysnb inotifyInit() (fd int, err error) - -func InotifyInit() (fd int, err error) { - // First try inotify_init1, because Android's seccomp policy blocks the latter. - fd, err = InotifyInit1(0) - if err == ENOSYS { - fd, err = inotifyInit() - } - return -} - //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) //sys Lchown(path string, uid int, gid int) (err error) @@ -126,32 +113,6 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: sec, Usec: usec} } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - func (r *PtraceRegs) PC() uint64 { return r.Rip } func (r *PtraceRegs) SetPC(pc uint64) { r.Rip = pc } @@ -176,15 +137,6 @@ func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { rsa.Service_name_len = uint64(length) } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) -} - //sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go index 39a864d4e..79edeb9cb 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go @@ -19,36 +19,6 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: int32(sec), Usec: int32(usec)} } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - // Try pipe2 first for Android O, then try pipe for kernel 2.6.23. - err = pipe2(&pp, 0) - if err == ENOSYS { - err = pipe(&pp) - } - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { newoffset, errno := seek(fd, offset, whence) if errno != 0 { @@ -76,8 +46,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { // 64-bit file system and 32-bit uid calls // (16-bit uid calls are not always supported in newer kernels) -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32 //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 @@ -86,7 +54,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { //sysnb Geteuid() (euid int) = SYS_GETEUID32 //sysnb Getgid() (gid int) = SYS_GETGID32 //sysnb Getuid() (uid int) = SYS_GETUID32 -//sysnb InotifyInit() (fd int, err error) //sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32 //sys Listen(s int, n int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 @@ -184,7 +151,7 @@ const rlimInf32 = ^uint32(0) const rlimInf64 = ^uint64(0) func Getrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, nil, rlim) + err = Prlimit(0, resource, nil, rlim) if err != ENOSYS { return err } @@ -212,7 +179,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { //sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT func Setrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, rlim, nil) + err = Prlimit(0, resource, rlim, nil) if err != ENOSYS { return err } @@ -260,15 +227,6 @@ func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { rsa.Service_name_len = uint32(length) } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) -} - //sys armSyncFileRange(fd int, flags int, off int64, n int64) (err error) = SYS_ARM_SYNC_FILE_RANGE func SyncFileRange(fd int, off int64, n int64, flags int) error { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go index 7f27ebf2f..862890de2 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go @@ -9,13 +9,6 @@ package unix import "unsafe" -func EpollCreate(size int) (fd int, err error) { - if size <= 0 { - return -1, EINVAL - } - return EpollCreate1(0) -} - //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -145,33 +138,9 @@ func utimes(path string, tv *[2]Timeval) (err error) { return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) } -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, 0) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - // Getrlimit prefers the prlimit64 system call. See issue 38604. func Getrlimit(resource int, rlim *Rlimit) error { - err := prlimit(0, resource, nil, rlim) + err := Prlimit(0, resource, nil, rlim) if err != ENOSYS { return err } @@ -180,7 +149,7 @@ func Getrlimit(resource int, rlim *Rlimit) error { // Setrlimit prefers the prlimit64 system call. See issue 38604. func Setrlimit(resource int, rlim *Rlimit) error { - err := prlimit(0, resource, rlim, nil) + err := Prlimit(0, resource, rlim, nil) if err != ENOSYS { return err } @@ -211,31 +180,11 @@ func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { rsa.Service_name_len = uint64(length) } -func InotifyInit() (fd int, err error) { - return InotifyInit1(0) -} - -// dup2 exists because func Dup3 in syscall_linux.go references -// it in an unreachable path. dup2 isn't available on arm64. -func dup2(oldfd int, newfd int) error - func Pause() error { _, err := ppoll(nil, 0, nil, nil) return err } -func Poll(fds []PollFd, timeout int) (n int, err error) { - var ts *Timespec - if timeout >= 0 { - ts = new(Timespec) - *ts = NsecToTimespec(int64(timeout) * 1e6) - } - if len(fds) == 0 { - return ppoll(nil, 0, ts, nil) - } - return ppoll(&fds[0], len(fds), ts, nil) -} - //sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go index 27aee81d9..8932e34ad 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go @@ -8,8 +8,6 @@ package unix -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -94,30 +92,6 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: sec, Usec: usec} } -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, 0) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - func Ioperm(from int, num int, on int) (err error) { return ENOSYS } @@ -220,16 +194,3 @@ func (cmsg *Cmsghdr) SetLen(length int) { func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { rsa.Service_name_len = uint64(length) } - -func InotifyInit() (fd int, err error) { - return InotifyInit1(0) -} - -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go index 3a5621e37..7821c25d9 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go @@ -15,8 +15,6 @@ import ( func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -60,7 +58,6 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) -//sysnb InotifyInit() (fd int, err error) //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) @@ -113,29 +110,6 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: int32(sec), Usec: int32(usec)} } -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe() (p1 int, p2 int, err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - p[0], p[1], err = pipe() - return -} - //sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { @@ -157,7 +131,7 @@ type rlimit32 struct { //sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT func Getrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, nil, rlim) + err = Prlimit(0, resource, nil, rlim) if err != ENOSYS { return err } @@ -185,7 +159,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { //sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT func Setrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, rlim, nil) + err = Prlimit(0, resource, rlim, nil) if err != ENOSYS { return err } @@ -232,12 +206,3 @@ func (cmsg *Cmsghdr) SetLen(length int) { func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { rsa.Service_name_len = uint32(length) } - -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go index cf0d36f76..c5053a0f0 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go @@ -3,8 +3,7 @@ // license that can be found in the LICENSE file. //go:build linux && ppc -// +build linux -// +build ppc +// +build linux,ppc package unix @@ -13,8 +12,6 @@ import ( "unsafe" ) -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fchown(fd int, uid int, gid int) (err error) //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 @@ -24,7 +21,6 @@ import ( //sysnb Geteuid() (euid int) //sysnb Getgid() (gid int) //sysnb Getuid() (uid int) -//sysnb InotifyInit() (fd int, err error) //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) //sys Lchown(path string, uid int, gid int) (err error) @@ -143,7 +139,7 @@ const rlimInf32 = ^uint32(0) const rlimInf64 = ^uint64(0) func Getrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, nil, rlim) + err = Prlimit(0, resource, nil, rlim) if err != ENOSYS { return err } @@ -171,7 +167,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { //sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT func Setrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, rlim, nil) + err = Prlimit(0, resource, rlim, nil) if err != ENOSYS { return err } @@ -219,41 +215,6 @@ func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { rsa.Service_name_len = uint32(length) } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) -} - //sys syncFileRange2(fd int, flags int, off int64, n int64) (err error) = SYS_SYNC_FILE_RANGE2 func SyncFileRange(fd int, off int64, n int64, flags int) error { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go index 5259a5fea..25786c421 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go @@ -8,8 +8,6 @@ package unix -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -22,7 +20,6 @@ package unix //sysnb Getgid() (gid int) //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_UGETRLIMIT //sysnb Getuid() (uid int) -//sysnb InotifyInit() (fd int, err error) //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) //sys Lchown(path string, uid int, gid int) (err error) @@ -104,41 +101,6 @@ func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { rsa.Service_name_len = uint64(length) } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) -} - //sys syncFileRange2(fd int, flags int, off int64, n int64) (err error) = SYS_SYNC_FILE_RANGE2 func SyncFileRange(fd int, off int64, n int64, flags int) error { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go index 8ef821e5d..6f9f71041 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go @@ -9,13 +9,6 @@ package unix import "unsafe" -func EpollCreate(size int) (fd int, err error) { - if size <= 0 { - return -1, EINVAL - } - return EpollCreate1(0) -} - //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -144,30 +137,6 @@ func utimes(path string, tv *[2]Timeval) (err error) { return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) } -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, 0) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - func (r *PtraceRegs) PC() uint64 { return r.Pc } func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc } @@ -192,27 +161,11 @@ func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { rsa.Service_name_len = uint64(length) } -func InotifyInit() (fd int, err error) { - return InotifyInit1(0) -} - func Pause() error { _, err := ppoll(nil, 0, nil, nil) return err } -func Poll(fds []PollFd, timeout int) (n int, err error) { - var ts *Timespec - if timeout >= 0 { - ts = new(Timespec) - *ts = NsecToTimespec(int64(timeout) * 1e6) - } - if len(fds) == 0 { - return ppoll(nil, 0, ts, nil) - } - return ppoll(&fds[0], len(fds), ts, nil) -} - func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { return Renameat2(olddirfd, oldpath, newdirfd, newpath, 0) } @@ -229,7 +182,3 @@ func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error } return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags) } - -// dup2 exists because func Dup3 in syscall_linux.go references -// it in an unreachable path. dup2 isn't available on arm64. -func dup2(oldfd int, newfd int) error diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go index a1c0574b5..6aa59cb27 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go @@ -11,8 +11,6 @@ import ( "unsafe" ) -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -25,7 +23,6 @@ import ( //sysnb Getgid() (gid int) //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) //sysnb Getuid() (uid int) -//sysnb InotifyInit() (fd int, err error) //sys Lchown(path string, uid int, gid int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) //sys Pause() (err error) @@ -77,30 +74,6 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: sec, Usec: usec} } -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, 0) // pipe2 is the same as pipe when flags are set to 0. - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - func Ioperm(from int, num int, on int) (err error) { return ENOSYS } @@ -324,15 +297,6 @@ func Shutdown(s, how int) error { return nil } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) -} - //sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go index de14b8898..bbe8d174f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go @@ -9,7 +9,6 @@ package unix //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 -//sys dup2(oldfd int, newfd int) (err error) //sys Fchown(fd int, uid int, gid int) (err error) //sys Fstat(fd int, stat *Stat_t) (err error) //sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 @@ -20,7 +19,6 @@ package unix //sysnb Getgid() (gid int) //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) //sysnb Getuid() (uid int) -//sysnb InotifyInit() (fd int, err error) //sys Lchown(path string, uid int, gid int) (err error) //sys Listen(s int, n int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) @@ -119,38 +117,3 @@ func (cmsg *Cmsghdr) SetLen(length int) { func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { rsa.Service_name_len = uint64(length) } - -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index 77fcde7c1..d2a6495c7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -13,7 +13,10 @@ package unix import ( + "fmt" + "os" "runtime" + "sync" "syscall" "unsafe" ) @@ -744,3 +747,240 @@ func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, e func Munmap(b []byte) (err error) { return mapper.Munmap(b) } + +// Event Ports + +type fileObjCookie struct { + fobj *fileObj + cookie interface{} +} + +// EventPort provides a safe abstraction on top of Solaris/illumos Event Ports. +type EventPort struct { + port int + mu sync.Mutex + fds map[uintptr]interface{} + paths map[string]*fileObjCookie +} + +// PortEvent is an abstraction of the port_event C struct. +// Compare Source against PORT_SOURCE_FILE or PORT_SOURCE_FD +// to see if Path or Fd was the event source. The other will be +// uninitialized. +type PortEvent struct { + Cookie interface{} + Events int32 + Fd uintptr + Path string + Source uint16 + fobj *fileObj +} + +// NewEventPort creates a new EventPort including the +// underlying call to port_create(3c). +func NewEventPort() (*EventPort, error) { + port, err := port_create() + if err != nil { + return nil, err + } + e := &EventPort{ + port: port, + fds: make(map[uintptr]interface{}), + paths: make(map[string]*fileObjCookie), + } + return e, nil +} + +//sys port_create() (n int, err error) +//sys port_associate(port int, source int, object uintptr, events int, user *byte) (n int, err error) +//sys port_dissociate(port int, source int, object uintptr) (n int, err error) +//sys port_get(port int, pe *portEvent, timeout *Timespec) (n int, err error) +//sys port_getn(port int, pe *portEvent, max uint32, nget *uint32, timeout *Timespec) (n int, err error) + +// Close closes the event port. +func (e *EventPort) Close() error { + e.mu.Lock() + defer e.mu.Unlock() + e.fds = nil + e.paths = nil + return Close(e.port) +} + +// PathIsWatched checks to see if path is associated with this EventPort. +func (e *EventPort) PathIsWatched(path string) bool { + e.mu.Lock() + defer e.mu.Unlock() + _, found := e.paths[path] + return found +} + +// FdIsWatched checks to see if fd is associated with this EventPort. +func (e *EventPort) FdIsWatched(fd uintptr) bool { + e.mu.Lock() + defer e.mu.Unlock() + _, found := e.fds[fd] + return found +} + +// AssociatePath wraps port_associate(3c) for a filesystem path including +// creating the necessary file_obj from the provided stat information. +func (e *EventPort) AssociatePath(path string, stat os.FileInfo, events int, cookie interface{}) error { + e.mu.Lock() + defer e.mu.Unlock() + if _, found := e.paths[path]; found { + return fmt.Errorf("%v is already associated with this Event Port", path) + } + fobj, err := createFileObj(path, stat) + if err != nil { + return err + } + fCookie := &fileObjCookie{fobj, cookie} + _, err = port_associate(e.port, PORT_SOURCE_FILE, uintptr(unsafe.Pointer(fobj)), events, (*byte)(unsafe.Pointer(&fCookie.cookie))) + if err != nil { + return err + } + e.paths[path] = fCookie + return nil +} + +// DissociatePath wraps port_dissociate(3c) for a filesystem path. +func (e *EventPort) DissociatePath(path string) error { + e.mu.Lock() + defer e.mu.Unlock() + f, ok := e.paths[path] + if !ok { + return fmt.Errorf("%v is not associated with this Event Port", path) + } + _, err := port_dissociate(e.port, PORT_SOURCE_FILE, uintptr(unsafe.Pointer(f.fobj))) + if err != nil { + return err + } + delete(e.paths, path) + return nil +} + +// AssociateFd wraps calls to port_associate(3c) on file descriptors. +func (e *EventPort) AssociateFd(fd uintptr, events int, cookie interface{}) error { + e.mu.Lock() + defer e.mu.Unlock() + if _, found := e.fds[fd]; found { + return fmt.Errorf("%v is already associated with this Event Port", fd) + } + pcookie := &cookie + _, err := port_associate(e.port, PORT_SOURCE_FD, fd, events, (*byte)(unsafe.Pointer(pcookie))) + if err != nil { + return err + } + e.fds[fd] = pcookie + return nil +} + +// DissociateFd wraps calls to port_dissociate(3c) on file descriptors. +func (e *EventPort) DissociateFd(fd uintptr) error { + e.mu.Lock() + defer e.mu.Unlock() + _, ok := e.fds[fd] + if !ok { + return fmt.Errorf("%v is not associated with this Event Port", fd) + } + _, err := port_dissociate(e.port, PORT_SOURCE_FD, fd) + if err != nil { + return err + } + delete(e.fds, fd) + return nil +} + +func createFileObj(name string, stat os.FileInfo) (*fileObj, error) { + fobj := new(fileObj) + bs, err := ByteSliceFromString(name) + if err != nil { + return nil, err + } + fobj.Name = (*int8)(unsafe.Pointer(&bs[0])) + s := stat.Sys().(*syscall.Stat_t) + fobj.Atim.Sec = s.Atim.Sec + fobj.Atim.Nsec = s.Atim.Nsec + fobj.Mtim.Sec = s.Mtim.Sec + fobj.Mtim.Nsec = s.Mtim.Nsec + fobj.Ctim.Sec = s.Ctim.Sec + fobj.Ctim.Nsec = s.Ctim.Nsec + return fobj, nil +} + +// GetOne wraps port_get(3c) and returns a single PortEvent. +func (e *EventPort) GetOne(t *Timespec) (*PortEvent, error) { + pe := new(portEvent) + _, err := port_get(e.port, pe, t) + if err != nil { + return nil, err + } + p := new(PortEvent) + p.Events = pe.Events + p.Source = pe.Source + e.mu.Lock() + defer e.mu.Unlock() + switch pe.Source { + case PORT_SOURCE_FD: + p.Fd = uintptr(pe.Object) + cookie := (*interface{})(unsafe.Pointer(pe.User)) + p.Cookie = *cookie + delete(e.fds, p.Fd) + case PORT_SOURCE_FILE: + p.fobj = (*fileObj)(unsafe.Pointer(uintptr(pe.Object))) + p.Path = BytePtrToString((*byte)(unsafe.Pointer(p.fobj.Name))) + cookie := (*interface{})(unsafe.Pointer(pe.User)) + p.Cookie = *cookie + delete(e.paths, p.Path) + } + return p, nil +} + +// Pending wraps port_getn(3c) and returns how many events are pending. +func (e *EventPort) Pending() (int, error) { + var n uint32 = 0 + _, err := port_getn(e.port, nil, 0, &n, nil) + return int(n), err +} + +// Get wraps port_getn(3c) and fills a slice of PortEvent. +// It will block until either min events have been received +// or the timeout has been exceeded. It will return how many +// events were actually received along with any error information. +func (e *EventPort) Get(s []PortEvent, min int, timeout *Timespec) (int, error) { + if min == 0 { + return 0, fmt.Errorf("need to request at least one event or use Pending() instead") + } + if len(s) < min { + return 0, fmt.Errorf("len(s) (%d) is less than min events requested (%d)", len(s), min) + } + got := uint32(min) + max := uint32(len(s)) + var err error + ps := make([]portEvent, max, max) + _, err = port_getn(e.port, &ps[0], max, &got, timeout) + // got will be trustworthy with ETIME, but not any other error. + if err != nil && err != ETIME { + return 0, err + } + e.mu.Lock() + defer e.mu.Unlock() + for i := 0; i < int(got); i++ { + s[i].Events = ps[i].Events + s[i].Source = ps[i].Source + switch ps[i].Source { + case PORT_SOURCE_FD: + s[i].Fd = uintptr(ps[i].Object) + cookie := (*interface{})(unsafe.Pointer(ps[i].User)) + s[i].Cookie = *cookie + delete(e.fds, s[i].Fd) + case PORT_SOURCE_FILE: + s[i].fobj = (*fileObj)(unsafe.Pointer(uintptr(ps[i].Object))) + s[i].Path = BytePtrToString((*byte)(unsafe.Pointer(s[i].fobj.Name))) + cookie := (*interface{})(unsafe.Pointer(ps[i].User)) + s[i].Cookie = *cookie + delete(e.paths, s[i].Path) + } + } + return int(got), err +} diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index a7618ceb5..cf296a243 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -313,6 +313,10 @@ func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) { return } +func Send(s int, buf []byte, flags int) (err error) { + return sendto(s, buf, flags, nil, 0) +} + func Sendto(fd int, p []byte, flags int, to Sockaddr) (err error) { ptr, n, err := to.sockaddr() if err != nil { diff --git a/vendor/golang.org/x/sys/unix/sysvshm_linux.go b/vendor/golang.org/x/sys/unix/sysvshm_linux.go new file mode 100644 index 000000000..2c3a4437f --- /dev/null +++ b/vendor/golang.org/x/sys/unix/sysvshm_linux.go @@ -0,0 +1,21 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build linux +// +build linux + +package unix + +import "runtime" + +// SysvShmCtl performs control operations on the shared memory segment +// specified by id. +func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) { + if runtime.GOARCH == "arm" || + runtime.GOARCH == "mips64" || runtime.GOARCH == "mips64le" { + cmd |= ipc_64 + } + + return shmctl(id, cmd, desc) +} diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix.go b/vendor/golang.org/x/sys/unix/sysvshm_unix.go new file mode 100644 index 000000000..0bb4c8de5 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/sysvshm_unix.go @@ -0,0 +1,61 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build (darwin && !ios) || linux +// +build darwin,!ios linux + +package unix + +import ( + "unsafe" + + "golang.org/x/sys/internal/unsafeheader" +) + +// SysvShmAttach attaches the Sysv shared memory segment associated with the +// shared memory identifier id. +func SysvShmAttach(id int, addr uintptr, flag int) ([]byte, error) { + addr, errno := shmat(id, addr, flag) + if errno != nil { + return nil, errno + } + + // Retrieve the size of the shared memory to enable slice creation + var info SysvShmDesc + + _, err := SysvShmCtl(id, IPC_STAT, &info) + if err != nil { + // release the shared memory if we can't find the size + + // ignoring error from shmdt as there's nothing sensible to return here + shmdt(addr) + return nil, err + } + + // Use unsafe to convert addr into a []byte. + // TODO: convert to unsafe.Slice once we can assume Go 1.17 + var b []byte + hdr := (*unsafeheader.Slice)(unsafe.Pointer(&b)) + hdr.Data = unsafe.Pointer(addr) + hdr.Cap = int(info.Segsz) + hdr.Len = int(info.Segsz) + return b, nil +} + +// SysvShmDetach unmaps the shared memory slice returned from SysvShmAttach. +// +// It is not safe to use the slice after calling this function. +func SysvShmDetach(data []byte) error { + if len(data) == 0 { + return EINVAL + } + + return shmdt(uintptr(unsafe.Pointer(&data[0]))) +} + +// SysvShmGet returns the Sysv shared memory identifier associated with key. +// If the IPC_CREAT flag is specified a new segment is created. +func SysvShmGet(key, size, flag int) (id int, err error) { + return shmget(key, size, flag) +} diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go b/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go new file mode 100644 index 000000000..71bddefdb --- /dev/null +++ b/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go @@ -0,0 +1,14 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin && !ios +// +build darwin,!ios + +package unix + +// SysvShmCtl performs control operations on the shared memory segment +// specified by id. +func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) { + return shmctl(id, cmd, desc) +} diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index 991996b60..476a1c7e7 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -12,1550 +12,1582 @@ package unix import "syscall" const ( - AF_APPLETALK = 0x10 - AF_CCITT = 0xa - AF_CHAOS = 0x5 - AF_CNT = 0x15 - AF_COIP = 0x14 - AF_DATAKIT = 0x9 - AF_DECnet = 0xc - AF_DLI = 0xd - AF_E164 = 0x1c - AF_ECMA = 0x8 - AF_HYLINK = 0xf - AF_IEEE80211 = 0x25 - AF_IMPLINK = 0x3 - AF_INET = 0x2 - AF_INET6 = 0x1e - AF_IPX = 0x17 - AF_ISDN = 0x1c - AF_ISO = 0x7 - AF_LAT = 0xe - AF_LINK = 0x12 - AF_LOCAL = 0x1 - AF_MAX = 0x29 - AF_NATM = 0x1f - AF_NDRV = 0x1b - AF_NETBIOS = 0x21 - AF_NS = 0x6 - AF_OSI = 0x7 - AF_PPP = 0x22 - AF_PUP = 0x4 - AF_RESERVED_36 = 0x24 - AF_ROUTE = 0x11 - AF_SIP = 0x18 - AF_SNA = 0xb - AF_SYSTEM = 0x20 - AF_SYS_CONTROL = 0x2 - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - AF_UTUN = 0x26 - AF_VSOCK = 0x28 - ALTWERASE = 0x200 - ATTR_BIT_MAP_COUNT = 0x5 - ATTR_CMN_ACCESSMASK = 0x20000 - ATTR_CMN_ACCTIME = 0x1000 - ATTR_CMN_ADDEDTIME = 0x10000000 - ATTR_CMN_BKUPTIME = 0x2000 - ATTR_CMN_CHGTIME = 0x800 - ATTR_CMN_CRTIME = 0x200 - ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 - ATTR_CMN_DEVID = 0x2 - ATTR_CMN_DOCUMENT_ID = 0x100000 - ATTR_CMN_ERROR = 0x20000000 - ATTR_CMN_EXTENDED_SECURITY = 0x400000 - ATTR_CMN_FILEID = 0x2000000 - ATTR_CMN_FLAGS = 0x40000 - ATTR_CMN_FNDRINFO = 0x4000 - ATTR_CMN_FSID = 0x4 - ATTR_CMN_FULLPATH = 0x8000000 - ATTR_CMN_GEN_COUNT = 0x80000 - ATTR_CMN_GRPID = 0x10000 - ATTR_CMN_GRPUUID = 0x1000000 - ATTR_CMN_MODTIME = 0x400 - ATTR_CMN_NAME = 0x1 - ATTR_CMN_NAMEDATTRCOUNT = 0x80000 - ATTR_CMN_NAMEDATTRLIST = 0x100000 - ATTR_CMN_OBJID = 0x20 - ATTR_CMN_OBJPERMANENTID = 0x40 - ATTR_CMN_OBJTAG = 0x10 - ATTR_CMN_OBJTYPE = 0x8 - ATTR_CMN_OWNERID = 0x8000 - ATTR_CMN_PARENTID = 0x4000000 - ATTR_CMN_PAROBJID = 0x80 - ATTR_CMN_RETURNED_ATTRS = 0x80000000 - ATTR_CMN_SCRIPT = 0x100 - ATTR_CMN_SETMASK = 0x51c7ff00 - ATTR_CMN_USERACCESS = 0x200000 - ATTR_CMN_UUID = 0x800000 - ATTR_CMN_VALIDMASK = 0xffffffff - ATTR_CMN_VOLSETMASK = 0x6700 - ATTR_FILE_ALLOCSIZE = 0x4 - ATTR_FILE_CLUMPSIZE = 0x10 - ATTR_FILE_DATAALLOCSIZE = 0x400 - ATTR_FILE_DATAEXTENTS = 0x800 - ATTR_FILE_DATALENGTH = 0x200 - ATTR_FILE_DEVTYPE = 0x20 - ATTR_FILE_FILETYPE = 0x40 - ATTR_FILE_FORKCOUNT = 0x80 - ATTR_FILE_FORKLIST = 0x100 - ATTR_FILE_IOBLOCKSIZE = 0x8 - ATTR_FILE_LINKCOUNT = 0x1 - ATTR_FILE_RSRCALLOCSIZE = 0x2000 - ATTR_FILE_RSRCEXTENTS = 0x4000 - ATTR_FILE_RSRCLENGTH = 0x1000 - ATTR_FILE_SETMASK = 0x20 - ATTR_FILE_TOTALSIZE = 0x2 - ATTR_FILE_VALIDMASK = 0x37ff - ATTR_VOL_ALLOCATIONCLUMP = 0x40 - ATTR_VOL_ATTRIBUTES = 0x40000000 - ATTR_VOL_CAPABILITIES = 0x20000 - ATTR_VOL_DIRCOUNT = 0x400 - ATTR_VOL_ENCODINGSUSED = 0x10000 - ATTR_VOL_FILECOUNT = 0x200 - ATTR_VOL_FSTYPE = 0x1 - ATTR_VOL_INFO = 0x80000000 - ATTR_VOL_IOBLOCKSIZE = 0x80 - ATTR_VOL_MAXOBJCOUNT = 0x800 - ATTR_VOL_MINALLOCATION = 0x20 - ATTR_VOL_MOUNTEDDEVICE = 0x8000 - ATTR_VOL_MOUNTFLAGS = 0x4000 - ATTR_VOL_MOUNTPOINT = 0x1000 - ATTR_VOL_NAME = 0x2000 - ATTR_VOL_OBJCOUNT = 0x100 - ATTR_VOL_QUOTA_SIZE = 0x10000000 - ATTR_VOL_RESERVED_SIZE = 0x20000000 - ATTR_VOL_SETMASK = 0x80002000 - ATTR_VOL_SIGNATURE = 0x2 - ATTR_VOL_SIZE = 0x4 - ATTR_VOL_SPACEAVAIL = 0x10 - ATTR_VOL_SPACEFREE = 0x8 - ATTR_VOL_UUID = 0x40000 - ATTR_VOL_VALIDMASK = 0xf007ffff - B0 = 0x0 - B110 = 0x6e - B115200 = 0x1c200 - B1200 = 0x4b0 - B134 = 0x86 - B14400 = 0x3840 - B150 = 0x96 - B1800 = 0x708 - B19200 = 0x4b00 - B200 = 0xc8 - B230400 = 0x38400 - B2400 = 0x960 - B28800 = 0x7080 - B300 = 0x12c - B38400 = 0x9600 - B4800 = 0x12c0 - B50 = 0x32 - B57600 = 0xe100 - B600 = 0x258 - B7200 = 0x1c20 - B75 = 0x4b - B76800 = 0x12c00 - B9600 = 0x2580 - BIOCFLUSH = 0x20004268 - BIOCGBLEN = 0x40044266 - BIOCGDLT = 0x4004426a - BIOCGDLTLIST = 0xc00c4279 - BIOCGETIF = 0x4020426b - BIOCGHDRCMPLT = 0x40044274 - BIOCGRSIG = 0x40044272 - BIOCGRTIMEOUT = 0x4010426e - BIOCGSEESENT = 0x40044276 - BIOCGSTATS = 0x4008426f - BIOCIMMEDIATE = 0x80044270 - BIOCPROMISC = 0x20004269 - BIOCSBLEN = 0xc0044266 - BIOCSDLT = 0x80044278 - BIOCSETF = 0x80104267 - BIOCSETFNR = 0x8010427e - BIOCSETIF = 0x8020426c - BIOCSHDRCMPLT = 0x80044275 - BIOCSRSIG = 0x80044273 - BIOCSRTIMEOUT = 0x8010426d - BIOCSSEESENT = 0x80044277 - BIOCVERSION = 0x40044271 - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALIGNMENT = 0x4 - BPF_ALU = 0x4 - BPF_AND = 0x50 - BPF_B = 0x10 - BPF_DIV = 0x30 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JMP = 0x5 - BPF_JSET = 0x40 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXBUFSIZE = 0x80000 - BPF_MAXINSNS = 0x200 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINBUFSIZE = 0x20 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_OR = 0x40 - BPF_RELEASE = 0x30bb6 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAX = 0x0 - BPF_TXA = 0x80 - BPF_W = 0x0 - BPF_X = 0x8 - BRKINT = 0x2 - BS0 = 0x0 - BS1 = 0x8000 - BSDLY = 0x8000 - CFLUSH = 0xf - CLOCAL = 0x8000 - CLOCK_MONOTONIC = 0x6 - CLOCK_MONOTONIC_RAW = 0x4 - CLOCK_MONOTONIC_RAW_APPROX = 0x5 - CLOCK_PROCESS_CPUTIME_ID = 0xc - CLOCK_REALTIME = 0x0 - CLOCK_THREAD_CPUTIME_ID = 0x10 - CLOCK_UPTIME_RAW = 0x8 - CLOCK_UPTIME_RAW_APPROX = 0x9 - CLONE_NOFOLLOW = 0x1 - CLONE_NOOWNERCOPY = 0x2 - CR0 = 0x0 - CR1 = 0x1000 - CR2 = 0x2000 - CR3 = 0x3000 - CRDLY = 0x3000 - CREAD = 0x800 - CRTSCTS = 0x30000 - CS5 = 0x0 - CS6 = 0x100 - CS7 = 0x200 - CS8 = 0x300 - CSIZE = 0x300 - CSTART = 0x11 - CSTATUS = 0x14 - CSTOP = 0x13 - CSTOPB = 0x400 - CSUSP = 0x1a - CTLIOCGINFO = 0xc0644e03 - CTL_HW = 0x6 - CTL_KERN = 0x1 - CTL_MAXNAME = 0xc - CTL_NET = 0x4 - DLT_A429 = 0xb8 - DLT_A653_ICM = 0xb9 - DLT_AIRONET_HEADER = 0x78 - DLT_AOS = 0xde - DLT_APPLE_IP_OVER_IEEE1394 = 0x8a - DLT_ARCNET = 0x7 - DLT_ARCNET_LINUX = 0x81 - DLT_ATM_CLIP = 0x13 - DLT_ATM_RFC1483 = 0xb - DLT_AURORA = 0x7e - DLT_AX25 = 0x3 - DLT_AX25_KISS = 0xca - DLT_BACNET_MS_TP = 0xa5 - DLT_BLUETOOTH_HCI_H4 = 0xbb - DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 - DLT_CAN20B = 0xbe - DLT_CAN_SOCKETCAN = 0xe3 - DLT_CHAOS = 0x5 - DLT_CHDLC = 0x68 - DLT_CISCO_IOS = 0x76 - DLT_C_HDLC = 0x68 - DLT_C_HDLC_WITH_DIR = 0xcd - DLT_DBUS = 0xe7 - DLT_DECT = 0xdd - DLT_DOCSIS = 0x8f - DLT_DVB_CI = 0xeb - DLT_ECONET = 0x73 - DLT_EN10MB = 0x1 - DLT_EN3MB = 0x2 - DLT_ENC = 0x6d - DLT_ERF = 0xc5 - DLT_ERF_ETH = 0xaf - DLT_ERF_POS = 0xb0 - DLT_FC_2 = 0xe0 - DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 - DLT_FDDI = 0xa - DLT_FLEXRAY = 0xd2 - DLT_FRELAY = 0x6b - DLT_FRELAY_WITH_DIR = 0xce - DLT_GCOM_SERIAL = 0xad - DLT_GCOM_T1E1 = 0xac - DLT_GPF_F = 0xab - DLT_GPF_T = 0xaa - DLT_GPRS_LLC = 0xa9 - DLT_GSMTAP_ABIS = 0xda - DLT_GSMTAP_UM = 0xd9 - DLT_HHDLC = 0x79 - DLT_IBM_SN = 0x92 - DLT_IBM_SP = 0x91 - DLT_IEEE802 = 0x6 - DLT_IEEE802_11 = 0x69 - DLT_IEEE802_11_RADIO = 0x7f - DLT_IEEE802_11_RADIO_AVS = 0xa3 - DLT_IEEE802_15_4 = 0xc3 - DLT_IEEE802_15_4_LINUX = 0xbf - DLT_IEEE802_15_4_NOFCS = 0xe6 - DLT_IEEE802_15_4_NONASK_PHY = 0xd7 - DLT_IEEE802_16_MAC_CPS = 0xbc - DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 - DLT_IPFILTER = 0x74 - DLT_IPMB = 0xc7 - DLT_IPMB_LINUX = 0xd1 - DLT_IPNET = 0xe2 - DLT_IPOIB = 0xf2 - DLT_IPV4 = 0xe4 - DLT_IPV6 = 0xe5 - DLT_IP_OVER_FC = 0x7a - DLT_JUNIPER_ATM1 = 0x89 - DLT_JUNIPER_ATM2 = 0x87 - DLT_JUNIPER_ATM_CEMIC = 0xee - DLT_JUNIPER_CHDLC = 0xb5 - DLT_JUNIPER_ES = 0x84 - DLT_JUNIPER_ETHER = 0xb2 - DLT_JUNIPER_FIBRECHANNEL = 0xea - DLT_JUNIPER_FRELAY = 0xb4 - DLT_JUNIPER_GGSN = 0x85 - DLT_JUNIPER_ISM = 0xc2 - DLT_JUNIPER_MFR = 0x86 - DLT_JUNIPER_MLFR = 0x83 - DLT_JUNIPER_MLPPP = 0x82 - DLT_JUNIPER_MONITOR = 0xa4 - DLT_JUNIPER_PIC_PEER = 0xae - DLT_JUNIPER_PPP = 0xb3 - DLT_JUNIPER_PPPOE = 0xa7 - DLT_JUNIPER_PPPOE_ATM = 0xa8 - DLT_JUNIPER_SERVICES = 0x88 - DLT_JUNIPER_SRX_E2E = 0xe9 - DLT_JUNIPER_ST = 0xc8 - DLT_JUNIPER_VP = 0xb7 - DLT_JUNIPER_VS = 0xe8 - DLT_LAPB_WITH_DIR = 0xcf - DLT_LAPD = 0xcb - DLT_LIN = 0xd4 - DLT_LINUX_EVDEV = 0xd8 - DLT_LINUX_IRDA = 0x90 - DLT_LINUX_LAPD = 0xb1 - DLT_LINUX_PPP_WITHDIRECTION = 0xa6 - DLT_LINUX_SLL = 0x71 - DLT_LOOP = 0x6c - DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0x10a - DLT_MATCHING_MIN = 0x68 - DLT_MFR = 0xb6 - DLT_MOST = 0xd3 - DLT_MPEG_2_TS = 0xf3 - DLT_MPLS = 0xdb - DLT_MTP2 = 0x8c - DLT_MTP2_WITH_PHDR = 0x8b - DLT_MTP3 = 0x8d - DLT_MUX27010 = 0xec - DLT_NETANALYZER = 0xf0 - DLT_NETANALYZER_TRANSPARENT = 0xf1 - DLT_NFC_LLCP = 0xf5 - DLT_NFLOG = 0xef - DLT_NG40 = 0xf4 - DLT_NULL = 0x0 - DLT_PCI_EXP = 0x7d - DLT_PFLOG = 0x75 - DLT_PFSYNC = 0x12 - DLT_PPI = 0xc0 - DLT_PPP = 0x9 - DLT_PPP_BSDOS = 0x10 - DLT_PPP_ETHER = 0x33 - DLT_PPP_PPPD = 0xa6 - DLT_PPP_SERIAL = 0x32 - DLT_PPP_WITH_DIR = 0xcc - DLT_PPP_WITH_DIRECTION = 0xa6 - DLT_PRISM_HEADER = 0x77 - DLT_PRONET = 0x4 - DLT_RAIF1 = 0xc6 - DLT_RAW = 0xc - DLT_RIO = 0x7c - DLT_SCCP = 0x8e - DLT_SITA = 0xc4 - DLT_SLIP = 0x8 - DLT_SLIP_BSDOS = 0xf - DLT_STANAG_5066_D_PDU = 0xed - DLT_SUNATM = 0x7b - DLT_SYMANTEC_FIREWALL = 0x63 - DLT_TZSP = 0x80 - DLT_USB = 0xba - DLT_USB_DARWIN = 0x10a - DLT_USB_LINUX = 0xbd - DLT_USB_LINUX_MMAPPED = 0xdc - DLT_USER0 = 0x93 - DLT_USER1 = 0x94 - DLT_USER10 = 0x9d - DLT_USER11 = 0x9e - DLT_USER12 = 0x9f - DLT_USER13 = 0xa0 - DLT_USER14 = 0xa1 - DLT_USER15 = 0xa2 - DLT_USER2 = 0x95 - DLT_USER3 = 0x96 - DLT_USER4 = 0x97 - DLT_USER5 = 0x98 - DLT_USER6 = 0x99 - DLT_USER7 = 0x9a - DLT_USER8 = 0x9b - DLT_USER9 = 0x9c - DLT_WIHART = 0xdf - DLT_X2E_SERIAL = 0xd5 - DLT_X2E_XORAYA = 0xd6 - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x40 - ECHOE = 0x2 - ECHOK = 0x4 - ECHOKE = 0x1 - ECHONL = 0x10 - ECHOPRT = 0x20 - EVFILT_AIO = -0x3 - EVFILT_EXCEPT = -0xf - EVFILT_FS = -0x9 - EVFILT_MACHPORT = -0x8 - EVFILT_PROC = -0x5 - EVFILT_READ = -0x1 - EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0x11 - EVFILT_THREADMARKER = 0x11 - EVFILT_TIMER = -0x7 - EVFILT_USER = -0xa - EVFILT_VM = -0xc - EVFILT_VNODE = -0x4 - EVFILT_WRITE = -0x2 - EV_ADD = 0x1 - EV_CLEAR = 0x20 - EV_DELETE = 0x2 - EV_DISABLE = 0x8 - EV_DISPATCH = 0x80 - EV_DISPATCH2 = 0x180 - EV_ENABLE = 0x4 - EV_EOF = 0x8000 - EV_ERROR = 0x4000 - EV_FLAG0 = 0x1000 - EV_FLAG1 = 0x2000 - EV_ONESHOT = 0x10 - EV_OOBAND = 0x2000 - EV_POLL = 0x1000 - EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 - EV_UDATA_SPECIFIC = 0x100 - EV_VANISHED = 0x200 - EXTA = 0x4b00 - EXTB = 0x9600 - EXTPROC = 0x800 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x400 - FF0 = 0x0 - FF1 = 0x4000 - FFDLY = 0x4000 - FLUSHO = 0x800000 - FSOPT_ATTR_CMN_EXTENDED = 0x20 - FSOPT_NOFOLLOW = 0x1 - FSOPT_NOINMEMUPDATE = 0x2 - FSOPT_PACK_INVAL_ATTRS = 0x8 - FSOPT_REPORT_FULLSIZE = 0x4 - FSOPT_RETURN_REALDEV = 0x200 - F_ADDFILESIGS = 0x3d - F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 - F_ADDFILESIGS_INFO = 0x67 - F_ADDFILESIGS_RETURN = 0x61 - F_ADDFILESUPPL = 0x68 - F_ADDSIGS = 0x3b - F_ALLOCATEALL = 0x4 - F_ALLOCATECONTIG = 0x2 - F_BARRIERFSYNC = 0x55 - F_CHECK_LV = 0x62 - F_CHKCLEAN = 0x29 - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0x43 - F_FINDSIGS = 0x4e - F_FLUSH_DATA = 0x28 - F_FREEZE_FS = 0x35 - F_FULLFSYNC = 0x33 - F_GETCODEDIR = 0x48 - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLK = 0x7 - F_GETLKPID = 0x42 - F_GETNOSIGPIPE = 0x4a - F_GETOWN = 0x5 - F_GETPATH = 0x32 - F_GETPATH_MTMINFO = 0x47 - F_GETPATH_NOFIRMLINK = 0x66 - F_GETPROTECTIONCLASS = 0x3f - F_GETPROTECTIONLEVEL = 0x4d - F_GETSIGSINFO = 0x69 - F_GLOBAL_NOCACHE = 0x37 - F_LOG2PHYS = 0x31 - F_LOG2PHYS_EXT = 0x41 - F_NOCACHE = 0x30 - F_NODIRECT = 0x3e - F_OK = 0x0 - F_PATHPKG_CHECK = 0x34 - F_PEOFPOSMODE = 0x3 - F_PREALLOCATE = 0x2a - F_PUNCHHOLE = 0x63 - F_RDADVISE = 0x2c - F_RDAHEAD = 0x2d - F_RDLCK = 0x1 - F_SETBACKINGSTORE = 0x46 - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLK = 0x8 - F_SETLKW = 0x9 - F_SETLKWTIMEOUT = 0xa - F_SETNOSIGPIPE = 0x49 - F_SETOWN = 0x6 - F_SETPROTECTIONCLASS = 0x40 - F_SETSIZE = 0x2b - F_SINGLE_WRITER = 0x4c - F_SPECULATIVE_READ = 0x65 - F_THAW_FS = 0x36 - F_TRANSCODEKEY = 0x4b - F_TRIM_ACTIVE_FILE = 0x64 - F_UNLCK = 0x2 - F_VOLPOSMODE = 0x4 - F_WRLCK = 0x3 - HUPCL = 0x4000 - HW_MACHINE = 0x1 - ICANON = 0x100 - ICMP6_FILTER = 0x12 - ICRNL = 0x100 - IEXTEN = 0x400 - IFF_ALLMULTI = 0x200 - IFF_ALTPHYS = 0x4000 - IFF_BROADCAST = 0x2 - IFF_DEBUG = 0x4 - IFF_LINK0 = 0x1000 - IFF_LINK1 = 0x2000 - IFF_LINK2 = 0x4000 - IFF_LOOPBACK = 0x8 - IFF_MULTICAST = 0x8000 - IFF_NOARP = 0x80 - IFF_NOTRAILERS = 0x20 - IFF_OACTIVE = 0x400 - IFF_POINTOPOINT = 0x10 - IFF_PROMISC = 0x100 - IFF_RUNNING = 0x40 - IFF_SIMPLEX = 0x800 - IFF_UP = 0x1 - IFNAMSIZ = 0x10 - IFT_1822 = 0x2 - IFT_6LOWPAN = 0x40 - IFT_AAL5 = 0x31 - IFT_ARCNET = 0x23 - IFT_ARCNETPLUS = 0x24 - IFT_ATM = 0x25 - IFT_BRIDGE = 0xd1 - IFT_CARP = 0xf8 - IFT_CELLULAR = 0xff - IFT_CEPT = 0x13 - IFT_DS3 = 0x1e - IFT_ENC = 0xf4 - IFT_EON = 0x19 - IFT_ETHER = 0x6 - IFT_FAITH = 0x38 - IFT_FDDI = 0xf - IFT_FRELAY = 0x20 - IFT_FRELAYDCE = 0x2c - IFT_GIF = 0x37 - IFT_HDH1822 = 0x3 - IFT_HIPPI = 0x2f - IFT_HSSI = 0x2e - IFT_HY = 0xe - IFT_IEEE1394 = 0x90 - IFT_IEEE8023ADLAG = 0x88 - IFT_ISDNBASIC = 0x14 - IFT_ISDNPRIMARY = 0x15 - IFT_ISO88022LLC = 0x29 - IFT_ISO88023 = 0x7 - IFT_ISO88024 = 0x8 - IFT_ISO88025 = 0x9 - IFT_ISO88026 = 0xa - IFT_L2VLAN = 0x87 - IFT_LAPB = 0x10 - IFT_LOCALTALK = 0x2a - IFT_LOOP = 0x18 - IFT_MIOX25 = 0x26 - IFT_MODEM = 0x30 - IFT_NSIP = 0x1b - IFT_OTHER = 0x1 - IFT_P10 = 0xc - IFT_P80 = 0xd - IFT_PARA = 0x22 - IFT_PDP = 0xff - IFT_PFLOG = 0xf5 - IFT_PFSYNC = 0xf6 - IFT_PKTAP = 0xfe - IFT_PPP = 0x17 - IFT_PROPMUX = 0x36 - IFT_PROPVIRTUAL = 0x35 - IFT_PTPSERIAL = 0x16 - IFT_RS232 = 0x21 - IFT_SDLC = 0x11 - IFT_SIP = 0x1f - IFT_SLIP = 0x1c - IFT_SMDSDXI = 0x2b - IFT_SMDSICIP = 0x34 - IFT_SONET = 0x27 - IFT_SONETPATH = 0x32 - IFT_SONETVT = 0x33 - IFT_STARLAN = 0xb - IFT_STF = 0x39 - IFT_T1 = 0x12 - IFT_ULTRA = 0x1d - IFT_V35 = 0x2d - IFT_X25 = 0x5 - IFT_X25DDN = 0x4 - IFT_X25PLE = 0x28 - IFT_XETHER = 0x1a - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLASSD_HOST = 0xfffffff - IN_CLASSD_NET = 0xf0000000 - IN_CLASSD_NSHIFT = 0x1c - IN_LINKLOCALNETNUM = 0xa9fe0000 - IN_LOOPBACKNET = 0x7f - IPPROTO_3PC = 0x22 - IPPROTO_ADFS = 0x44 - IPPROTO_AH = 0x33 - IPPROTO_AHIP = 0x3d - IPPROTO_APES = 0x63 - IPPROTO_ARGUS = 0xd - IPPROTO_AX25 = 0x5d - IPPROTO_BHA = 0x31 - IPPROTO_BLT = 0x1e - IPPROTO_BRSATMON = 0x4c - IPPROTO_CFTP = 0x3e - IPPROTO_CHAOS = 0x10 - IPPROTO_CMTP = 0x26 - IPPROTO_CPHB = 0x49 - IPPROTO_CPNX = 0x48 - IPPROTO_DDP = 0x25 - IPPROTO_DGP = 0x56 - IPPROTO_DIVERT = 0xfe - IPPROTO_DONE = 0x101 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_EMCON = 0xe - IPPROTO_ENCAP = 0x62 - IPPROTO_EON = 0x50 - IPPROTO_ESP = 0x32 - IPPROTO_ETHERIP = 0x61 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GGP = 0x3 - IPPROTO_GMTP = 0x64 - IPPROTO_GRE = 0x2f - IPPROTO_HELLO = 0x3f - IPPROTO_HMP = 0x14 - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IDPR = 0x23 - IPPROTO_IDRP = 0x2d - IPPROTO_IGMP = 0x2 - IPPROTO_IGP = 0x55 - IPPROTO_IGRP = 0x58 - IPPROTO_IL = 0x28 - IPPROTO_INLSP = 0x34 - IPPROTO_INP = 0x20 - IPPROTO_IP = 0x0 - IPPROTO_IPCOMP = 0x6c - IPPROTO_IPCV = 0x47 - IPPROTO_IPEIP = 0x5e - IPPROTO_IPIP = 0x4 - IPPROTO_IPPC = 0x43 - IPPROTO_IPV4 = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_IRTP = 0x1c - IPPROTO_KRYPTOLAN = 0x41 - IPPROTO_LARP = 0x5b - IPPROTO_LEAF1 = 0x19 - IPPROTO_LEAF2 = 0x1a - IPPROTO_MAX = 0x100 - IPPROTO_MAXID = 0x34 - IPPROTO_MEAS = 0x13 - IPPROTO_MHRP = 0x30 - IPPROTO_MICP = 0x5f - IPPROTO_MTP = 0x5c - IPPROTO_MUX = 0x12 - IPPROTO_ND = 0x4d - IPPROTO_NHRP = 0x36 - IPPROTO_NONE = 0x3b - IPPROTO_NSP = 0x1f - IPPROTO_NVPII = 0xb - IPPROTO_OSPFIGP = 0x59 - IPPROTO_PGM = 0x71 - IPPROTO_PIGP = 0x9 - IPPROTO_PIM = 0x67 - IPPROTO_PRM = 0x15 - IPPROTO_PUP = 0xc - IPPROTO_PVP = 0x4b - IPPROTO_RAW = 0xff - IPPROTO_RCCMON = 0xa - IPPROTO_RDP = 0x1b - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_RVD = 0x42 - IPPROTO_SATEXPAK = 0x40 - IPPROTO_SATMON = 0x45 - IPPROTO_SCCSP = 0x60 - IPPROTO_SCTP = 0x84 - IPPROTO_SDRP = 0x2a - IPPROTO_SEP = 0x21 - IPPROTO_SRPC = 0x5a - IPPROTO_ST = 0x7 - IPPROTO_SVMTP = 0x52 - IPPROTO_SWIPE = 0x35 - IPPROTO_TCF = 0x57 - IPPROTO_TCP = 0x6 - IPPROTO_TP = 0x1d - IPPROTO_TPXX = 0x27 - IPPROTO_TRUNK1 = 0x17 - IPPROTO_TRUNK2 = 0x18 - IPPROTO_TTP = 0x54 - IPPROTO_UDP = 0x11 - IPPROTO_VINES = 0x53 - IPPROTO_VISA = 0x46 - IPPROTO_VMTP = 0x51 - IPPROTO_WBEXPAK = 0x4f - IPPROTO_WBMON = 0x4e - IPPROTO_WSN = 0x4a - IPPROTO_XNET = 0xf - IPPROTO_XTP = 0x24 - IPV6_2292DSTOPTS = 0x17 - IPV6_2292HOPLIMIT = 0x14 - IPV6_2292HOPOPTS = 0x16 - IPV6_2292NEXTHOP = 0x15 - IPV6_2292PKTINFO = 0x13 - IPV6_2292PKTOPTIONS = 0x19 - IPV6_2292RTHDR = 0x18 - IPV6_3542DSTOPTS = 0x32 - IPV6_3542HOPLIMIT = 0x2f - IPV6_3542HOPOPTS = 0x31 - IPV6_3542NEXTHOP = 0x30 - IPV6_3542PKTINFO = 0x2e - IPV6_3542RTHDR = 0x33 - IPV6_ADDR_MC_FLAGS_PREFIX = 0x20 - IPV6_ADDR_MC_FLAGS_TRANSIENT = 0x10 - IPV6_ADDR_MC_FLAGS_UNICAST_BASED = 0x30 - IPV6_AUTOFLOWLABEL = 0x3b - IPV6_BINDV6ONLY = 0x1b - IPV6_BOUND_IF = 0x7d - IPV6_CHECKSUM = 0x1a - IPV6_DEFAULT_MULTICAST_HOPS = 0x1 - IPV6_DEFAULT_MULTICAST_LOOP = 0x1 - IPV6_DEFHLIM = 0x40 - IPV6_DONTFRAG = 0x3e - IPV6_DSTOPTS = 0x32 - IPV6_FAITH = 0x1d - IPV6_FLOWINFO_MASK = 0xffffff0f - IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FLOW_ECN_MASK = 0x3000 - IPV6_FRAGTTL = 0x3c - IPV6_FW_ADD = 0x1e - IPV6_FW_DEL = 0x1f - IPV6_FW_FLUSH = 0x20 - IPV6_FW_GET = 0x22 - IPV6_FW_ZERO = 0x21 - IPV6_HLIMDEC = 0x1 - IPV6_HOPLIMIT = 0x2f - IPV6_HOPOPTS = 0x31 - IPV6_IPSEC_POLICY = 0x1c - IPV6_JOIN_GROUP = 0xc - IPV6_LEAVE_GROUP = 0xd - IPV6_MAXHLIM = 0xff - IPV6_MAXOPTHDR = 0x800 - IPV6_MAXPACKET = 0xffff - IPV6_MAX_GROUP_SRC_FILTER = 0x200 - IPV6_MAX_MEMBERSHIPS = 0xfff - IPV6_MAX_SOCK_SRC_FILTER = 0x80 - IPV6_MIN_MEMBERSHIPS = 0x1f - IPV6_MMTU = 0x500 - IPV6_MSFILTER = 0x4a - IPV6_MULTICAST_HOPS = 0xa - IPV6_MULTICAST_IF = 0x9 - IPV6_MULTICAST_LOOP = 0xb - IPV6_NEXTHOP = 0x30 - IPV6_PATHMTU = 0x2c - IPV6_PKTINFO = 0x2e - IPV6_PORTRANGE = 0xe - IPV6_PORTRANGE_DEFAULT = 0x0 - IPV6_PORTRANGE_HIGH = 0x1 - IPV6_PORTRANGE_LOW = 0x2 - IPV6_PREFER_TEMPADDR = 0x3f - IPV6_RECVDSTOPTS = 0x28 - IPV6_RECVHOPLIMIT = 0x25 - IPV6_RECVHOPOPTS = 0x27 - IPV6_RECVPATHMTU = 0x2b - IPV6_RECVPKTINFO = 0x3d - IPV6_RECVRTHDR = 0x26 - IPV6_RECVTCLASS = 0x23 - IPV6_RTHDR = 0x33 - IPV6_RTHDRDSTOPTS = 0x39 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_SOCKOPT_RESERVED1 = 0x3 - IPV6_TCLASS = 0x24 - IPV6_UNICAST_HOPS = 0x4 - IPV6_USE_MIN_MTU = 0x2a - IPV6_V6ONLY = 0x1b - IPV6_VERSION = 0x60 - IPV6_VERSION_MASK = 0xf0 - IP_ADD_MEMBERSHIP = 0xc - IP_ADD_SOURCE_MEMBERSHIP = 0x46 - IP_BLOCK_SOURCE = 0x48 - IP_BOUND_IF = 0x19 - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DONTFRAG = 0x1c - IP_DROP_MEMBERSHIP = 0xd - IP_DROP_SOURCE_MEMBERSHIP = 0x47 - IP_DUMMYNET_CONFIGURE = 0x3c - IP_DUMMYNET_DEL = 0x3d - IP_DUMMYNET_FLUSH = 0x3e - IP_DUMMYNET_GET = 0x40 - IP_FAITH = 0x16 - IP_FW_ADD = 0x28 - IP_FW_DEL = 0x29 - IP_FW_FLUSH = 0x2a - IP_FW_GET = 0x2c - IP_FW_RESETLOG = 0x2d - IP_FW_ZERO = 0x2b - IP_HDRINCL = 0x2 - IP_IPSEC_POLICY = 0x15 - IP_MAXPACKET = 0xffff - IP_MAX_GROUP_SRC_FILTER = 0x200 - IP_MAX_MEMBERSHIPS = 0xfff - IP_MAX_SOCK_MUTE_FILTER = 0x80 - IP_MAX_SOCK_SRC_FILTER = 0x80 - IP_MF = 0x2000 - IP_MIN_MEMBERSHIPS = 0x1f - IP_MSFILTER = 0x4a - IP_MSS = 0x240 - IP_MULTICAST_IF = 0x9 - IP_MULTICAST_IFINDEX = 0x42 - IP_MULTICAST_LOOP = 0xb - IP_MULTICAST_TTL = 0xa - IP_MULTICAST_VIF = 0xe - IP_NAT__XXX = 0x37 - IP_OFFMASK = 0x1fff - IP_OLD_FW_ADD = 0x32 - IP_OLD_FW_DEL = 0x33 - IP_OLD_FW_FLUSH = 0x34 - IP_OLD_FW_GET = 0x36 - IP_OLD_FW_RESETLOG = 0x38 - IP_OLD_FW_ZERO = 0x35 - IP_OPTIONS = 0x1 - IP_PKTINFO = 0x1a - IP_PORTRANGE = 0x13 - IP_PORTRANGE_DEFAULT = 0x0 - IP_PORTRANGE_HIGH = 0x1 - IP_PORTRANGE_LOW = 0x2 - IP_RECVDSTADDR = 0x7 - IP_RECVIF = 0x14 - IP_RECVOPTS = 0x5 - IP_RECVPKTINFO = 0x1a - IP_RECVRETOPTS = 0x6 - IP_RECVTOS = 0x1b - IP_RECVTTL = 0x18 - IP_RETOPTS = 0x8 - IP_RF = 0x8000 - IP_RSVP_OFF = 0x10 - IP_RSVP_ON = 0xf - IP_RSVP_VIF_OFF = 0x12 - IP_RSVP_VIF_ON = 0x11 - IP_STRIPHDR = 0x17 - IP_TOS = 0x3 - IP_TRAFFIC_MGT_BACKGROUND = 0x41 - IP_TTL = 0x4 - IP_UNBLOCK_SOURCE = 0x49 - ISIG = 0x80 - ISTRIP = 0x20 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x400 - IXON = 0x200 - KERN_HOSTNAME = 0xa - KERN_OSRELEASE = 0x2 - KERN_OSTYPE = 0x1 - KERN_VERSION = 0x4 - LOCAL_PEERCRED = 0x1 - LOCAL_PEEREPID = 0x3 - LOCAL_PEEREUUID = 0x5 - LOCAL_PEERPID = 0x2 - LOCAL_PEERTOKEN = 0x6 - LOCAL_PEERUUID = 0x4 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_CAN_REUSE = 0x9 - MADV_DONTNEED = 0x4 - MADV_FREE = 0x5 - MADV_FREE_REUSABLE = 0x7 - MADV_FREE_REUSE = 0x8 - MADV_NORMAL = 0x0 - MADV_PAGEOUT = 0xa - MADV_RANDOM = 0x1 - MADV_SEQUENTIAL = 0x2 - MADV_WILLNEED = 0x3 - MADV_ZERO_WIRED_PAGES = 0x6 - MAP_32BIT = 0x8000 - MAP_ANON = 0x1000 - MAP_ANONYMOUS = 0x1000 - MAP_COPY = 0x2 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_HASSEMAPHORE = 0x200 - MAP_JIT = 0x800 - MAP_NOCACHE = 0x400 - MAP_NOEXTEND = 0x100 - MAP_NORESERVE = 0x40 - MAP_PRIVATE = 0x2 - MAP_RENAME = 0x20 - MAP_RESERVED0080 = 0x80 - MAP_RESILIENT_CODESIGN = 0x2000 - MAP_RESILIENT_MEDIA = 0x4000 - MAP_SHARED = 0x1 - MAP_TRANSLATED_ALLOW_EXECUTE = 0x20000 - MAP_UNIX03 = 0x40000 - MCAST_BLOCK_SOURCE = 0x54 - MCAST_EXCLUDE = 0x2 - MCAST_INCLUDE = 0x1 - MCAST_JOIN_GROUP = 0x50 - MCAST_JOIN_SOURCE_GROUP = 0x52 - MCAST_LEAVE_GROUP = 0x51 - MCAST_LEAVE_SOURCE_GROUP = 0x53 - MCAST_UNBLOCK_SOURCE = 0x55 - MCAST_UNDEFINED = 0x0 - MCL_CURRENT = 0x1 - MCL_FUTURE = 0x2 - MNT_ASYNC = 0x40 - MNT_AUTOMOUNTED = 0x400000 - MNT_CMDFLAGS = 0xf0000 - MNT_CPROTECT = 0x80 - MNT_DEFWRITE = 0x2000000 - MNT_DONTBROWSE = 0x100000 - MNT_DOVOLFS = 0x8000 - MNT_DWAIT = 0x4 - MNT_EXPORTED = 0x100 - MNT_EXT_ROOT_DATA_VOL = 0x1 - MNT_FORCE = 0x80000 - MNT_IGNORE_OWNERSHIP = 0x200000 - MNT_JOURNALED = 0x800000 - MNT_LOCAL = 0x1000 - MNT_MULTILABEL = 0x4000000 - MNT_NOATIME = 0x10000000 - MNT_NOBLOCK = 0x20000 - MNT_NODEV = 0x10 - MNT_NOEXEC = 0x4 - MNT_NOSUID = 0x8 - MNT_NOUSERXATTR = 0x1000000 - MNT_NOWAIT = 0x2 - MNT_QUARANTINE = 0x400 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELOAD = 0x40000 - MNT_REMOVABLE = 0x200 - MNT_ROOTFS = 0x4000 - MNT_SNAPSHOT = 0x40000000 - MNT_STRICTATIME = 0x80000000 - MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UNKNOWNPERMISSIONS = 0x200000 - MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0xd7f0f7ff - MNT_WAIT = 0x1 - MSG_CTRUNC = 0x20 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x80 - MSG_EOF = 0x100 - MSG_EOR = 0x8 - MSG_FLUSH = 0x400 - MSG_HAVEMORE = 0x2000 - MSG_HOLD = 0x800 - MSG_NEEDSA = 0x10000 - MSG_NOSIGNAL = 0x80000 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_RCVMORE = 0x4000 - MSG_SEND = 0x1000 - MSG_TRUNC = 0x10 - MSG_WAITALL = 0x40 - MSG_WAITSTREAM = 0x200 - MS_ASYNC = 0x1 - MS_DEACTIVATE = 0x8 - MS_INVALIDATE = 0x2 - MS_KILLPAGES = 0x4 - MS_SYNC = 0x10 - NAME_MAX = 0xff - NET_RT_DUMP = 0x1 - NET_RT_DUMP2 = 0x7 - NET_RT_FLAGS = 0x2 - NET_RT_FLAGS_PRIV = 0xa - NET_RT_IFLIST = 0x3 - NET_RT_IFLIST2 = 0x6 - NET_RT_MAXID = 0xb - NET_RT_STAT = 0x4 - NET_RT_TRASH = 0x5 - NFDBITS = 0x20 - NL0 = 0x0 - NL1 = 0x100 - NL2 = 0x200 - NL3 = 0x300 - NLDLY = 0x300 - NOFLSH = 0x80000000 - NOKERNINFO = 0x2000000 - NOTE_ABSOLUTE = 0x8 - NOTE_ATTRIB = 0x8 - NOTE_BACKGROUND = 0x40 - NOTE_CHILD = 0x4 - NOTE_CRITICAL = 0x20 - NOTE_DELETE = 0x1 - NOTE_EXEC = 0x20000000 - NOTE_EXIT = 0x80000000 - NOTE_EXITSTATUS = 0x4000000 - NOTE_EXIT_CSERROR = 0x40000 - NOTE_EXIT_DECRYPTFAIL = 0x10000 - NOTE_EXIT_DETAIL = 0x2000000 - NOTE_EXIT_DETAIL_MASK = 0x70000 - NOTE_EXIT_MEMORY = 0x20000 - NOTE_EXIT_REPARENTED = 0x80000 - NOTE_EXTEND = 0x4 - NOTE_FFAND = 0x40000000 - NOTE_FFCOPY = 0xc0000000 - NOTE_FFCTRLMASK = 0xc0000000 - NOTE_FFLAGSMASK = 0xffffff - NOTE_FFNOP = 0x0 - NOTE_FFOR = 0x80000000 - NOTE_FORK = 0x40000000 - NOTE_FUNLOCK = 0x100 - NOTE_LEEWAY = 0x10 - NOTE_LINK = 0x10 - NOTE_LOWAT = 0x1 - NOTE_MACHTIME = 0x100 - NOTE_MACH_CONTINUOUS_TIME = 0x80 - NOTE_NONE = 0x80 - NOTE_NSECONDS = 0x4 - NOTE_OOB = 0x2 - NOTE_PCTRLMASK = -0x100000 - NOTE_PDATAMASK = 0xfffff - NOTE_REAP = 0x10000000 - NOTE_RENAME = 0x20 - NOTE_REVOKE = 0x40 - NOTE_SECONDS = 0x1 - NOTE_SIGNAL = 0x8000000 - NOTE_TRACK = 0x1 - NOTE_TRACKERR = 0x2 - NOTE_TRIGGER = 0x1000000 - NOTE_USECONDS = 0x2 - NOTE_VM_ERROR = 0x10000000 - NOTE_VM_PRESSURE = 0x80000000 - NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 - NOTE_VM_PRESSURE_TERMINATE = 0x40000000 - NOTE_WRITE = 0x2 - OCRNL = 0x10 - OFDEL = 0x20000 - OFILL = 0x80 - ONLCR = 0x2 - ONLRET = 0x40 - ONOCR = 0x20 - ONOEOT = 0x8 - OPOST = 0x1 - OXTABS = 0x4 - O_ACCMODE = 0x3 - O_ALERT = 0x20000000 - O_APPEND = 0x8 - O_ASYNC = 0x40 - O_CLOEXEC = 0x1000000 - O_CREAT = 0x200 - O_DIRECTORY = 0x100000 - O_DP_GETRAWENCRYPTED = 0x1 - O_DP_GETRAWUNENCRYPTED = 0x2 - O_DSYNC = 0x400000 - O_EVTONLY = 0x8000 - O_EXCL = 0x800 - O_EXLOCK = 0x20 - O_FSYNC = 0x80 - O_NDELAY = 0x4 - O_NOCTTY = 0x20000 - O_NOFOLLOW = 0x100 - O_NOFOLLOW_ANY = 0x20000000 - O_NONBLOCK = 0x4 - O_POPUP = 0x80000000 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_SHLOCK = 0x10 - O_SYMLINK = 0x200000 - O_SYNC = 0x80 - O_TRUNC = 0x400 - O_WRONLY = 0x1 - PARENB = 0x1000 - PARMRK = 0x8 - PARODD = 0x2000 - PENDIN = 0x20000000 - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PROT_EXEC = 0x4 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_WRITE = 0x2 - PT_ATTACH = 0xa - PT_ATTACHEXC = 0xe - PT_CONTINUE = 0x7 - PT_DENY_ATTACH = 0x1f - PT_DETACH = 0xb - PT_FIRSTMACH = 0x20 - PT_FORCEQUOTA = 0x1e - PT_KILL = 0x8 - PT_READ_D = 0x2 - PT_READ_I = 0x1 - PT_READ_U = 0x3 - PT_SIGEXC = 0xc - PT_STEP = 0x9 - PT_THUPDATE = 0xd - PT_TRACE_ME = 0x0 - PT_WRITE_D = 0x5 - PT_WRITE_I = 0x4 - PT_WRITE_U = 0x6 - RLIMIT_AS = 0x5 - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_CPU_USAGE_MONITOR = 0x2 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_MEMLOCK = 0x6 - RLIMIT_NOFILE = 0x8 - RLIMIT_NPROC = 0x7 - RLIMIT_RSS = 0x5 - RLIMIT_STACK = 0x3 - RLIM_INFINITY = 0x7fffffffffffffff - RTAX_AUTHOR = 0x6 - RTAX_BRD = 0x7 - RTAX_DST = 0x0 - RTAX_GATEWAY = 0x1 - RTAX_GENMASK = 0x3 - RTAX_IFA = 0x5 - RTAX_IFP = 0x4 - RTAX_MAX = 0x8 - RTAX_NETMASK = 0x2 - RTA_AUTHOR = 0x40 - RTA_BRD = 0x80 - RTA_DST = 0x1 - RTA_GATEWAY = 0x2 - RTA_GENMASK = 0x8 - RTA_IFA = 0x20 - RTA_IFP = 0x10 - RTA_NETMASK = 0x4 - RTF_BLACKHOLE = 0x1000 - RTF_BROADCAST = 0x400000 - RTF_CLONING = 0x100 - RTF_CONDEMNED = 0x2000000 - RTF_DEAD = 0x20000000 - RTF_DELCLONE = 0x80 - RTF_DONE = 0x40 - RTF_DYNAMIC = 0x10 - RTF_GATEWAY = 0x2 - RTF_HOST = 0x4 - RTF_IFREF = 0x4000000 - RTF_IFSCOPE = 0x1000000 - RTF_LLDATA = 0x400 - RTF_LLINFO = 0x400 - RTF_LOCAL = 0x200000 - RTF_MODIFIED = 0x20 - RTF_MULTICAST = 0x800000 - RTF_NOIFREF = 0x2000 - RTF_PINNED = 0x100000 - RTF_PRCLONING = 0x10000 - RTF_PROTO1 = 0x8000 - RTF_PROTO2 = 0x4000 - RTF_PROTO3 = 0x40000 - RTF_PROXY = 0x8000000 - RTF_REJECT = 0x8 - RTF_ROUTER = 0x10000000 - RTF_STATIC = 0x800 - RTF_UP = 0x1 - RTF_WASCLONED = 0x20000 - RTF_XRESOLVE = 0x200 - RTM_ADD = 0x1 - RTM_CHANGE = 0x3 - RTM_DELADDR = 0xd - RTM_DELETE = 0x2 - RTM_DELMADDR = 0x10 - RTM_GET = 0x4 - RTM_GET2 = 0x14 - RTM_IFINFO = 0xe - RTM_IFINFO2 = 0x12 - RTM_LOCK = 0x8 - RTM_LOSING = 0x5 - RTM_MISS = 0x7 - RTM_NEWADDR = 0xc - RTM_NEWMADDR = 0xf - RTM_NEWMADDR2 = 0x13 - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa - RTM_REDIRECT = 0x6 - RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 - RTM_VERSION = 0x5 - RTV_EXPIRE = 0x4 - RTV_HOPCOUNT = 0x2 - RTV_MTU = 0x1 - RTV_RPIPE = 0x8 - RTV_RTT = 0x40 - RTV_RTTVAR = 0x80 - RTV_SPIPE = 0x10 - RTV_SSTHRESH = 0x20 - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - SCM_CREDS = 0x3 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x2 - SCM_TIMESTAMP_MONOTONIC = 0x4 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDMULTI = 0x80206931 - SIOCAIFADDR = 0x8040691a - SIOCARPIPLL = 0xc0206928 - SIOCATMARK = 0x40047307 - SIOCAUTOADDR = 0xc0206926 - SIOCAUTONETMASK = 0x80206927 - SIOCDELMULTI = 0x80206932 - SIOCDIFADDR = 0x80206919 - SIOCDIFPHYADDR = 0x80206941 - SIOCGDRVSPEC = 0xc028697b - SIOCGETVLAN = 0xc020697f - SIOCGHIWAT = 0x40047301 - SIOCGIF6LOWPAN = 0xc02069c5 - SIOCGIFADDR = 0xc0206921 - SIOCGIFALTMTU = 0xc0206948 - SIOCGIFASYNCMAP = 0xc020697c - SIOCGIFBOND = 0xc0206947 - SIOCGIFBRDADDR = 0xc0206923 - SIOCGIFCAP = 0xc020695b - SIOCGIFCONF = 0xc00c6924 - SIOCGIFDEVMTU = 0xc0206944 - SIOCGIFDSTADDR = 0xc0206922 - SIOCGIFFLAGS = 0xc0206911 - SIOCGIFFUNCTIONALTYPE = 0xc02069ad - SIOCGIFGENERIC = 0xc020693a - SIOCGIFKPI = 0xc0206987 - SIOCGIFMAC = 0xc0206982 - SIOCGIFMEDIA = 0xc02c6938 - SIOCGIFMETRIC = 0xc0206917 - SIOCGIFMTU = 0xc0206933 - SIOCGIFNETMASK = 0xc0206925 - SIOCGIFPDSTADDR = 0xc0206940 - SIOCGIFPHYS = 0xc0206935 - SIOCGIFPSRCADDR = 0xc020693f - SIOCGIFSTATUS = 0xc331693d - SIOCGIFVLAN = 0xc020697f - SIOCGIFWAKEFLAGS = 0xc0206988 - SIOCGIFXMEDIA = 0xc02c6948 - SIOCGLOWAT = 0x40047303 - SIOCGPGRP = 0x40047309 - SIOCIFCREATE = 0xc0206978 - SIOCIFCREATE2 = 0xc020697a - SIOCIFDESTROY = 0x80206979 - SIOCIFGCLONERS = 0xc0106981 - SIOCRSLVMULTI = 0xc010693b - SIOCSDRVSPEC = 0x8028697b - SIOCSETVLAN = 0x8020697e - SIOCSHIWAT = 0x80047300 - SIOCSIF6LOWPAN = 0x802069c4 - SIOCSIFADDR = 0x8020690c - SIOCSIFALTMTU = 0x80206945 - SIOCSIFASYNCMAP = 0x8020697d - SIOCSIFBOND = 0x80206946 - SIOCSIFBRDADDR = 0x80206913 - SIOCSIFCAP = 0x8020695a - SIOCSIFDSTADDR = 0x8020690e - SIOCSIFFLAGS = 0x80206910 - SIOCSIFGENERIC = 0x80206939 - SIOCSIFKPI = 0x80206986 - SIOCSIFLLADDR = 0x8020693c - SIOCSIFMAC = 0x80206983 - SIOCSIFMEDIA = 0xc0206937 - SIOCSIFMETRIC = 0x80206918 - SIOCSIFMTU = 0x80206934 - SIOCSIFNETMASK = 0x80206916 - SIOCSIFPHYADDR = 0x8040693e - SIOCSIFPHYS = 0x80206936 - SIOCSIFVLAN = 0x8020697e - SIOCSLOWAT = 0x80047302 - SIOCSPGRP = 0x80047308 - SOCK_DGRAM = 0x2 - SOCK_MAXADDRLEN = 0xff - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_LOCAL = 0x0 - SOL_SOCKET = 0xffff - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x2 - SO_BROADCAST = 0x20 - SO_DEBUG = 0x1 - SO_DONTROUTE = 0x10 - SO_DONTTRUNC = 0x2000 - SO_ERROR = 0x1007 - SO_KEEPALIVE = 0x8 - SO_LABEL = 0x1010 - SO_LINGER = 0x80 - SO_LINGER_SEC = 0x1080 - SO_NETSVC_MARKING_LEVEL = 0x1119 - SO_NET_SERVICE_TYPE = 0x1116 - SO_NKE = 0x1021 - SO_NOADDRERR = 0x1023 - SO_NOSIGPIPE = 0x1022 - SO_NOTIFYCONFLICT = 0x1026 - SO_NP_EXTENSIONS = 0x1083 - SO_NREAD = 0x1020 - SO_NUMRCVPKT = 0x1112 - SO_NWRITE = 0x1024 - SO_OOBINLINE = 0x100 - SO_PEERLABEL = 0x1011 - SO_RANDOMPORT = 0x1082 - SO_RCVBUF = 0x1002 - SO_RCVLOWAT = 0x1004 - SO_RCVTIMEO = 0x1006 - SO_REUSEADDR = 0x4 - SO_REUSEPORT = 0x200 - SO_REUSESHAREUID = 0x1025 - SO_SNDBUF = 0x1001 - SO_SNDLOWAT = 0x1003 - SO_SNDTIMEO = 0x1005 - SO_TIMESTAMP = 0x400 - SO_TIMESTAMP_MONOTONIC = 0x800 - SO_TYPE = 0x1008 - SO_UPCALLCLOSEWAIT = 0x1027 - SO_USELOOPBACK = 0x40 - SO_WANTMORE = 0x4000 - SO_WANTOOBFLAG = 0x8000 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IFWHT = 0xe000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISTXT = 0x200 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - TAB0 = 0x0 - TAB1 = 0x400 - TAB2 = 0x800 - TAB3 = 0x4 - TABDLY = 0xc04 - TCIFLUSH = 0x1 - TCIOFF = 0x3 - TCIOFLUSH = 0x3 - TCION = 0x4 - TCOFLUSH = 0x2 - TCOOFF = 0x1 - TCOON = 0x2 - TCP_CONNECTIONTIMEOUT = 0x20 - TCP_CONNECTION_INFO = 0x106 - TCP_ENABLE_ECN = 0x104 - TCP_FASTOPEN = 0x105 - TCP_KEEPALIVE = 0x10 - TCP_KEEPCNT = 0x102 - TCP_KEEPINTVL = 0x101 - TCP_MAXHLEN = 0x3c - TCP_MAXOLEN = 0x28 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_SACK = 0x4 - TCP_MAX_WINSHIFT = 0xe - TCP_MINMSS = 0xd8 - TCP_MSS = 0x200 - TCP_NODELAY = 0x1 - TCP_NOOPT = 0x8 - TCP_NOPUSH = 0x4 - TCP_NOTSENT_LOWAT = 0x201 - TCP_RXT_CONNDROPTIME = 0x80 - TCP_RXT_FINDROP = 0x100 - TCP_SENDMOREACKS = 0x103 - TCSAFLUSH = 0x2 - TIOCCBRK = 0x2000747a - TIOCCDTR = 0x20007478 - TIOCCONS = 0x80047462 - TIOCDCDTIMESTAMP = 0x40107458 - TIOCDRAIN = 0x2000745e - TIOCDSIMICROCODE = 0x20007455 - TIOCEXCL = 0x2000740d - TIOCEXT = 0x80047460 - TIOCFLUSH = 0x80047410 - TIOCGDRAINWAIT = 0x40047456 - TIOCGETA = 0x40487413 - TIOCGETD = 0x4004741a - TIOCGPGRP = 0x40047477 - TIOCGWINSZ = 0x40087468 - TIOCIXOFF = 0x20007480 - TIOCIXON = 0x20007481 - TIOCMBIC = 0x8004746b - TIOCMBIS = 0x8004746c - TIOCMGDTRWAIT = 0x4004745a - TIOCMGET = 0x4004746a - TIOCMODG = 0x40047403 - TIOCMODS = 0x80047404 - TIOCMSDTRWAIT = 0x8004745b - TIOCMSET = 0x8004746d - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x20007471 - TIOCNXCL = 0x2000740e - TIOCOUTQ = 0x40047473 - TIOCPKT = 0x80047470 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCPTYGNAME = 0x40807453 - TIOCPTYGRANT = 0x20007454 - TIOCPTYUNLK = 0x20007452 - TIOCREMOTE = 0x80047469 - TIOCSBRK = 0x2000747b - TIOCSCONS = 0x20007463 - TIOCSCTTY = 0x20007461 - TIOCSDRAINWAIT = 0x80047457 - TIOCSDTR = 0x20007479 - TIOCSETA = 0x80487414 - TIOCSETAF = 0x80487416 - TIOCSETAW = 0x80487415 - TIOCSETD = 0x8004741b - TIOCSIG = 0x2000745f - TIOCSPGRP = 0x80047476 - TIOCSTART = 0x2000746e - TIOCSTAT = 0x20007465 - TIOCSTI = 0x80017472 - TIOCSTOP = 0x2000746f - TIOCSWINSZ = 0x80087467 - TIOCTIMESTAMP = 0x40107459 - TIOCUCNTL = 0x80047466 - TOSTOP = 0x400000 - VDISCARD = 0xf - VDSUSP = 0xb - VEOF = 0x0 - VEOL = 0x1 - VEOL2 = 0x2 - VERASE = 0x3 - VINTR = 0x8 - VKILL = 0x5 - VLNEXT = 0xe - VMIN = 0x10 - VM_LOADAVG = 0x2 - VM_MACHFACTOR = 0x4 - VM_MAXID = 0x6 - VM_METER = 0x1 - VM_SWAPUSAGE = 0x5 - VQUIT = 0x9 - VREPRINT = 0x6 - VSTART = 0xc - VSTATUS = 0x12 - VSTOP = 0xd - VSUSP = 0xa - VT0 = 0x0 - VT1 = 0x10000 - VTDLY = 0x10000 - VTIME = 0x11 - VWERASE = 0x4 - WCONTINUED = 0x10 - WCOREFLAG = 0x80 - WEXITED = 0x4 - WNOHANG = 0x1 - WNOWAIT = 0x20 - WORDSIZE = 0x40 - WSTOPPED = 0x8 - WUNTRACED = 0x2 - XATTR_CREATE = 0x2 - XATTR_NODEFAULT = 0x10 - XATTR_NOFOLLOW = 0x1 - XATTR_NOSECURITY = 0x8 - XATTR_REPLACE = 0x4 - XATTR_SHOWCOMPRESSION = 0x20 + AF_APPLETALK = 0x10 + AF_CCITT = 0xa + AF_CHAOS = 0x5 + AF_CNT = 0x15 + AF_COIP = 0x14 + AF_DATAKIT = 0x9 + AF_DECnet = 0xc + AF_DLI = 0xd + AF_E164 = 0x1c + AF_ECMA = 0x8 + AF_HYLINK = 0xf + AF_IEEE80211 = 0x25 + AF_IMPLINK = 0x3 + AF_INET = 0x2 + AF_INET6 = 0x1e + AF_IPX = 0x17 + AF_ISDN = 0x1c + AF_ISO = 0x7 + AF_LAT = 0xe + AF_LINK = 0x12 + AF_LOCAL = 0x1 + AF_MAX = 0x29 + AF_NATM = 0x1f + AF_NDRV = 0x1b + AF_NETBIOS = 0x21 + AF_NS = 0x6 + AF_OSI = 0x7 + AF_PPP = 0x22 + AF_PUP = 0x4 + AF_RESERVED_36 = 0x24 + AF_ROUTE = 0x11 + AF_SIP = 0x18 + AF_SNA = 0xb + AF_SYSTEM = 0x20 + AF_SYS_CONTROL = 0x2 + AF_UNIX = 0x1 + AF_UNSPEC = 0x0 + AF_UTUN = 0x26 + AF_VSOCK = 0x28 + ALTWERASE = 0x200 + ATTR_BIT_MAP_COUNT = 0x5 + ATTR_CMN_ACCESSMASK = 0x20000 + ATTR_CMN_ACCTIME = 0x1000 + ATTR_CMN_ADDEDTIME = 0x10000000 + ATTR_CMN_BKUPTIME = 0x2000 + ATTR_CMN_CHGTIME = 0x800 + ATTR_CMN_CRTIME = 0x200 + ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 + ATTR_CMN_DEVID = 0x2 + ATTR_CMN_DOCUMENT_ID = 0x100000 + ATTR_CMN_ERROR = 0x20000000 + ATTR_CMN_EXTENDED_SECURITY = 0x400000 + ATTR_CMN_FILEID = 0x2000000 + ATTR_CMN_FLAGS = 0x40000 + ATTR_CMN_FNDRINFO = 0x4000 + ATTR_CMN_FSID = 0x4 + ATTR_CMN_FULLPATH = 0x8000000 + ATTR_CMN_GEN_COUNT = 0x80000 + ATTR_CMN_GRPID = 0x10000 + ATTR_CMN_GRPUUID = 0x1000000 + ATTR_CMN_MODTIME = 0x400 + ATTR_CMN_NAME = 0x1 + ATTR_CMN_NAMEDATTRCOUNT = 0x80000 + ATTR_CMN_NAMEDATTRLIST = 0x100000 + ATTR_CMN_OBJID = 0x20 + ATTR_CMN_OBJPERMANENTID = 0x40 + ATTR_CMN_OBJTAG = 0x10 + ATTR_CMN_OBJTYPE = 0x8 + ATTR_CMN_OWNERID = 0x8000 + ATTR_CMN_PARENTID = 0x4000000 + ATTR_CMN_PAROBJID = 0x80 + ATTR_CMN_RETURNED_ATTRS = 0x80000000 + ATTR_CMN_SCRIPT = 0x100 + ATTR_CMN_SETMASK = 0x51c7ff00 + ATTR_CMN_USERACCESS = 0x200000 + ATTR_CMN_UUID = 0x800000 + ATTR_CMN_VALIDMASK = 0xffffffff + ATTR_CMN_VOLSETMASK = 0x6700 + ATTR_FILE_ALLOCSIZE = 0x4 + ATTR_FILE_CLUMPSIZE = 0x10 + ATTR_FILE_DATAALLOCSIZE = 0x400 + ATTR_FILE_DATAEXTENTS = 0x800 + ATTR_FILE_DATALENGTH = 0x200 + ATTR_FILE_DEVTYPE = 0x20 + ATTR_FILE_FILETYPE = 0x40 + ATTR_FILE_FORKCOUNT = 0x80 + ATTR_FILE_FORKLIST = 0x100 + ATTR_FILE_IOBLOCKSIZE = 0x8 + ATTR_FILE_LINKCOUNT = 0x1 + ATTR_FILE_RSRCALLOCSIZE = 0x2000 + ATTR_FILE_RSRCEXTENTS = 0x4000 + ATTR_FILE_RSRCLENGTH = 0x1000 + ATTR_FILE_SETMASK = 0x20 + ATTR_FILE_TOTALSIZE = 0x2 + ATTR_FILE_VALIDMASK = 0x37ff + ATTR_VOL_ALLOCATIONCLUMP = 0x40 + ATTR_VOL_ATTRIBUTES = 0x40000000 + ATTR_VOL_CAPABILITIES = 0x20000 + ATTR_VOL_DIRCOUNT = 0x400 + ATTR_VOL_ENCODINGSUSED = 0x10000 + ATTR_VOL_FILECOUNT = 0x200 + ATTR_VOL_FSTYPE = 0x1 + ATTR_VOL_INFO = 0x80000000 + ATTR_VOL_IOBLOCKSIZE = 0x80 + ATTR_VOL_MAXOBJCOUNT = 0x800 + ATTR_VOL_MINALLOCATION = 0x20 + ATTR_VOL_MOUNTEDDEVICE = 0x8000 + ATTR_VOL_MOUNTFLAGS = 0x4000 + ATTR_VOL_MOUNTPOINT = 0x1000 + ATTR_VOL_NAME = 0x2000 + ATTR_VOL_OBJCOUNT = 0x100 + ATTR_VOL_QUOTA_SIZE = 0x10000000 + ATTR_VOL_RESERVED_SIZE = 0x20000000 + ATTR_VOL_SETMASK = 0x80002000 + ATTR_VOL_SIGNATURE = 0x2 + ATTR_VOL_SIZE = 0x4 + ATTR_VOL_SPACEAVAIL = 0x10 + ATTR_VOL_SPACEFREE = 0x8 + ATTR_VOL_SPACEUSED = 0x800000 + ATTR_VOL_UUID = 0x40000 + ATTR_VOL_VALIDMASK = 0xf087ffff + B0 = 0x0 + B110 = 0x6e + B115200 = 0x1c200 + B1200 = 0x4b0 + B134 = 0x86 + B14400 = 0x3840 + B150 = 0x96 + B1800 = 0x708 + B19200 = 0x4b00 + B200 = 0xc8 + B230400 = 0x38400 + B2400 = 0x960 + B28800 = 0x7080 + B300 = 0x12c + B38400 = 0x9600 + B4800 = 0x12c0 + B50 = 0x32 + B57600 = 0xe100 + B600 = 0x258 + B7200 = 0x1c20 + B75 = 0x4b + B76800 = 0x12c00 + B9600 = 0x2580 + BIOCFLUSH = 0x20004268 + BIOCGBLEN = 0x40044266 + BIOCGDLT = 0x4004426a + BIOCGDLTLIST = 0xc00c4279 + BIOCGETIF = 0x4020426b + BIOCGHDRCMPLT = 0x40044274 + BIOCGRSIG = 0x40044272 + BIOCGRTIMEOUT = 0x4010426e + BIOCGSEESENT = 0x40044276 + BIOCGSTATS = 0x4008426f + BIOCIMMEDIATE = 0x80044270 + BIOCPROMISC = 0x20004269 + BIOCSBLEN = 0xc0044266 + BIOCSDLT = 0x80044278 + BIOCSETF = 0x80104267 + BIOCSETFNR = 0x8010427e + BIOCSETIF = 0x8020426c + BIOCSHDRCMPLT = 0x80044275 + BIOCSRSIG = 0x80044273 + BIOCSRTIMEOUT = 0x8010426d + BIOCSSEESENT = 0x80044277 + BIOCVERSION = 0x40044271 + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0x0 + BPF_ALIGNMENT = 0x4 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DIV = 0x30 + BPF_H = 0x8 + BPF_IMM = 0x0 + BPF_IND = 0x40 + BPF_JA = 0x0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0x0 + BPF_LD = 0x0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXBUFSIZE = 0x80000 + BPF_MAXINSNS = 0x200 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINBUFSIZE = 0x20 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RELEASE = 0x30bb6 + BPF_RET = 0x6 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0x0 + BPF_TXA = 0x80 + BPF_W = 0x0 + BPF_X = 0x8 + BRKINT = 0x2 + BS0 = 0x0 + BS1 = 0x8000 + BSDLY = 0x8000 + CFLUSH = 0xf + CLOCAL = 0x8000 + CLOCK_MONOTONIC = 0x6 + CLOCK_MONOTONIC_RAW = 0x4 + CLOCK_MONOTONIC_RAW_APPROX = 0x5 + CLOCK_PROCESS_CPUTIME_ID = 0xc + CLOCK_REALTIME = 0x0 + CLOCK_THREAD_CPUTIME_ID = 0x10 + CLOCK_UPTIME_RAW = 0x8 + CLOCK_UPTIME_RAW_APPROX = 0x9 + CLONE_NOFOLLOW = 0x1 + CLONE_NOOWNERCOPY = 0x2 + CR0 = 0x0 + CR1 = 0x1000 + CR2 = 0x2000 + CR3 = 0x3000 + CRDLY = 0x3000 + CREAD = 0x800 + CRTSCTS = 0x30000 + CS5 = 0x0 + CS6 = 0x100 + CS7 = 0x200 + CS8 = 0x300 + CSIZE = 0x300 + CSTART = 0x11 + CSTATUS = 0x14 + CSTOP = 0x13 + CSTOPB = 0x400 + CSUSP = 0x1a + CTLIOCGINFO = 0xc0644e03 + CTL_HW = 0x6 + CTL_KERN = 0x1 + CTL_MAXNAME = 0xc + CTL_NET = 0x4 + DLT_A429 = 0xb8 + DLT_A653_ICM = 0xb9 + DLT_AIRONET_HEADER = 0x78 + DLT_AOS = 0xde + DLT_APPLE_IP_OVER_IEEE1394 = 0x8a + DLT_ARCNET = 0x7 + DLT_ARCNET_LINUX = 0x81 + DLT_ATM_CLIP = 0x13 + DLT_ATM_RFC1483 = 0xb + DLT_AURORA = 0x7e + DLT_AX25 = 0x3 + DLT_AX25_KISS = 0xca + DLT_BACNET_MS_TP = 0xa5 + DLT_BLUETOOTH_HCI_H4 = 0xbb + DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 + DLT_CAN20B = 0xbe + DLT_CAN_SOCKETCAN = 0xe3 + DLT_CHAOS = 0x5 + DLT_CHDLC = 0x68 + DLT_CISCO_IOS = 0x76 + DLT_C_HDLC = 0x68 + DLT_C_HDLC_WITH_DIR = 0xcd + DLT_DBUS = 0xe7 + DLT_DECT = 0xdd + DLT_DOCSIS = 0x8f + DLT_DVB_CI = 0xeb + DLT_ECONET = 0x73 + DLT_EN10MB = 0x1 + DLT_EN3MB = 0x2 + DLT_ENC = 0x6d + DLT_ERF = 0xc5 + DLT_ERF_ETH = 0xaf + DLT_ERF_POS = 0xb0 + DLT_FC_2 = 0xe0 + DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 + DLT_FDDI = 0xa + DLT_FLEXRAY = 0xd2 + DLT_FRELAY = 0x6b + DLT_FRELAY_WITH_DIR = 0xce + DLT_GCOM_SERIAL = 0xad + DLT_GCOM_T1E1 = 0xac + DLT_GPF_F = 0xab + DLT_GPF_T = 0xaa + DLT_GPRS_LLC = 0xa9 + DLT_GSMTAP_ABIS = 0xda + DLT_GSMTAP_UM = 0xd9 + DLT_HHDLC = 0x79 + DLT_IBM_SN = 0x92 + DLT_IBM_SP = 0x91 + DLT_IEEE802 = 0x6 + DLT_IEEE802_11 = 0x69 + DLT_IEEE802_11_RADIO = 0x7f + DLT_IEEE802_11_RADIO_AVS = 0xa3 + DLT_IEEE802_15_4 = 0xc3 + DLT_IEEE802_15_4_LINUX = 0xbf + DLT_IEEE802_15_4_NOFCS = 0xe6 + DLT_IEEE802_15_4_NONASK_PHY = 0xd7 + DLT_IEEE802_16_MAC_CPS = 0xbc + DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 + DLT_IPFILTER = 0x74 + DLT_IPMB = 0xc7 + DLT_IPMB_LINUX = 0xd1 + DLT_IPNET = 0xe2 + DLT_IPOIB = 0xf2 + DLT_IPV4 = 0xe4 + DLT_IPV6 = 0xe5 + DLT_IP_OVER_FC = 0x7a + DLT_JUNIPER_ATM1 = 0x89 + DLT_JUNIPER_ATM2 = 0x87 + DLT_JUNIPER_ATM_CEMIC = 0xee + DLT_JUNIPER_CHDLC = 0xb5 + DLT_JUNIPER_ES = 0x84 + DLT_JUNIPER_ETHER = 0xb2 + DLT_JUNIPER_FIBRECHANNEL = 0xea + DLT_JUNIPER_FRELAY = 0xb4 + DLT_JUNIPER_GGSN = 0x85 + DLT_JUNIPER_ISM = 0xc2 + DLT_JUNIPER_MFR = 0x86 + DLT_JUNIPER_MLFR = 0x83 + DLT_JUNIPER_MLPPP = 0x82 + DLT_JUNIPER_MONITOR = 0xa4 + DLT_JUNIPER_PIC_PEER = 0xae + DLT_JUNIPER_PPP = 0xb3 + DLT_JUNIPER_PPPOE = 0xa7 + DLT_JUNIPER_PPPOE_ATM = 0xa8 + DLT_JUNIPER_SERVICES = 0x88 + DLT_JUNIPER_SRX_E2E = 0xe9 + DLT_JUNIPER_ST = 0xc8 + DLT_JUNIPER_VP = 0xb7 + DLT_JUNIPER_VS = 0xe8 + DLT_LAPB_WITH_DIR = 0xcf + DLT_LAPD = 0xcb + DLT_LIN = 0xd4 + DLT_LINUX_EVDEV = 0xd8 + DLT_LINUX_IRDA = 0x90 + DLT_LINUX_LAPD = 0xb1 + DLT_LINUX_PPP_WITHDIRECTION = 0xa6 + DLT_LINUX_SLL = 0x71 + DLT_LOOP = 0x6c + DLT_LTALK = 0x72 + DLT_MATCHING_MAX = 0x10a + DLT_MATCHING_MIN = 0x68 + DLT_MFR = 0xb6 + DLT_MOST = 0xd3 + DLT_MPEG_2_TS = 0xf3 + DLT_MPLS = 0xdb + DLT_MTP2 = 0x8c + DLT_MTP2_WITH_PHDR = 0x8b + DLT_MTP3 = 0x8d + DLT_MUX27010 = 0xec + DLT_NETANALYZER = 0xf0 + DLT_NETANALYZER_TRANSPARENT = 0xf1 + DLT_NFC_LLCP = 0xf5 + DLT_NFLOG = 0xef + DLT_NG40 = 0xf4 + DLT_NULL = 0x0 + DLT_PCI_EXP = 0x7d + DLT_PFLOG = 0x75 + DLT_PFSYNC = 0x12 + DLT_PPI = 0xc0 + DLT_PPP = 0x9 + DLT_PPP_BSDOS = 0x10 + DLT_PPP_ETHER = 0x33 + DLT_PPP_PPPD = 0xa6 + DLT_PPP_SERIAL = 0x32 + DLT_PPP_WITH_DIR = 0xcc + DLT_PPP_WITH_DIRECTION = 0xa6 + DLT_PRISM_HEADER = 0x77 + DLT_PRONET = 0x4 + DLT_RAIF1 = 0xc6 + DLT_RAW = 0xc + DLT_RIO = 0x7c + DLT_SCCP = 0x8e + DLT_SITA = 0xc4 + DLT_SLIP = 0x8 + DLT_SLIP_BSDOS = 0xf + DLT_STANAG_5066_D_PDU = 0xed + DLT_SUNATM = 0x7b + DLT_SYMANTEC_FIREWALL = 0x63 + DLT_TZSP = 0x80 + DLT_USB = 0xba + DLT_USB_DARWIN = 0x10a + DLT_USB_LINUX = 0xbd + DLT_USB_LINUX_MMAPPED = 0xdc + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c + DLT_WIHART = 0xdf + DLT_X2E_SERIAL = 0xd5 + DLT_X2E_XORAYA = 0xd6 + DT_BLK = 0x6 + DT_CHR = 0x2 + DT_DIR = 0x4 + DT_FIFO = 0x1 + DT_LNK = 0xa + DT_REG = 0x8 + DT_SOCK = 0xc + DT_UNKNOWN = 0x0 + DT_WHT = 0xe + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 + EVFILT_AIO = -0x3 + EVFILT_EXCEPT = -0xf + EVFILT_FS = -0x9 + EVFILT_MACHPORT = -0x8 + EVFILT_PROC = -0x5 + EVFILT_READ = -0x1 + EVFILT_SIGNAL = -0x6 + EVFILT_SYSCOUNT = 0x11 + EVFILT_THREADMARKER = 0x11 + EVFILT_TIMER = -0x7 + EVFILT_USER = -0xa + EVFILT_VM = -0xc + EVFILT_VNODE = -0x4 + EVFILT_WRITE = -0x2 + EV_ADD = 0x1 + EV_CLEAR = 0x20 + EV_DELETE = 0x2 + EV_DISABLE = 0x8 + EV_DISPATCH = 0x80 + EV_DISPATCH2 = 0x180 + EV_ENABLE = 0x4 + EV_EOF = 0x8000 + EV_ERROR = 0x4000 + EV_FLAG0 = 0x1000 + EV_FLAG1 = 0x2000 + EV_ONESHOT = 0x10 + EV_OOBAND = 0x2000 + EV_POLL = 0x1000 + EV_RECEIPT = 0x40 + EV_SYSFLAGS = 0xf000 + EV_UDATA_SPECIFIC = 0x100 + EV_VANISHED = 0x200 + EXTA = 0x4b00 + EXTB = 0x9600 + EXTPROC = 0x800 + FD_CLOEXEC = 0x1 + FD_SETSIZE = 0x400 + FF0 = 0x0 + FF1 = 0x4000 + FFDLY = 0x4000 + FLUSHO = 0x800000 + FSOPT_ATTR_CMN_EXTENDED = 0x20 + FSOPT_NOFOLLOW = 0x1 + FSOPT_NOINMEMUPDATE = 0x2 + FSOPT_PACK_INVAL_ATTRS = 0x8 + FSOPT_REPORT_FULLSIZE = 0x4 + FSOPT_RETURN_REALDEV = 0x200 + F_ADDFILESIGS = 0x3d + F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 + F_ADDFILESIGS_INFO = 0x67 + F_ADDFILESIGS_RETURN = 0x61 + F_ADDFILESUPPL = 0x68 + F_ADDSIGS = 0x3b + F_ALLOCATEALL = 0x4 + F_ALLOCATECONTIG = 0x2 + F_BARRIERFSYNC = 0x55 + F_CHECK_LV = 0x62 + F_CHKCLEAN = 0x29 + F_DUPFD = 0x0 + F_DUPFD_CLOEXEC = 0x43 + F_FINDSIGS = 0x4e + F_FLUSH_DATA = 0x28 + F_FREEZE_FS = 0x35 + F_FULLFSYNC = 0x33 + F_GETCODEDIR = 0x48 + F_GETFD = 0x1 + F_GETFL = 0x3 + F_GETLK = 0x7 + F_GETLKPID = 0x42 + F_GETNOSIGPIPE = 0x4a + F_GETOWN = 0x5 + F_GETPATH = 0x32 + F_GETPATH_MTMINFO = 0x47 + F_GETPATH_NOFIRMLINK = 0x66 + F_GETPROTECTIONCLASS = 0x3f + F_GETPROTECTIONLEVEL = 0x4d + F_GETSIGSINFO = 0x69 + F_GLOBAL_NOCACHE = 0x37 + F_LOG2PHYS = 0x31 + F_LOG2PHYS_EXT = 0x41 + F_NOCACHE = 0x30 + F_NODIRECT = 0x3e + F_OK = 0x0 + F_PATHPKG_CHECK = 0x34 + F_PEOFPOSMODE = 0x3 + F_PREALLOCATE = 0x2a + F_PUNCHHOLE = 0x63 + F_RDADVISE = 0x2c + F_RDAHEAD = 0x2d + F_RDLCK = 0x1 + F_SETBACKINGSTORE = 0x46 + F_SETFD = 0x2 + F_SETFL = 0x4 + F_SETLK = 0x8 + F_SETLKW = 0x9 + F_SETLKWTIMEOUT = 0xa + F_SETNOSIGPIPE = 0x49 + F_SETOWN = 0x6 + F_SETPROTECTIONCLASS = 0x40 + F_SETSIZE = 0x2b + F_SINGLE_WRITER = 0x4c + F_SPECULATIVE_READ = 0x65 + F_THAW_FS = 0x36 + F_TRANSCODEKEY = 0x4b + F_TRIM_ACTIVE_FILE = 0x64 + F_UNLCK = 0x2 + F_VOLPOSMODE = 0x4 + F_WRLCK = 0x3 + HUPCL = 0x4000 + HW_MACHINE = 0x1 + ICANON = 0x100 + ICMP6_FILTER = 0x12 + ICRNL = 0x100 + IEXTEN = 0x400 + IFF_ALLMULTI = 0x200 + IFF_ALTPHYS = 0x4000 + IFF_BROADCAST = 0x2 + IFF_DEBUG = 0x4 + IFF_LINK0 = 0x1000 + IFF_LINK1 = 0x2000 + IFF_LINK2 = 0x4000 + IFF_LOOPBACK = 0x8 + IFF_MULTICAST = 0x8000 + IFF_NOARP = 0x80 + IFF_NOTRAILERS = 0x20 + IFF_OACTIVE = 0x400 + IFF_POINTOPOINT = 0x10 + IFF_PROMISC = 0x100 + IFF_RUNNING = 0x40 + IFF_SIMPLEX = 0x800 + IFF_UP = 0x1 + IFNAMSIZ = 0x10 + IFT_1822 = 0x2 + IFT_6LOWPAN = 0x40 + IFT_AAL5 = 0x31 + IFT_ARCNET = 0x23 + IFT_ARCNETPLUS = 0x24 + IFT_ATM = 0x25 + IFT_BRIDGE = 0xd1 + IFT_CARP = 0xf8 + IFT_CELLULAR = 0xff + IFT_CEPT = 0x13 + IFT_DS3 = 0x1e + IFT_ENC = 0xf4 + IFT_EON = 0x19 + IFT_ETHER = 0x6 + IFT_FAITH = 0x38 + IFT_FDDI = 0xf + IFT_FRELAY = 0x20 + IFT_FRELAYDCE = 0x2c + IFT_GIF = 0x37 + IFT_HDH1822 = 0x3 + IFT_HIPPI = 0x2f + IFT_HSSI = 0x2e + IFT_HY = 0xe + IFT_IEEE1394 = 0x90 + IFT_IEEE8023ADLAG = 0x88 + IFT_ISDNBASIC = 0x14 + IFT_ISDNPRIMARY = 0x15 + IFT_ISO88022LLC = 0x29 + IFT_ISO88023 = 0x7 + IFT_ISO88024 = 0x8 + IFT_ISO88025 = 0x9 + IFT_ISO88026 = 0xa + IFT_L2VLAN = 0x87 + IFT_LAPB = 0x10 + IFT_LOCALTALK = 0x2a + IFT_LOOP = 0x18 + IFT_MIOX25 = 0x26 + IFT_MODEM = 0x30 + IFT_NSIP = 0x1b + IFT_OTHER = 0x1 + IFT_P10 = 0xc + IFT_P80 = 0xd + IFT_PARA = 0x22 + IFT_PDP = 0xff + IFT_PFLOG = 0xf5 + IFT_PFSYNC = 0xf6 + IFT_PKTAP = 0xfe + IFT_PPP = 0x17 + IFT_PROPMUX = 0x36 + IFT_PROPVIRTUAL = 0x35 + IFT_PTPSERIAL = 0x16 + IFT_RS232 = 0x21 + IFT_SDLC = 0x11 + IFT_SIP = 0x1f + IFT_SLIP = 0x1c + IFT_SMDSDXI = 0x2b + IFT_SMDSICIP = 0x34 + IFT_SONET = 0x27 + IFT_SONETPATH = 0x32 + IFT_SONETVT = 0x33 + IFT_STARLAN = 0xb + IFT_STF = 0x39 + IFT_T1 = 0x12 + IFT_ULTRA = 0x1d + IFT_V35 = 0x2d + IFT_X25 = 0x5 + IFT_X25DDN = 0x4 + IFT_X25PLE = 0x28 + IFT_XETHER = 0x1a + IGNBRK = 0x1 + IGNCR = 0x80 + IGNPAR = 0x4 + IMAXBEL = 0x2000 + INLCR = 0x40 + INPCK = 0x10 + IN_CLASSA_HOST = 0xffffff + IN_CLASSA_MAX = 0x80 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 0x18 + IN_CLASSB_HOST = 0xffff + IN_CLASSB_MAX = 0x10000 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 0x10 + IN_CLASSC_HOST = 0xff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 0x8 + IN_CLASSD_HOST = 0xfffffff + IN_CLASSD_NET = 0xf0000000 + IN_CLASSD_NSHIFT = 0x1c + IN_LINKLOCALNETNUM = 0xa9fe0000 + IN_LOOPBACKNET = 0x7f + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x400473d1 + IPPROTO_3PC = 0x22 + IPPROTO_ADFS = 0x44 + IPPROTO_AH = 0x33 + IPPROTO_AHIP = 0x3d + IPPROTO_APES = 0x63 + IPPROTO_ARGUS = 0xd + IPPROTO_AX25 = 0x5d + IPPROTO_BHA = 0x31 + IPPROTO_BLT = 0x1e + IPPROTO_BRSATMON = 0x4c + IPPROTO_CFTP = 0x3e + IPPROTO_CHAOS = 0x10 + IPPROTO_CMTP = 0x26 + IPPROTO_CPHB = 0x49 + IPPROTO_CPNX = 0x48 + IPPROTO_DDP = 0x25 + IPPROTO_DGP = 0x56 + IPPROTO_DIVERT = 0xfe + IPPROTO_DONE = 0x101 + IPPROTO_DSTOPTS = 0x3c + IPPROTO_EGP = 0x8 + IPPROTO_EMCON = 0xe + IPPROTO_ENCAP = 0x62 + IPPROTO_EON = 0x50 + IPPROTO_ESP = 0x32 + IPPROTO_ETHERIP = 0x61 + IPPROTO_FRAGMENT = 0x2c + IPPROTO_GGP = 0x3 + IPPROTO_GMTP = 0x64 + IPPROTO_GRE = 0x2f + IPPROTO_HELLO = 0x3f + IPPROTO_HMP = 0x14 + IPPROTO_HOPOPTS = 0x0 + IPPROTO_ICMP = 0x1 + IPPROTO_ICMPV6 = 0x3a + IPPROTO_IDP = 0x16 + IPPROTO_IDPR = 0x23 + IPPROTO_IDRP = 0x2d + IPPROTO_IGMP = 0x2 + IPPROTO_IGP = 0x55 + IPPROTO_IGRP = 0x58 + IPPROTO_IL = 0x28 + IPPROTO_INLSP = 0x34 + IPPROTO_INP = 0x20 + IPPROTO_IP = 0x0 + IPPROTO_IPCOMP = 0x6c + IPPROTO_IPCV = 0x47 + IPPROTO_IPEIP = 0x5e + IPPROTO_IPIP = 0x4 + IPPROTO_IPPC = 0x43 + IPPROTO_IPV4 = 0x4 + IPPROTO_IPV6 = 0x29 + IPPROTO_IRTP = 0x1c + IPPROTO_KRYPTOLAN = 0x41 + IPPROTO_LARP = 0x5b + IPPROTO_LEAF1 = 0x19 + IPPROTO_LEAF2 = 0x1a + IPPROTO_MAX = 0x100 + IPPROTO_MAXID = 0x34 + IPPROTO_MEAS = 0x13 + IPPROTO_MHRP = 0x30 + IPPROTO_MICP = 0x5f + IPPROTO_MTP = 0x5c + IPPROTO_MUX = 0x12 + IPPROTO_ND = 0x4d + IPPROTO_NHRP = 0x36 + IPPROTO_NONE = 0x3b + IPPROTO_NSP = 0x1f + IPPROTO_NVPII = 0xb + IPPROTO_OSPFIGP = 0x59 + IPPROTO_PGM = 0x71 + IPPROTO_PIGP = 0x9 + IPPROTO_PIM = 0x67 + IPPROTO_PRM = 0x15 + IPPROTO_PUP = 0xc + IPPROTO_PVP = 0x4b + IPPROTO_RAW = 0xff + IPPROTO_RCCMON = 0xa + IPPROTO_RDP = 0x1b + IPPROTO_ROUTING = 0x2b + IPPROTO_RSVP = 0x2e + IPPROTO_RVD = 0x42 + IPPROTO_SATEXPAK = 0x40 + IPPROTO_SATMON = 0x45 + IPPROTO_SCCSP = 0x60 + IPPROTO_SCTP = 0x84 + IPPROTO_SDRP = 0x2a + IPPROTO_SEP = 0x21 + IPPROTO_SRPC = 0x5a + IPPROTO_ST = 0x7 + IPPROTO_SVMTP = 0x52 + IPPROTO_SWIPE = 0x35 + IPPROTO_TCF = 0x57 + IPPROTO_TCP = 0x6 + IPPROTO_TP = 0x1d + IPPROTO_TPXX = 0x27 + IPPROTO_TRUNK1 = 0x17 + IPPROTO_TRUNK2 = 0x18 + IPPROTO_TTP = 0x54 + IPPROTO_UDP = 0x11 + IPPROTO_VINES = 0x53 + IPPROTO_VISA = 0x46 + IPPROTO_VMTP = 0x51 + IPPROTO_WBEXPAK = 0x4f + IPPROTO_WBMON = 0x4e + IPPROTO_WSN = 0x4a + IPPROTO_XNET = 0xf + IPPROTO_XTP = 0x24 + IPV6_2292DSTOPTS = 0x17 + IPV6_2292HOPLIMIT = 0x14 + IPV6_2292HOPOPTS = 0x16 + IPV6_2292NEXTHOP = 0x15 + IPV6_2292PKTINFO = 0x13 + IPV6_2292PKTOPTIONS = 0x19 + IPV6_2292RTHDR = 0x18 + IPV6_3542DSTOPTS = 0x32 + IPV6_3542HOPLIMIT = 0x2f + IPV6_3542HOPOPTS = 0x31 + IPV6_3542NEXTHOP = 0x30 + IPV6_3542PKTINFO = 0x2e + IPV6_3542RTHDR = 0x33 + IPV6_ADDR_MC_FLAGS_PREFIX = 0x20 + IPV6_ADDR_MC_FLAGS_TRANSIENT = 0x10 + IPV6_ADDR_MC_FLAGS_UNICAST_BASED = 0x30 + IPV6_AUTOFLOWLABEL = 0x3b + IPV6_BINDV6ONLY = 0x1b + IPV6_BOUND_IF = 0x7d + IPV6_CHECKSUM = 0x1a + IPV6_DEFAULT_MULTICAST_HOPS = 0x1 + IPV6_DEFAULT_MULTICAST_LOOP = 0x1 + IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 + IPV6_FAITH = 0x1d + IPV6_FLOWINFO_MASK = 0xffffff0f + IPV6_FLOWLABEL_MASK = 0xffff0f00 + IPV6_FLOW_ECN_MASK = 0x3000 + IPV6_FRAGTTL = 0x3c + IPV6_FW_ADD = 0x1e + IPV6_FW_DEL = 0x1f + IPV6_FW_FLUSH = 0x20 + IPV6_FW_GET = 0x22 + IPV6_FW_ZERO = 0x21 + IPV6_HLIMDEC = 0x1 + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 + IPV6_IPSEC_POLICY = 0x1c + IPV6_JOIN_GROUP = 0xc + IPV6_LEAVE_GROUP = 0xd + IPV6_MAXHLIM = 0xff + IPV6_MAXOPTHDR = 0x800 + IPV6_MAXPACKET = 0xffff + IPV6_MAX_GROUP_SRC_FILTER = 0x200 + IPV6_MAX_MEMBERSHIPS = 0xfff + IPV6_MAX_SOCK_SRC_FILTER = 0x80 + IPV6_MIN_MEMBERSHIPS = 0x1f + IPV6_MMTU = 0x500 + IPV6_MSFILTER = 0x4a + IPV6_MULTICAST_HOPS = 0xa + IPV6_MULTICAST_IF = 0x9 + IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_PATHMTU = 0x2c + IPV6_PKTINFO = 0x2e + IPV6_PORTRANGE = 0xe + IPV6_PORTRANGE_DEFAULT = 0x0 + IPV6_PORTRANGE_HIGH = 0x1 + IPV6_PORTRANGE_LOW = 0x2 + IPV6_PREFER_TEMPADDR = 0x3f + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x3d + IPV6_RECVRTHDR = 0x26 + IPV6_RECVTCLASS = 0x23 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x39 + IPV6_RTHDR_LOOSE = 0x0 + IPV6_RTHDR_STRICT = 0x1 + IPV6_RTHDR_TYPE_0 = 0x0 + IPV6_SOCKOPT_RESERVED1 = 0x3 + IPV6_TCLASS = 0x24 + IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a + IPV6_V6ONLY = 0x1b + IPV6_VERSION = 0x60 + IPV6_VERSION_MASK = 0xf0 + IP_ADD_MEMBERSHIP = 0xc + IP_ADD_SOURCE_MEMBERSHIP = 0x46 + IP_BLOCK_SOURCE = 0x48 + IP_BOUND_IF = 0x19 + IP_DEFAULT_MULTICAST_LOOP = 0x1 + IP_DEFAULT_MULTICAST_TTL = 0x1 + IP_DF = 0x4000 + IP_DONTFRAG = 0x1c + IP_DROP_MEMBERSHIP = 0xd + IP_DROP_SOURCE_MEMBERSHIP = 0x47 + IP_DUMMYNET_CONFIGURE = 0x3c + IP_DUMMYNET_DEL = 0x3d + IP_DUMMYNET_FLUSH = 0x3e + IP_DUMMYNET_GET = 0x40 + IP_FAITH = 0x16 + IP_FW_ADD = 0x28 + IP_FW_DEL = 0x29 + IP_FW_FLUSH = 0x2a + IP_FW_GET = 0x2c + IP_FW_RESETLOG = 0x2d + IP_FW_ZERO = 0x2b + IP_HDRINCL = 0x2 + IP_IPSEC_POLICY = 0x15 + IP_MAXPACKET = 0xffff + IP_MAX_GROUP_SRC_FILTER = 0x200 + IP_MAX_MEMBERSHIPS = 0xfff + IP_MAX_SOCK_MUTE_FILTER = 0x80 + IP_MAX_SOCK_SRC_FILTER = 0x80 + IP_MF = 0x2000 + IP_MIN_MEMBERSHIPS = 0x1f + IP_MSFILTER = 0x4a + IP_MSS = 0x240 + IP_MULTICAST_IF = 0x9 + IP_MULTICAST_IFINDEX = 0x42 + IP_MULTICAST_LOOP = 0xb + IP_MULTICAST_TTL = 0xa + IP_MULTICAST_VIF = 0xe + IP_NAT__XXX = 0x37 + IP_OFFMASK = 0x1fff + IP_OLD_FW_ADD = 0x32 + IP_OLD_FW_DEL = 0x33 + IP_OLD_FW_FLUSH = 0x34 + IP_OLD_FW_GET = 0x36 + IP_OLD_FW_RESETLOG = 0x38 + IP_OLD_FW_ZERO = 0x35 + IP_OPTIONS = 0x1 + IP_PKTINFO = 0x1a + IP_PORTRANGE = 0x13 + IP_PORTRANGE_DEFAULT = 0x0 + IP_PORTRANGE_HIGH = 0x1 + IP_PORTRANGE_LOW = 0x2 + IP_RECVDSTADDR = 0x7 + IP_RECVIF = 0x14 + IP_RECVOPTS = 0x5 + IP_RECVPKTINFO = 0x1a + IP_RECVRETOPTS = 0x6 + IP_RECVTOS = 0x1b + IP_RECVTTL = 0x18 + IP_RETOPTS = 0x8 + IP_RF = 0x8000 + IP_RSVP_OFF = 0x10 + IP_RSVP_ON = 0xf + IP_RSVP_VIF_OFF = 0x12 + IP_RSVP_VIF_ON = 0x11 + IP_STRIPHDR = 0x17 + IP_TOS = 0x3 + IP_TRAFFIC_MGT_BACKGROUND = 0x41 + IP_TTL = 0x4 + IP_UNBLOCK_SOURCE = 0x49 + ISIG = 0x80 + ISTRIP = 0x20 + IUTF8 = 0x4000 + IXANY = 0x800 + IXOFF = 0x400 + IXON = 0x200 + KERN_HOSTNAME = 0xa + KERN_OSRELEASE = 0x2 + KERN_OSTYPE = 0x1 + KERN_VERSION = 0x4 + LOCAL_PEERCRED = 0x1 + LOCAL_PEEREPID = 0x3 + LOCAL_PEEREUUID = 0x5 + LOCAL_PEERPID = 0x2 + LOCAL_PEERTOKEN = 0x6 + LOCAL_PEERUUID = 0x4 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_SH = 0x1 + LOCK_UN = 0x8 + MADV_CAN_REUSE = 0x9 + MADV_DONTNEED = 0x4 + MADV_FREE = 0x5 + MADV_FREE_REUSABLE = 0x7 + MADV_FREE_REUSE = 0x8 + MADV_NORMAL = 0x0 + MADV_PAGEOUT = 0xa + MADV_RANDOM = 0x1 + MADV_SEQUENTIAL = 0x2 + MADV_WILLNEED = 0x3 + MADV_ZERO_WIRED_PAGES = 0x6 + MAP_32BIT = 0x8000 + MAP_ANON = 0x1000 + MAP_ANONYMOUS = 0x1000 + MAP_COPY = 0x2 + MAP_FILE = 0x0 + MAP_FIXED = 0x10 + MAP_HASSEMAPHORE = 0x200 + MAP_JIT = 0x800 + MAP_NOCACHE = 0x400 + MAP_NOEXTEND = 0x100 + MAP_NORESERVE = 0x40 + MAP_PRIVATE = 0x2 + MAP_RENAME = 0x20 + MAP_RESERVED0080 = 0x80 + MAP_RESILIENT_CODESIGN = 0x2000 + MAP_RESILIENT_MEDIA = 0x4000 + MAP_SHARED = 0x1 + MAP_TRANSLATED_ALLOW_EXECUTE = 0x20000 + MAP_UNIX03 = 0x40000 + MCAST_BLOCK_SOURCE = 0x54 + MCAST_EXCLUDE = 0x2 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x50 + MCAST_JOIN_SOURCE_GROUP = 0x52 + MCAST_LEAVE_GROUP = 0x51 + MCAST_LEAVE_SOURCE_GROUP = 0x53 + MCAST_UNBLOCK_SOURCE = 0x55 + MCAST_UNDEFINED = 0x0 + MCL_CURRENT = 0x1 + MCL_FUTURE = 0x2 + MNT_ASYNC = 0x40 + MNT_AUTOMOUNTED = 0x400000 + MNT_CMDFLAGS = 0xf0000 + MNT_CPROTECT = 0x80 + MNT_DEFWRITE = 0x2000000 + MNT_DONTBROWSE = 0x100000 + MNT_DOVOLFS = 0x8000 + MNT_DWAIT = 0x4 + MNT_EXPORTED = 0x100 + MNT_EXT_ROOT_DATA_VOL = 0x1 + MNT_FORCE = 0x80000 + MNT_IGNORE_OWNERSHIP = 0x200000 + MNT_JOURNALED = 0x800000 + MNT_LOCAL = 0x1000 + MNT_MULTILABEL = 0x4000000 + MNT_NOATIME = 0x10000000 + MNT_NOBLOCK = 0x20000 + MNT_NODEV = 0x10 + MNT_NOEXEC = 0x4 + MNT_NOSUID = 0x8 + MNT_NOUSERXATTR = 0x1000000 + MNT_NOWAIT = 0x2 + MNT_QUARANTINE = 0x400 + MNT_QUOTA = 0x2000 + MNT_RDONLY = 0x1 + MNT_RELOAD = 0x40000 + MNT_REMOVABLE = 0x200 + MNT_ROOTFS = 0x4000 + MNT_SNAPSHOT = 0x40000000 + MNT_STRICTATIME = 0x80000000 + MNT_SYNCHRONOUS = 0x2 + MNT_UNION = 0x20 + MNT_UNKNOWNPERMISSIONS = 0x200000 + MNT_UPDATE = 0x10000 + MNT_VISFLAGMASK = 0xd7f0f7ff + MNT_WAIT = 0x1 + MSG_CTRUNC = 0x20 + MSG_DONTROUTE = 0x4 + MSG_DONTWAIT = 0x80 + MSG_EOF = 0x100 + MSG_EOR = 0x8 + MSG_FLUSH = 0x400 + MSG_HAVEMORE = 0x2000 + MSG_HOLD = 0x800 + MSG_NEEDSA = 0x10000 + MSG_NOSIGNAL = 0x80000 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_RCVMORE = 0x4000 + MSG_SEND = 0x1000 + MSG_TRUNC = 0x10 + MSG_WAITALL = 0x40 + MSG_WAITSTREAM = 0x200 + MS_ASYNC = 0x1 + MS_DEACTIVATE = 0x8 + MS_INVALIDATE = 0x2 + MS_KILLPAGES = 0x4 + MS_SYNC = 0x10 + NAME_MAX = 0xff + NET_RT_DUMP = 0x1 + NET_RT_DUMP2 = 0x7 + NET_RT_FLAGS = 0x2 + NET_RT_FLAGS_PRIV = 0xa + NET_RT_IFLIST = 0x3 + NET_RT_IFLIST2 = 0x6 + NET_RT_MAXID = 0xb + NET_RT_STAT = 0x4 + NET_RT_TRASH = 0x5 + NFDBITS = 0x20 + NL0 = 0x0 + NL1 = 0x100 + NL2 = 0x200 + NL3 = 0x300 + NLDLY = 0x300 + NOFLSH = 0x80000000 + NOKERNINFO = 0x2000000 + NOTE_ABSOLUTE = 0x8 + NOTE_ATTRIB = 0x8 + NOTE_BACKGROUND = 0x40 + NOTE_CHILD = 0x4 + NOTE_CRITICAL = 0x20 + NOTE_DELETE = 0x1 + NOTE_EXEC = 0x20000000 + NOTE_EXIT = 0x80000000 + NOTE_EXITSTATUS = 0x4000000 + NOTE_EXIT_CSERROR = 0x40000 + NOTE_EXIT_DECRYPTFAIL = 0x10000 + NOTE_EXIT_DETAIL = 0x2000000 + NOTE_EXIT_DETAIL_MASK = 0x70000 + NOTE_EXIT_MEMORY = 0x20000 + NOTE_EXIT_REPARENTED = 0x80000 + NOTE_EXTEND = 0x4 + NOTE_FFAND = 0x40000000 + NOTE_FFCOPY = 0xc0000000 + NOTE_FFCTRLMASK = 0xc0000000 + NOTE_FFLAGSMASK = 0xffffff + NOTE_FFNOP = 0x0 + NOTE_FFOR = 0x80000000 + NOTE_FORK = 0x40000000 + NOTE_FUNLOCK = 0x100 + NOTE_LEEWAY = 0x10 + NOTE_LINK = 0x10 + NOTE_LOWAT = 0x1 + NOTE_MACHTIME = 0x100 + NOTE_MACH_CONTINUOUS_TIME = 0x80 + NOTE_NONE = 0x80 + NOTE_NSECONDS = 0x4 + NOTE_OOB = 0x2 + NOTE_PCTRLMASK = -0x100000 + NOTE_PDATAMASK = 0xfffff + NOTE_REAP = 0x10000000 + NOTE_RENAME = 0x20 + NOTE_REVOKE = 0x40 + NOTE_SECONDS = 0x1 + NOTE_SIGNAL = 0x8000000 + NOTE_TRACK = 0x1 + NOTE_TRACKERR = 0x2 + NOTE_TRIGGER = 0x1000000 + NOTE_USECONDS = 0x2 + NOTE_VM_ERROR = 0x10000000 + NOTE_VM_PRESSURE = 0x80000000 + NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 + NOTE_VM_PRESSURE_TERMINATE = 0x40000000 + NOTE_WRITE = 0x2 + OCRNL = 0x10 + OFDEL = 0x20000 + OFILL = 0x80 + ONLCR = 0x2 + ONLRET = 0x40 + ONOCR = 0x20 + ONOEOT = 0x8 + OPOST = 0x1 + OXTABS = 0x4 + O_ACCMODE = 0x3 + O_ALERT = 0x20000000 + O_APPEND = 0x8 + O_ASYNC = 0x40 + O_CLOEXEC = 0x1000000 + O_CREAT = 0x200 + O_DIRECTORY = 0x100000 + O_DP_GETRAWENCRYPTED = 0x1 + O_DP_GETRAWUNENCRYPTED = 0x2 + O_DSYNC = 0x400000 + O_EVTONLY = 0x8000 + O_EXCL = 0x800 + O_EXLOCK = 0x20 + O_FSYNC = 0x80 + O_NDELAY = 0x4 + O_NOCTTY = 0x20000 + O_NOFOLLOW = 0x100 + O_NOFOLLOW_ANY = 0x20000000 + O_NONBLOCK = 0x4 + O_POPUP = 0x80000000 + O_RDONLY = 0x0 + O_RDWR = 0x2 + O_SHLOCK = 0x10 + O_SYMLINK = 0x200000 + O_SYNC = 0x80 + O_TRUNC = 0x400 + O_WRONLY = 0x1 + PARENB = 0x1000 + PARMRK = 0x8 + PARODD = 0x2000 + PENDIN = 0x20000000 + PRIO_PGRP = 0x1 + PRIO_PROCESS = 0x0 + PRIO_USER = 0x2 + PROT_EXEC = 0x4 + PROT_NONE = 0x0 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + PT_ATTACH = 0xa + PT_ATTACHEXC = 0xe + PT_CONTINUE = 0x7 + PT_DENY_ATTACH = 0x1f + PT_DETACH = 0xb + PT_FIRSTMACH = 0x20 + PT_FORCEQUOTA = 0x1e + PT_KILL = 0x8 + PT_READ_D = 0x2 + PT_READ_I = 0x1 + PT_READ_U = 0x3 + PT_SIGEXC = 0xc + PT_STEP = 0x9 + PT_THUPDATE = 0xd + PT_TRACE_ME = 0x0 + PT_WRITE_D = 0x5 + PT_WRITE_I = 0x4 + PT_WRITE_U = 0x6 + RLIMIT_AS = 0x5 + RLIMIT_CORE = 0x4 + RLIMIT_CPU = 0x0 + RLIMIT_CPU_USAGE_MONITOR = 0x2 + RLIMIT_DATA = 0x2 + RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 + RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 + RLIMIT_STACK = 0x3 + RLIM_INFINITY = 0x7fffffffffffffff + RTAX_AUTHOR = 0x6 + RTAX_BRD = 0x7 + RTAX_DST = 0x0 + RTAX_GATEWAY = 0x1 + RTAX_GENMASK = 0x3 + RTAX_IFA = 0x5 + RTAX_IFP = 0x4 + RTAX_MAX = 0x8 + RTAX_NETMASK = 0x2 + RTA_AUTHOR = 0x40 + RTA_BRD = 0x80 + RTA_DST = 0x1 + RTA_GATEWAY = 0x2 + RTA_GENMASK = 0x8 + RTA_IFA = 0x20 + RTA_IFP = 0x10 + RTA_NETMASK = 0x4 + RTF_BLACKHOLE = 0x1000 + RTF_BROADCAST = 0x400000 + RTF_CLONING = 0x100 + RTF_CONDEMNED = 0x2000000 + RTF_DEAD = 0x20000000 + RTF_DELCLONE = 0x80 + RTF_DONE = 0x40 + RTF_DYNAMIC = 0x10 + RTF_GATEWAY = 0x2 + RTF_GLOBAL = 0x40000000 + RTF_HOST = 0x4 + RTF_IFREF = 0x4000000 + RTF_IFSCOPE = 0x1000000 + RTF_LLDATA = 0x400 + RTF_LLINFO = 0x400 + RTF_LOCAL = 0x200000 + RTF_MODIFIED = 0x20 + RTF_MULTICAST = 0x800000 + RTF_NOIFREF = 0x2000 + RTF_PINNED = 0x100000 + RTF_PRCLONING = 0x10000 + RTF_PROTO1 = 0x8000 + RTF_PROTO2 = 0x4000 + RTF_PROTO3 = 0x40000 + RTF_PROXY = 0x8000000 + RTF_REJECT = 0x8 + RTF_ROUTER = 0x10000000 + RTF_STATIC = 0x800 + RTF_UP = 0x1 + RTF_WASCLONED = 0x20000 + RTF_XRESOLVE = 0x200 + RTM_ADD = 0x1 + RTM_CHANGE = 0x3 + RTM_DELADDR = 0xd + RTM_DELETE = 0x2 + RTM_DELMADDR = 0x10 + RTM_GET = 0x4 + RTM_GET2 = 0x14 + RTM_IFINFO = 0xe + RTM_IFINFO2 = 0x12 + RTM_LOCK = 0x8 + RTM_LOSING = 0x5 + RTM_MISS = 0x7 + RTM_NEWADDR = 0xc + RTM_NEWMADDR = 0xf + RTM_NEWMADDR2 = 0x13 + RTM_OLDADD = 0x9 + RTM_OLDDEL = 0xa + RTM_REDIRECT = 0x6 + RTM_RESOLVE = 0xb + RTM_RTTUNIT = 0xf4240 + RTM_VERSION = 0x5 + RTV_EXPIRE = 0x4 + RTV_HOPCOUNT = 0x2 + RTV_MTU = 0x1 + RTV_RPIPE = 0x8 + RTV_RTT = 0x40 + RTV_RTTVAR = 0x80 + RTV_SPIPE = 0x10 + RTV_SSTHRESH = 0x20 + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 + SCM_CREDS = 0x3 + SCM_RIGHTS = 0x1 + SCM_TIMESTAMP = 0x2 + SCM_TIMESTAMP_MONOTONIC = 0x4 + SEEK_CUR = 0x1 + SEEK_DATA = 0x4 + SEEK_END = 0x2 + SEEK_HOLE = 0x3 + SEEK_SET = 0x0 + SHUT_RD = 0x0 + SHUT_RDWR = 0x2 + SHUT_WR = 0x1 + SIOCADDMULTI = 0x80206931 + SIOCAIFADDR = 0x8040691a + SIOCARPIPLL = 0xc0206928 + SIOCATMARK = 0x40047307 + SIOCAUTOADDR = 0xc0206926 + SIOCAUTONETMASK = 0x80206927 + SIOCDELMULTI = 0x80206932 + SIOCDIFADDR = 0x80206919 + SIOCDIFPHYADDR = 0x80206941 + SIOCGDRVSPEC = 0xc028697b + SIOCGETVLAN = 0xc020697f + SIOCGHIWAT = 0x40047301 + SIOCGIF6LOWPAN = 0xc02069c5 + SIOCGIFADDR = 0xc0206921 + SIOCGIFALTMTU = 0xc0206948 + SIOCGIFASYNCMAP = 0xc020697c + SIOCGIFBOND = 0xc0206947 + SIOCGIFBRDADDR = 0xc0206923 + SIOCGIFCAP = 0xc020695b + SIOCGIFCONF = 0xc00c6924 + SIOCGIFDEVMTU = 0xc0206944 + SIOCGIFDSTADDR = 0xc0206922 + SIOCGIFFLAGS = 0xc0206911 + SIOCGIFFUNCTIONALTYPE = 0xc02069ad + SIOCGIFGENERIC = 0xc020693a + SIOCGIFKPI = 0xc0206987 + SIOCGIFMAC = 0xc0206982 + SIOCGIFMEDIA = 0xc02c6938 + SIOCGIFMETRIC = 0xc0206917 + SIOCGIFMTU = 0xc0206933 + SIOCGIFNETMASK = 0xc0206925 + SIOCGIFPDSTADDR = 0xc0206940 + SIOCGIFPHYS = 0xc0206935 + SIOCGIFPSRCADDR = 0xc020693f + SIOCGIFSTATUS = 0xc331693d + SIOCGIFVLAN = 0xc020697f + SIOCGIFWAKEFLAGS = 0xc0206988 + SIOCGIFXMEDIA = 0xc02c6948 + SIOCGLOWAT = 0x40047303 + SIOCGPGRP = 0x40047309 + SIOCIFCREATE = 0xc0206978 + SIOCIFCREATE2 = 0xc020697a + SIOCIFDESTROY = 0x80206979 + SIOCIFGCLONERS = 0xc0106981 + SIOCRSLVMULTI = 0xc010693b + SIOCSDRVSPEC = 0x8028697b + SIOCSETVLAN = 0x8020697e + SIOCSHIWAT = 0x80047300 + SIOCSIF6LOWPAN = 0x802069c4 + SIOCSIFADDR = 0x8020690c + SIOCSIFALTMTU = 0x80206945 + SIOCSIFASYNCMAP = 0x8020697d + SIOCSIFBOND = 0x80206946 + SIOCSIFBRDADDR = 0x80206913 + SIOCSIFCAP = 0x8020695a + SIOCSIFDSTADDR = 0x8020690e + SIOCSIFFLAGS = 0x80206910 + SIOCSIFGENERIC = 0x80206939 + SIOCSIFKPI = 0x80206986 + SIOCSIFLLADDR = 0x8020693c + SIOCSIFMAC = 0x80206983 + SIOCSIFMEDIA = 0xc0206937 + SIOCSIFMETRIC = 0x80206918 + SIOCSIFMTU = 0x80206934 + SIOCSIFNETMASK = 0x80206916 + SIOCSIFPHYADDR = 0x8040693e + SIOCSIFPHYS = 0x80206936 + SIOCSIFVLAN = 0x8020697e + SIOCSLOWAT = 0x80047302 + SIOCSPGRP = 0x80047308 + SOCK_DGRAM = 0x2 + SOCK_MAXADDRLEN = 0xff + SOCK_RAW = 0x3 + SOCK_RDM = 0x4 + SOCK_SEQPACKET = 0x5 + SOCK_STREAM = 0x1 + SOL_LOCAL = 0x0 + SOL_SOCKET = 0xffff + SOMAXCONN = 0x80 + SO_ACCEPTCONN = 0x2 + SO_BROADCAST = 0x20 + SO_DEBUG = 0x1 + SO_DONTROUTE = 0x10 + SO_DONTTRUNC = 0x2000 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x8 + SO_LABEL = 0x1010 + SO_LINGER = 0x80 + SO_LINGER_SEC = 0x1080 + SO_NETSVC_MARKING_LEVEL = 0x1119 + SO_NET_SERVICE_TYPE = 0x1116 + SO_NKE = 0x1021 + SO_NOADDRERR = 0x1023 + SO_NOSIGPIPE = 0x1022 + SO_NOTIFYCONFLICT = 0x1026 + SO_NP_EXTENSIONS = 0x1083 + SO_NREAD = 0x1020 + SO_NUMRCVPKT = 0x1112 + SO_NWRITE = 0x1024 + SO_OOBINLINE = 0x100 + SO_PEERLABEL = 0x1011 + SO_RANDOMPORT = 0x1082 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x1006 + SO_REUSEADDR = 0x4 + SO_REUSEPORT = 0x200 + SO_REUSESHAREUID = 0x1025 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x1005 + SO_TIMESTAMP = 0x400 + SO_TIMESTAMP_MONOTONIC = 0x800 + SO_TRACKER_ATTRIBUTE_FLAGS_APP_APPROVED = 0x1 + SO_TRACKER_ATTRIBUTE_FLAGS_DOMAIN_SHORT = 0x4 + SO_TRACKER_ATTRIBUTE_FLAGS_TRACKER = 0x2 + SO_TRACKER_TRANSPARENCY_VERSION = 0x3 + SO_TYPE = 0x1008 + SO_UPCALLCLOSEWAIT = 0x1027 + SO_USELOOPBACK = 0x40 + SO_WANTMORE = 0x4000 + SO_WANTOOBFLAG = 0x8000 + S_IEXEC = 0x40 + S_IFBLK = 0x6000 + S_IFCHR = 0x2000 + S_IFDIR = 0x4000 + S_IFIFO = 0x1000 + S_IFLNK = 0xa000 + S_IFMT = 0xf000 + S_IFREG = 0x8000 + S_IFSOCK = 0xc000 + S_IFWHT = 0xe000 + S_IREAD = 0x100 + S_IRGRP = 0x20 + S_IROTH = 0x4 + S_IRUSR = 0x100 + S_IRWXG = 0x38 + S_IRWXO = 0x7 + S_IRWXU = 0x1c0 + S_ISGID = 0x400 + S_ISTXT = 0x200 + S_ISUID = 0x800 + S_ISVTX = 0x200 + S_IWGRP = 0x10 + S_IWOTH = 0x2 + S_IWRITE = 0x80 + S_IWUSR = 0x80 + S_IXGRP = 0x8 + S_IXOTH = 0x1 + S_IXUSR = 0x40 + TAB0 = 0x0 + TAB1 = 0x400 + TAB2 = 0x800 + TAB3 = 0x4 + TABDLY = 0xc04 + TCIFLUSH = 0x1 + TCIOFF = 0x3 + TCIOFLUSH = 0x3 + TCION = 0x4 + TCOFLUSH = 0x2 + TCOOFF = 0x1 + TCOON = 0x2 + TCPOPT_CC = 0xb + TCPOPT_CCECHO = 0xd + TCPOPT_CCNEW = 0xc + TCPOPT_EOL = 0x0 + TCPOPT_FASTOPEN = 0x22 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_HDR = 0x1010500 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SACK_PERMIT_HDR = 0x1010402 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_TSTAMP_HDR = 0x101080a + TCPOPT_WINDOW = 0x3 + TCP_CONNECTIONTIMEOUT = 0x20 + TCP_CONNECTION_INFO = 0x106 + TCP_ENABLE_ECN = 0x104 + TCP_FASTOPEN = 0x105 + TCP_KEEPALIVE = 0x10 + TCP_KEEPCNT = 0x102 + TCP_KEEPINTVL = 0x101 + TCP_MAXHLEN = 0x3c + TCP_MAXOLEN = 0x28 + TCP_MAXSEG = 0x2 + TCP_MAXWIN = 0xffff + TCP_MAX_SACK = 0x4 + TCP_MAX_WINSHIFT = 0xe + TCP_MINMSS = 0xd8 + TCP_MSS = 0x200 + TCP_NODELAY = 0x1 + TCP_NOOPT = 0x8 + TCP_NOPUSH = 0x4 + TCP_NOTSENT_LOWAT = 0x201 + TCP_RXT_CONNDROPTIME = 0x80 + TCP_RXT_FINDROP = 0x100 + TCP_SENDMOREACKS = 0x103 + TCSAFLUSH = 0x2 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCONS = 0x80047462 + TIOCDCDTIMESTAMP = 0x40107458 + TIOCDRAIN = 0x2000745e + TIOCDSIMICROCODE = 0x20007455 + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLUSH = 0x80047410 + TIOCGDRAINWAIT = 0x40047456 + TIOCGETA = 0x40487413 + TIOCGETD = 0x4004741a + TIOCGPGRP = 0x40047477 + TIOCGWINSZ = 0x40087468 + TIOCIXOFF = 0x20007480 + TIOCIXON = 0x20007481 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGDTRWAIT = 0x4004745a + TIOCMGET = 0x4004746a + TIOCMODG = 0x40047403 + TIOCMODS = 0x80047404 + TIOCMSDTRWAIT = 0x8004745b + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0x0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCPTYGNAME = 0x40807453 + TIOCPTYGRANT = 0x20007454 + TIOCPTYUNLK = 0x20007452 + TIOCREMOTE = 0x80047469 + TIOCSBRK = 0x2000747b + TIOCSCONS = 0x20007463 + TIOCSCTTY = 0x20007461 + TIOCSDRAINWAIT = 0x80047457 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x80487414 + TIOCSETAF = 0x80487416 + TIOCSETAW = 0x80487415 + TIOCSETD = 0x8004741b + TIOCSIG = 0x2000745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTI = 0x80017472 + TIOCSTOP = 0x2000746f + TIOCSWINSZ = 0x80087467 + TIOCTIMESTAMP = 0x40107459 + TIOCUCNTL = 0x80047466 + TOSTOP = 0x400000 + VDISCARD = 0xf + VDSUSP = 0xb + VEOF = 0x0 + VEOL = 0x1 + VEOL2 = 0x2 + VERASE = 0x3 + VINTR = 0x8 + VKILL = 0x5 + VLNEXT = 0xe + VMADDR_CID_ANY = 0xffffffff + VMADDR_CID_HOST = 0x2 + VMADDR_CID_HYPERVISOR = 0x0 + VMADDR_CID_RESERVED = 0x1 + VMADDR_PORT_ANY = 0xffffffff + VMIN = 0x10 + VM_LOADAVG = 0x2 + VM_MACHFACTOR = 0x4 + VM_MAXID = 0x6 + VM_METER = 0x1 + VM_SWAPUSAGE = 0x5 + VQUIT = 0x9 + VREPRINT = 0x6 + VSTART = 0xc + VSTATUS = 0x12 + VSTOP = 0xd + VSUSP = 0xa + VT0 = 0x0 + VT1 = 0x10000 + VTDLY = 0x10000 + VTIME = 0x11 + VWERASE = 0x4 + WCONTINUED = 0x10 + WCOREFLAG = 0x80 + WEXITED = 0x4 + WNOHANG = 0x1 + WNOWAIT = 0x20 + WORDSIZE = 0x40 + WSTOPPED = 0x8 + WUNTRACED = 0x2 + XATTR_CREATE = 0x2 + XATTR_NODEFAULT = 0x10 + XATTR_NOFOLLOW = 0x1 + XATTR_NOSECURITY = 0x8 + XATTR_REPLACE = 0x4 + XATTR_SHOWCOMPRESSION = 0x20 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index e644eaf5e..e36f5178d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -12,1550 +12,1582 @@ package unix import "syscall" const ( - AF_APPLETALK = 0x10 - AF_CCITT = 0xa - AF_CHAOS = 0x5 - AF_CNT = 0x15 - AF_COIP = 0x14 - AF_DATAKIT = 0x9 - AF_DECnet = 0xc - AF_DLI = 0xd - AF_E164 = 0x1c - AF_ECMA = 0x8 - AF_HYLINK = 0xf - AF_IEEE80211 = 0x25 - AF_IMPLINK = 0x3 - AF_INET = 0x2 - AF_INET6 = 0x1e - AF_IPX = 0x17 - AF_ISDN = 0x1c - AF_ISO = 0x7 - AF_LAT = 0xe - AF_LINK = 0x12 - AF_LOCAL = 0x1 - AF_MAX = 0x29 - AF_NATM = 0x1f - AF_NDRV = 0x1b - AF_NETBIOS = 0x21 - AF_NS = 0x6 - AF_OSI = 0x7 - AF_PPP = 0x22 - AF_PUP = 0x4 - AF_RESERVED_36 = 0x24 - AF_ROUTE = 0x11 - AF_SIP = 0x18 - AF_SNA = 0xb - AF_SYSTEM = 0x20 - AF_SYS_CONTROL = 0x2 - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - AF_UTUN = 0x26 - AF_VSOCK = 0x28 - ALTWERASE = 0x200 - ATTR_BIT_MAP_COUNT = 0x5 - ATTR_CMN_ACCESSMASK = 0x20000 - ATTR_CMN_ACCTIME = 0x1000 - ATTR_CMN_ADDEDTIME = 0x10000000 - ATTR_CMN_BKUPTIME = 0x2000 - ATTR_CMN_CHGTIME = 0x800 - ATTR_CMN_CRTIME = 0x200 - ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 - ATTR_CMN_DEVID = 0x2 - ATTR_CMN_DOCUMENT_ID = 0x100000 - ATTR_CMN_ERROR = 0x20000000 - ATTR_CMN_EXTENDED_SECURITY = 0x400000 - ATTR_CMN_FILEID = 0x2000000 - ATTR_CMN_FLAGS = 0x40000 - ATTR_CMN_FNDRINFO = 0x4000 - ATTR_CMN_FSID = 0x4 - ATTR_CMN_FULLPATH = 0x8000000 - ATTR_CMN_GEN_COUNT = 0x80000 - ATTR_CMN_GRPID = 0x10000 - ATTR_CMN_GRPUUID = 0x1000000 - ATTR_CMN_MODTIME = 0x400 - ATTR_CMN_NAME = 0x1 - ATTR_CMN_NAMEDATTRCOUNT = 0x80000 - ATTR_CMN_NAMEDATTRLIST = 0x100000 - ATTR_CMN_OBJID = 0x20 - ATTR_CMN_OBJPERMANENTID = 0x40 - ATTR_CMN_OBJTAG = 0x10 - ATTR_CMN_OBJTYPE = 0x8 - ATTR_CMN_OWNERID = 0x8000 - ATTR_CMN_PARENTID = 0x4000000 - ATTR_CMN_PAROBJID = 0x80 - ATTR_CMN_RETURNED_ATTRS = 0x80000000 - ATTR_CMN_SCRIPT = 0x100 - ATTR_CMN_SETMASK = 0x51c7ff00 - ATTR_CMN_USERACCESS = 0x200000 - ATTR_CMN_UUID = 0x800000 - ATTR_CMN_VALIDMASK = 0xffffffff - ATTR_CMN_VOLSETMASK = 0x6700 - ATTR_FILE_ALLOCSIZE = 0x4 - ATTR_FILE_CLUMPSIZE = 0x10 - ATTR_FILE_DATAALLOCSIZE = 0x400 - ATTR_FILE_DATAEXTENTS = 0x800 - ATTR_FILE_DATALENGTH = 0x200 - ATTR_FILE_DEVTYPE = 0x20 - ATTR_FILE_FILETYPE = 0x40 - ATTR_FILE_FORKCOUNT = 0x80 - ATTR_FILE_FORKLIST = 0x100 - ATTR_FILE_IOBLOCKSIZE = 0x8 - ATTR_FILE_LINKCOUNT = 0x1 - ATTR_FILE_RSRCALLOCSIZE = 0x2000 - ATTR_FILE_RSRCEXTENTS = 0x4000 - ATTR_FILE_RSRCLENGTH = 0x1000 - ATTR_FILE_SETMASK = 0x20 - ATTR_FILE_TOTALSIZE = 0x2 - ATTR_FILE_VALIDMASK = 0x37ff - ATTR_VOL_ALLOCATIONCLUMP = 0x40 - ATTR_VOL_ATTRIBUTES = 0x40000000 - ATTR_VOL_CAPABILITIES = 0x20000 - ATTR_VOL_DIRCOUNT = 0x400 - ATTR_VOL_ENCODINGSUSED = 0x10000 - ATTR_VOL_FILECOUNT = 0x200 - ATTR_VOL_FSTYPE = 0x1 - ATTR_VOL_INFO = 0x80000000 - ATTR_VOL_IOBLOCKSIZE = 0x80 - ATTR_VOL_MAXOBJCOUNT = 0x800 - ATTR_VOL_MINALLOCATION = 0x20 - ATTR_VOL_MOUNTEDDEVICE = 0x8000 - ATTR_VOL_MOUNTFLAGS = 0x4000 - ATTR_VOL_MOUNTPOINT = 0x1000 - ATTR_VOL_NAME = 0x2000 - ATTR_VOL_OBJCOUNT = 0x100 - ATTR_VOL_QUOTA_SIZE = 0x10000000 - ATTR_VOL_RESERVED_SIZE = 0x20000000 - ATTR_VOL_SETMASK = 0x80002000 - ATTR_VOL_SIGNATURE = 0x2 - ATTR_VOL_SIZE = 0x4 - ATTR_VOL_SPACEAVAIL = 0x10 - ATTR_VOL_SPACEFREE = 0x8 - ATTR_VOL_UUID = 0x40000 - ATTR_VOL_VALIDMASK = 0xf007ffff - B0 = 0x0 - B110 = 0x6e - B115200 = 0x1c200 - B1200 = 0x4b0 - B134 = 0x86 - B14400 = 0x3840 - B150 = 0x96 - B1800 = 0x708 - B19200 = 0x4b00 - B200 = 0xc8 - B230400 = 0x38400 - B2400 = 0x960 - B28800 = 0x7080 - B300 = 0x12c - B38400 = 0x9600 - B4800 = 0x12c0 - B50 = 0x32 - B57600 = 0xe100 - B600 = 0x258 - B7200 = 0x1c20 - B75 = 0x4b - B76800 = 0x12c00 - B9600 = 0x2580 - BIOCFLUSH = 0x20004268 - BIOCGBLEN = 0x40044266 - BIOCGDLT = 0x4004426a - BIOCGDLTLIST = 0xc00c4279 - BIOCGETIF = 0x4020426b - BIOCGHDRCMPLT = 0x40044274 - BIOCGRSIG = 0x40044272 - BIOCGRTIMEOUT = 0x4010426e - BIOCGSEESENT = 0x40044276 - BIOCGSTATS = 0x4008426f - BIOCIMMEDIATE = 0x80044270 - BIOCPROMISC = 0x20004269 - BIOCSBLEN = 0xc0044266 - BIOCSDLT = 0x80044278 - BIOCSETF = 0x80104267 - BIOCSETFNR = 0x8010427e - BIOCSETIF = 0x8020426c - BIOCSHDRCMPLT = 0x80044275 - BIOCSRSIG = 0x80044273 - BIOCSRTIMEOUT = 0x8010426d - BIOCSSEESENT = 0x80044277 - BIOCVERSION = 0x40044271 - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALIGNMENT = 0x4 - BPF_ALU = 0x4 - BPF_AND = 0x50 - BPF_B = 0x10 - BPF_DIV = 0x30 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JMP = 0x5 - BPF_JSET = 0x40 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXBUFSIZE = 0x80000 - BPF_MAXINSNS = 0x200 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINBUFSIZE = 0x20 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_OR = 0x40 - BPF_RELEASE = 0x30bb6 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAX = 0x0 - BPF_TXA = 0x80 - BPF_W = 0x0 - BPF_X = 0x8 - BRKINT = 0x2 - BS0 = 0x0 - BS1 = 0x8000 - BSDLY = 0x8000 - CFLUSH = 0xf - CLOCAL = 0x8000 - CLOCK_MONOTONIC = 0x6 - CLOCK_MONOTONIC_RAW = 0x4 - CLOCK_MONOTONIC_RAW_APPROX = 0x5 - CLOCK_PROCESS_CPUTIME_ID = 0xc - CLOCK_REALTIME = 0x0 - CLOCK_THREAD_CPUTIME_ID = 0x10 - CLOCK_UPTIME_RAW = 0x8 - CLOCK_UPTIME_RAW_APPROX = 0x9 - CLONE_NOFOLLOW = 0x1 - CLONE_NOOWNERCOPY = 0x2 - CR0 = 0x0 - CR1 = 0x1000 - CR2 = 0x2000 - CR3 = 0x3000 - CRDLY = 0x3000 - CREAD = 0x800 - CRTSCTS = 0x30000 - CS5 = 0x0 - CS6 = 0x100 - CS7 = 0x200 - CS8 = 0x300 - CSIZE = 0x300 - CSTART = 0x11 - CSTATUS = 0x14 - CSTOP = 0x13 - CSTOPB = 0x400 - CSUSP = 0x1a - CTLIOCGINFO = 0xc0644e03 - CTL_HW = 0x6 - CTL_KERN = 0x1 - CTL_MAXNAME = 0xc - CTL_NET = 0x4 - DLT_A429 = 0xb8 - DLT_A653_ICM = 0xb9 - DLT_AIRONET_HEADER = 0x78 - DLT_AOS = 0xde - DLT_APPLE_IP_OVER_IEEE1394 = 0x8a - DLT_ARCNET = 0x7 - DLT_ARCNET_LINUX = 0x81 - DLT_ATM_CLIP = 0x13 - DLT_ATM_RFC1483 = 0xb - DLT_AURORA = 0x7e - DLT_AX25 = 0x3 - DLT_AX25_KISS = 0xca - DLT_BACNET_MS_TP = 0xa5 - DLT_BLUETOOTH_HCI_H4 = 0xbb - DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 - DLT_CAN20B = 0xbe - DLT_CAN_SOCKETCAN = 0xe3 - DLT_CHAOS = 0x5 - DLT_CHDLC = 0x68 - DLT_CISCO_IOS = 0x76 - DLT_C_HDLC = 0x68 - DLT_C_HDLC_WITH_DIR = 0xcd - DLT_DBUS = 0xe7 - DLT_DECT = 0xdd - DLT_DOCSIS = 0x8f - DLT_DVB_CI = 0xeb - DLT_ECONET = 0x73 - DLT_EN10MB = 0x1 - DLT_EN3MB = 0x2 - DLT_ENC = 0x6d - DLT_ERF = 0xc5 - DLT_ERF_ETH = 0xaf - DLT_ERF_POS = 0xb0 - DLT_FC_2 = 0xe0 - DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 - DLT_FDDI = 0xa - DLT_FLEXRAY = 0xd2 - DLT_FRELAY = 0x6b - DLT_FRELAY_WITH_DIR = 0xce - DLT_GCOM_SERIAL = 0xad - DLT_GCOM_T1E1 = 0xac - DLT_GPF_F = 0xab - DLT_GPF_T = 0xaa - DLT_GPRS_LLC = 0xa9 - DLT_GSMTAP_ABIS = 0xda - DLT_GSMTAP_UM = 0xd9 - DLT_HHDLC = 0x79 - DLT_IBM_SN = 0x92 - DLT_IBM_SP = 0x91 - DLT_IEEE802 = 0x6 - DLT_IEEE802_11 = 0x69 - DLT_IEEE802_11_RADIO = 0x7f - DLT_IEEE802_11_RADIO_AVS = 0xa3 - DLT_IEEE802_15_4 = 0xc3 - DLT_IEEE802_15_4_LINUX = 0xbf - DLT_IEEE802_15_4_NOFCS = 0xe6 - DLT_IEEE802_15_4_NONASK_PHY = 0xd7 - DLT_IEEE802_16_MAC_CPS = 0xbc - DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 - DLT_IPFILTER = 0x74 - DLT_IPMB = 0xc7 - DLT_IPMB_LINUX = 0xd1 - DLT_IPNET = 0xe2 - DLT_IPOIB = 0xf2 - DLT_IPV4 = 0xe4 - DLT_IPV6 = 0xe5 - DLT_IP_OVER_FC = 0x7a - DLT_JUNIPER_ATM1 = 0x89 - DLT_JUNIPER_ATM2 = 0x87 - DLT_JUNIPER_ATM_CEMIC = 0xee - DLT_JUNIPER_CHDLC = 0xb5 - DLT_JUNIPER_ES = 0x84 - DLT_JUNIPER_ETHER = 0xb2 - DLT_JUNIPER_FIBRECHANNEL = 0xea - DLT_JUNIPER_FRELAY = 0xb4 - DLT_JUNIPER_GGSN = 0x85 - DLT_JUNIPER_ISM = 0xc2 - DLT_JUNIPER_MFR = 0x86 - DLT_JUNIPER_MLFR = 0x83 - DLT_JUNIPER_MLPPP = 0x82 - DLT_JUNIPER_MONITOR = 0xa4 - DLT_JUNIPER_PIC_PEER = 0xae - DLT_JUNIPER_PPP = 0xb3 - DLT_JUNIPER_PPPOE = 0xa7 - DLT_JUNIPER_PPPOE_ATM = 0xa8 - DLT_JUNIPER_SERVICES = 0x88 - DLT_JUNIPER_SRX_E2E = 0xe9 - DLT_JUNIPER_ST = 0xc8 - DLT_JUNIPER_VP = 0xb7 - DLT_JUNIPER_VS = 0xe8 - DLT_LAPB_WITH_DIR = 0xcf - DLT_LAPD = 0xcb - DLT_LIN = 0xd4 - DLT_LINUX_EVDEV = 0xd8 - DLT_LINUX_IRDA = 0x90 - DLT_LINUX_LAPD = 0xb1 - DLT_LINUX_PPP_WITHDIRECTION = 0xa6 - DLT_LINUX_SLL = 0x71 - DLT_LOOP = 0x6c - DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0x10a - DLT_MATCHING_MIN = 0x68 - DLT_MFR = 0xb6 - DLT_MOST = 0xd3 - DLT_MPEG_2_TS = 0xf3 - DLT_MPLS = 0xdb - DLT_MTP2 = 0x8c - DLT_MTP2_WITH_PHDR = 0x8b - DLT_MTP3 = 0x8d - DLT_MUX27010 = 0xec - DLT_NETANALYZER = 0xf0 - DLT_NETANALYZER_TRANSPARENT = 0xf1 - DLT_NFC_LLCP = 0xf5 - DLT_NFLOG = 0xef - DLT_NG40 = 0xf4 - DLT_NULL = 0x0 - DLT_PCI_EXP = 0x7d - DLT_PFLOG = 0x75 - DLT_PFSYNC = 0x12 - DLT_PPI = 0xc0 - DLT_PPP = 0x9 - DLT_PPP_BSDOS = 0x10 - DLT_PPP_ETHER = 0x33 - DLT_PPP_PPPD = 0xa6 - DLT_PPP_SERIAL = 0x32 - DLT_PPP_WITH_DIR = 0xcc - DLT_PPP_WITH_DIRECTION = 0xa6 - DLT_PRISM_HEADER = 0x77 - DLT_PRONET = 0x4 - DLT_RAIF1 = 0xc6 - DLT_RAW = 0xc - DLT_RIO = 0x7c - DLT_SCCP = 0x8e - DLT_SITA = 0xc4 - DLT_SLIP = 0x8 - DLT_SLIP_BSDOS = 0xf - DLT_STANAG_5066_D_PDU = 0xed - DLT_SUNATM = 0x7b - DLT_SYMANTEC_FIREWALL = 0x63 - DLT_TZSP = 0x80 - DLT_USB = 0xba - DLT_USB_DARWIN = 0x10a - DLT_USB_LINUX = 0xbd - DLT_USB_LINUX_MMAPPED = 0xdc - DLT_USER0 = 0x93 - DLT_USER1 = 0x94 - DLT_USER10 = 0x9d - DLT_USER11 = 0x9e - DLT_USER12 = 0x9f - DLT_USER13 = 0xa0 - DLT_USER14 = 0xa1 - DLT_USER15 = 0xa2 - DLT_USER2 = 0x95 - DLT_USER3 = 0x96 - DLT_USER4 = 0x97 - DLT_USER5 = 0x98 - DLT_USER6 = 0x99 - DLT_USER7 = 0x9a - DLT_USER8 = 0x9b - DLT_USER9 = 0x9c - DLT_WIHART = 0xdf - DLT_X2E_SERIAL = 0xd5 - DLT_X2E_XORAYA = 0xd6 - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x40 - ECHOE = 0x2 - ECHOK = 0x4 - ECHOKE = 0x1 - ECHONL = 0x10 - ECHOPRT = 0x20 - EVFILT_AIO = -0x3 - EVFILT_EXCEPT = -0xf - EVFILT_FS = -0x9 - EVFILT_MACHPORT = -0x8 - EVFILT_PROC = -0x5 - EVFILT_READ = -0x1 - EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0x11 - EVFILT_THREADMARKER = 0x11 - EVFILT_TIMER = -0x7 - EVFILT_USER = -0xa - EVFILT_VM = -0xc - EVFILT_VNODE = -0x4 - EVFILT_WRITE = -0x2 - EV_ADD = 0x1 - EV_CLEAR = 0x20 - EV_DELETE = 0x2 - EV_DISABLE = 0x8 - EV_DISPATCH = 0x80 - EV_DISPATCH2 = 0x180 - EV_ENABLE = 0x4 - EV_EOF = 0x8000 - EV_ERROR = 0x4000 - EV_FLAG0 = 0x1000 - EV_FLAG1 = 0x2000 - EV_ONESHOT = 0x10 - EV_OOBAND = 0x2000 - EV_POLL = 0x1000 - EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 - EV_UDATA_SPECIFIC = 0x100 - EV_VANISHED = 0x200 - EXTA = 0x4b00 - EXTB = 0x9600 - EXTPROC = 0x800 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x400 - FF0 = 0x0 - FF1 = 0x4000 - FFDLY = 0x4000 - FLUSHO = 0x800000 - FSOPT_ATTR_CMN_EXTENDED = 0x20 - FSOPT_NOFOLLOW = 0x1 - FSOPT_NOINMEMUPDATE = 0x2 - FSOPT_PACK_INVAL_ATTRS = 0x8 - FSOPT_REPORT_FULLSIZE = 0x4 - FSOPT_RETURN_REALDEV = 0x200 - F_ADDFILESIGS = 0x3d - F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 - F_ADDFILESIGS_INFO = 0x67 - F_ADDFILESIGS_RETURN = 0x61 - F_ADDFILESUPPL = 0x68 - F_ADDSIGS = 0x3b - F_ALLOCATEALL = 0x4 - F_ALLOCATECONTIG = 0x2 - F_BARRIERFSYNC = 0x55 - F_CHECK_LV = 0x62 - F_CHKCLEAN = 0x29 - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0x43 - F_FINDSIGS = 0x4e - F_FLUSH_DATA = 0x28 - F_FREEZE_FS = 0x35 - F_FULLFSYNC = 0x33 - F_GETCODEDIR = 0x48 - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLK = 0x7 - F_GETLKPID = 0x42 - F_GETNOSIGPIPE = 0x4a - F_GETOWN = 0x5 - F_GETPATH = 0x32 - F_GETPATH_MTMINFO = 0x47 - F_GETPATH_NOFIRMLINK = 0x66 - F_GETPROTECTIONCLASS = 0x3f - F_GETPROTECTIONLEVEL = 0x4d - F_GETSIGSINFO = 0x69 - F_GLOBAL_NOCACHE = 0x37 - F_LOG2PHYS = 0x31 - F_LOG2PHYS_EXT = 0x41 - F_NOCACHE = 0x30 - F_NODIRECT = 0x3e - F_OK = 0x0 - F_PATHPKG_CHECK = 0x34 - F_PEOFPOSMODE = 0x3 - F_PREALLOCATE = 0x2a - F_PUNCHHOLE = 0x63 - F_RDADVISE = 0x2c - F_RDAHEAD = 0x2d - F_RDLCK = 0x1 - F_SETBACKINGSTORE = 0x46 - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLK = 0x8 - F_SETLKW = 0x9 - F_SETLKWTIMEOUT = 0xa - F_SETNOSIGPIPE = 0x49 - F_SETOWN = 0x6 - F_SETPROTECTIONCLASS = 0x40 - F_SETSIZE = 0x2b - F_SINGLE_WRITER = 0x4c - F_SPECULATIVE_READ = 0x65 - F_THAW_FS = 0x36 - F_TRANSCODEKEY = 0x4b - F_TRIM_ACTIVE_FILE = 0x64 - F_UNLCK = 0x2 - F_VOLPOSMODE = 0x4 - F_WRLCK = 0x3 - HUPCL = 0x4000 - HW_MACHINE = 0x1 - ICANON = 0x100 - ICMP6_FILTER = 0x12 - ICRNL = 0x100 - IEXTEN = 0x400 - IFF_ALLMULTI = 0x200 - IFF_ALTPHYS = 0x4000 - IFF_BROADCAST = 0x2 - IFF_DEBUG = 0x4 - IFF_LINK0 = 0x1000 - IFF_LINK1 = 0x2000 - IFF_LINK2 = 0x4000 - IFF_LOOPBACK = 0x8 - IFF_MULTICAST = 0x8000 - IFF_NOARP = 0x80 - IFF_NOTRAILERS = 0x20 - IFF_OACTIVE = 0x400 - IFF_POINTOPOINT = 0x10 - IFF_PROMISC = 0x100 - IFF_RUNNING = 0x40 - IFF_SIMPLEX = 0x800 - IFF_UP = 0x1 - IFNAMSIZ = 0x10 - IFT_1822 = 0x2 - IFT_6LOWPAN = 0x40 - IFT_AAL5 = 0x31 - IFT_ARCNET = 0x23 - IFT_ARCNETPLUS = 0x24 - IFT_ATM = 0x25 - IFT_BRIDGE = 0xd1 - IFT_CARP = 0xf8 - IFT_CELLULAR = 0xff - IFT_CEPT = 0x13 - IFT_DS3 = 0x1e - IFT_ENC = 0xf4 - IFT_EON = 0x19 - IFT_ETHER = 0x6 - IFT_FAITH = 0x38 - IFT_FDDI = 0xf - IFT_FRELAY = 0x20 - IFT_FRELAYDCE = 0x2c - IFT_GIF = 0x37 - IFT_HDH1822 = 0x3 - IFT_HIPPI = 0x2f - IFT_HSSI = 0x2e - IFT_HY = 0xe - IFT_IEEE1394 = 0x90 - IFT_IEEE8023ADLAG = 0x88 - IFT_ISDNBASIC = 0x14 - IFT_ISDNPRIMARY = 0x15 - IFT_ISO88022LLC = 0x29 - IFT_ISO88023 = 0x7 - IFT_ISO88024 = 0x8 - IFT_ISO88025 = 0x9 - IFT_ISO88026 = 0xa - IFT_L2VLAN = 0x87 - IFT_LAPB = 0x10 - IFT_LOCALTALK = 0x2a - IFT_LOOP = 0x18 - IFT_MIOX25 = 0x26 - IFT_MODEM = 0x30 - IFT_NSIP = 0x1b - IFT_OTHER = 0x1 - IFT_P10 = 0xc - IFT_P80 = 0xd - IFT_PARA = 0x22 - IFT_PDP = 0xff - IFT_PFLOG = 0xf5 - IFT_PFSYNC = 0xf6 - IFT_PKTAP = 0xfe - IFT_PPP = 0x17 - IFT_PROPMUX = 0x36 - IFT_PROPVIRTUAL = 0x35 - IFT_PTPSERIAL = 0x16 - IFT_RS232 = 0x21 - IFT_SDLC = 0x11 - IFT_SIP = 0x1f - IFT_SLIP = 0x1c - IFT_SMDSDXI = 0x2b - IFT_SMDSICIP = 0x34 - IFT_SONET = 0x27 - IFT_SONETPATH = 0x32 - IFT_SONETVT = 0x33 - IFT_STARLAN = 0xb - IFT_STF = 0x39 - IFT_T1 = 0x12 - IFT_ULTRA = 0x1d - IFT_V35 = 0x2d - IFT_X25 = 0x5 - IFT_X25DDN = 0x4 - IFT_X25PLE = 0x28 - IFT_XETHER = 0x1a - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLASSD_HOST = 0xfffffff - IN_CLASSD_NET = 0xf0000000 - IN_CLASSD_NSHIFT = 0x1c - IN_LINKLOCALNETNUM = 0xa9fe0000 - IN_LOOPBACKNET = 0x7f - IPPROTO_3PC = 0x22 - IPPROTO_ADFS = 0x44 - IPPROTO_AH = 0x33 - IPPROTO_AHIP = 0x3d - IPPROTO_APES = 0x63 - IPPROTO_ARGUS = 0xd - IPPROTO_AX25 = 0x5d - IPPROTO_BHA = 0x31 - IPPROTO_BLT = 0x1e - IPPROTO_BRSATMON = 0x4c - IPPROTO_CFTP = 0x3e - IPPROTO_CHAOS = 0x10 - IPPROTO_CMTP = 0x26 - IPPROTO_CPHB = 0x49 - IPPROTO_CPNX = 0x48 - IPPROTO_DDP = 0x25 - IPPROTO_DGP = 0x56 - IPPROTO_DIVERT = 0xfe - IPPROTO_DONE = 0x101 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_EMCON = 0xe - IPPROTO_ENCAP = 0x62 - IPPROTO_EON = 0x50 - IPPROTO_ESP = 0x32 - IPPROTO_ETHERIP = 0x61 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GGP = 0x3 - IPPROTO_GMTP = 0x64 - IPPROTO_GRE = 0x2f - IPPROTO_HELLO = 0x3f - IPPROTO_HMP = 0x14 - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IDPR = 0x23 - IPPROTO_IDRP = 0x2d - IPPROTO_IGMP = 0x2 - IPPROTO_IGP = 0x55 - IPPROTO_IGRP = 0x58 - IPPROTO_IL = 0x28 - IPPROTO_INLSP = 0x34 - IPPROTO_INP = 0x20 - IPPROTO_IP = 0x0 - IPPROTO_IPCOMP = 0x6c - IPPROTO_IPCV = 0x47 - IPPROTO_IPEIP = 0x5e - IPPROTO_IPIP = 0x4 - IPPROTO_IPPC = 0x43 - IPPROTO_IPV4 = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_IRTP = 0x1c - IPPROTO_KRYPTOLAN = 0x41 - IPPROTO_LARP = 0x5b - IPPROTO_LEAF1 = 0x19 - IPPROTO_LEAF2 = 0x1a - IPPROTO_MAX = 0x100 - IPPROTO_MAXID = 0x34 - IPPROTO_MEAS = 0x13 - IPPROTO_MHRP = 0x30 - IPPROTO_MICP = 0x5f - IPPROTO_MTP = 0x5c - IPPROTO_MUX = 0x12 - IPPROTO_ND = 0x4d - IPPROTO_NHRP = 0x36 - IPPROTO_NONE = 0x3b - IPPROTO_NSP = 0x1f - IPPROTO_NVPII = 0xb - IPPROTO_OSPFIGP = 0x59 - IPPROTO_PGM = 0x71 - IPPROTO_PIGP = 0x9 - IPPROTO_PIM = 0x67 - IPPROTO_PRM = 0x15 - IPPROTO_PUP = 0xc - IPPROTO_PVP = 0x4b - IPPROTO_RAW = 0xff - IPPROTO_RCCMON = 0xa - IPPROTO_RDP = 0x1b - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_RVD = 0x42 - IPPROTO_SATEXPAK = 0x40 - IPPROTO_SATMON = 0x45 - IPPROTO_SCCSP = 0x60 - IPPROTO_SCTP = 0x84 - IPPROTO_SDRP = 0x2a - IPPROTO_SEP = 0x21 - IPPROTO_SRPC = 0x5a - IPPROTO_ST = 0x7 - IPPROTO_SVMTP = 0x52 - IPPROTO_SWIPE = 0x35 - IPPROTO_TCF = 0x57 - IPPROTO_TCP = 0x6 - IPPROTO_TP = 0x1d - IPPROTO_TPXX = 0x27 - IPPROTO_TRUNK1 = 0x17 - IPPROTO_TRUNK2 = 0x18 - IPPROTO_TTP = 0x54 - IPPROTO_UDP = 0x11 - IPPROTO_VINES = 0x53 - IPPROTO_VISA = 0x46 - IPPROTO_VMTP = 0x51 - IPPROTO_WBEXPAK = 0x4f - IPPROTO_WBMON = 0x4e - IPPROTO_WSN = 0x4a - IPPROTO_XNET = 0xf - IPPROTO_XTP = 0x24 - IPV6_2292DSTOPTS = 0x17 - IPV6_2292HOPLIMIT = 0x14 - IPV6_2292HOPOPTS = 0x16 - IPV6_2292NEXTHOP = 0x15 - IPV6_2292PKTINFO = 0x13 - IPV6_2292PKTOPTIONS = 0x19 - IPV6_2292RTHDR = 0x18 - IPV6_3542DSTOPTS = 0x32 - IPV6_3542HOPLIMIT = 0x2f - IPV6_3542HOPOPTS = 0x31 - IPV6_3542NEXTHOP = 0x30 - IPV6_3542PKTINFO = 0x2e - IPV6_3542RTHDR = 0x33 - IPV6_ADDR_MC_FLAGS_PREFIX = 0x20 - IPV6_ADDR_MC_FLAGS_TRANSIENT = 0x10 - IPV6_ADDR_MC_FLAGS_UNICAST_BASED = 0x30 - IPV6_AUTOFLOWLABEL = 0x3b - IPV6_BINDV6ONLY = 0x1b - IPV6_BOUND_IF = 0x7d - IPV6_CHECKSUM = 0x1a - IPV6_DEFAULT_MULTICAST_HOPS = 0x1 - IPV6_DEFAULT_MULTICAST_LOOP = 0x1 - IPV6_DEFHLIM = 0x40 - IPV6_DONTFRAG = 0x3e - IPV6_DSTOPTS = 0x32 - IPV6_FAITH = 0x1d - IPV6_FLOWINFO_MASK = 0xffffff0f - IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FLOW_ECN_MASK = 0x3000 - IPV6_FRAGTTL = 0x3c - IPV6_FW_ADD = 0x1e - IPV6_FW_DEL = 0x1f - IPV6_FW_FLUSH = 0x20 - IPV6_FW_GET = 0x22 - IPV6_FW_ZERO = 0x21 - IPV6_HLIMDEC = 0x1 - IPV6_HOPLIMIT = 0x2f - IPV6_HOPOPTS = 0x31 - IPV6_IPSEC_POLICY = 0x1c - IPV6_JOIN_GROUP = 0xc - IPV6_LEAVE_GROUP = 0xd - IPV6_MAXHLIM = 0xff - IPV6_MAXOPTHDR = 0x800 - IPV6_MAXPACKET = 0xffff - IPV6_MAX_GROUP_SRC_FILTER = 0x200 - IPV6_MAX_MEMBERSHIPS = 0xfff - IPV6_MAX_SOCK_SRC_FILTER = 0x80 - IPV6_MIN_MEMBERSHIPS = 0x1f - IPV6_MMTU = 0x500 - IPV6_MSFILTER = 0x4a - IPV6_MULTICAST_HOPS = 0xa - IPV6_MULTICAST_IF = 0x9 - IPV6_MULTICAST_LOOP = 0xb - IPV6_NEXTHOP = 0x30 - IPV6_PATHMTU = 0x2c - IPV6_PKTINFO = 0x2e - IPV6_PORTRANGE = 0xe - IPV6_PORTRANGE_DEFAULT = 0x0 - IPV6_PORTRANGE_HIGH = 0x1 - IPV6_PORTRANGE_LOW = 0x2 - IPV6_PREFER_TEMPADDR = 0x3f - IPV6_RECVDSTOPTS = 0x28 - IPV6_RECVHOPLIMIT = 0x25 - IPV6_RECVHOPOPTS = 0x27 - IPV6_RECVPATHMTU = 0x2b - IPV6_RECVPKTINFO = 0x3d - IPV6_RECVRTHDR = 0x26 - IPV6_RECVTCLASS = 0x23 - IPV6_RTHDR = 0x33 - IPV6_RTHDRDSTOPTS = 0x39 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_SOCKOPT_RESERVED1 = 0x3 - IPV6_TCLASS = 0x24 - IPV6_UNICAST_HOPS = 0x4 - IPV6_USE_MIN_MTU = 0x2a - IPV6_V6ONLY = 0x1b - IPV6_VERSION = 0x60 - IPV6_VERSION_MASK = 0xf0 - IP_ADD_MEMBERSHIP = 0xc - IP_ADD_SOURCE_MEMBERSHIP = 0x46 - IP_BLOCK_SOURCE = 0x48 - IP_BOUND_IF = 0x19 - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DONTFRAG = 0x1c - IP_DROP_MEMBERSHIP = 0xd - IP_DROP_SOURCE_MEMBERSHIP = 0x47 - IP_DUMMYNET_CONFIGURE = 0x3c - IP_DUMMYNET_DEL = 0x3d - IP_DUMMYNET_FLUSH = 0x3e - IP_DUMMYNET_GET = 0x40 - IP_FAITH = 0x16 - IP_FW_ADD = 0x28 - IP_FW_DEL = 0x29 - IP_FW_FLUSH = 0x2a - IP_FW_GET = 0x2c - IP_FW_RESETLOG = 0x2d - IP_FW_ZERO = 0x2b - IP_HDRINCL = 0x2 - IP_IPSEC_POLICY = 0x15 - IP_MAXPACKET = 0xffff - IP_MAX_GROUP_SRC_FILTER = 0x200 - IP_MAX_MEMBERSHIPS = 0xfff - IP_MAX_SOCK_MUTE_FILTER = 0x80 - IP_MAX_SOCK_SRC_FILTER = 0x80 - IP_MF = 0x2000 - IP_MIN_MEMBERSHIPS = 0x1f - IP_MSFILTER = 0x4a - IP_MSS = 0x240 - IP_MULTICAST_IF = 0x9 - IP_MULTICAST_IFINDEX = 0x42 - IP_MULTICAST_LOOP = 0xb - IP_MULTICAST_TTL = 0xa - IP_MULTICAST_VIF = 0xe - IP_NAT__XXX = 0x37 - IP_OFFMASK = 0x1fff - IP_OLD_FW_ADD = 0x32 - IP_OLD_FW_DEL = 0x33 - IP_OLD_FW_FLUSH = 0x34 - IP_OLD_FW_GET = 0x36 - IP_OLD_FW_RESETLOG = 0x38 - IP_OLD_FW_ZERO = 0x35 - IP_OPTIONS = 0x1 - IP_PKTINFO = 0x1a - IP_PORTRANGE = 0x13 - IP_PORTRANGE_DEFAULT = 0x0 - IP_PORTRANGE_HIGH = 0x1 - IP_PORTRANGE_LOW = 0x2 - IP_RECVDSTADDR = 0x7 - IP_RECVIF = 0x14 - IP_RECVOPTS = 0x5 - IP_RECVPKTINFO = 0x1a - IP_RECVRETOPTS = 0x6 - IP_RECVTOS = 0x1b - IP_RECVTTL = 0x18 - IP_RETOPTS = 0x8 - IP_RF = 0x8000 - IP_RSVP_OFF = 0x10 - IP_RSVP_ON = 0xf - IP_RSVP_VIF_OFF = 0x12 - IP_RSVP_VIF_ON = 0x11 - IP_STRIPHDR = 0x17 - IP_TOS = 0x3 - IP_TRAFFIC_MGT_BACKGROUND = 0x41 - IP_TTL = 0x4 - IP_UNBLOCK_SOURCE = 0x49 - ISIG = 0x80 - ISTRIP = 0x20 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x400 - IXON = 0x200 - KERN_HOSTNAME = 0xa - KERN_OSRELEASE = 0x2 - KERN_OSTYPE = 0x1 - KERN_VERSION = 0x4 - LOCAL_PEERCRED = 0x1 - LOCAL_PEEREPID = 0x3 - LOCAL_PEEREUUID = 0x5 - LOCAL_PEERPID = 0x2 - LOCAL_PEERTOKEN = 0x6 - LOCAL_PEERUUID = 0x4 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_CAN_REUSE = 0x9 - MADV_DONTNEED = 0x4 - MADV_FREE = 0x5 - MADV_FREE_REUSABLE = 0x7 - MADV_FREE_REUSE = 0x8 - MADV_NORMAL = 0x0 - MADV_PAGEOUT = 0xa - MADV_RANDOM = 0x1 - MADV_SEQUENTIAL = 0x2 - MADV_WILLNEED = 0x3 - MADV_ZERO_WIRED_PAGES = 0x6 - MAP_32BIT = 0x8000 - MAP_ANON = 0x1000 - MAP_ANONYMOUS = 0x1000 - MAP_COPY = 0x2 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_HASSEMAPHORE = 0x200 - MAP_JIT = 0x800 - MAP_NOCACHE = 0x400 - MAP_NOEXTEND = 0x100 - MAP_NORESERVE = 0x40 - MAP_PRIVATE = 0x2 - MAP_RENAME = 0x20 - MAP_RESERVED0080 = 0x80 - MAP_RESILIENT_CODESIGN = 0x2000 - MAP_RESILIENT_MEDIA = 0x4000 - MAP_SHARED = 0x1 - MAP_TRANSLATED_ALLOW_EXECUTE = 0x20000 - MAP_UNIX03 = 0x40000 - MCAST_BLOCK_SOURCE = 0x54 - MCAST_EXCLUDE = 0x2 - MCAST_INCLUDE = 0x1 - MCAST_JOIN_GROUP = 0x50 - MCAST_JOIN_SOURCE_GROUP = 0x52 - MCAST_LEAVE_GROUP = 0x51 - MCAST_LEAVE_SOURCE_GROUP = 0x53 - MCAST_UNBLOCK_SOURCE = 0x55 - MCAST_UNDEFINED = 0x0 - MCL_CURRENT = 0x1 - MCL_FUTURE = 0x2 - MNT_ASYNC = 0x40 - MNT_AUTOMOUNTED = 0x400000 - MNT_CMDFLAGS = 0xf0000 - MNT_CPROTECT = 0x80 - MNT_DEFWRITE = 0x2000000 - MNT_DONTBROWSE = 0x100000 - MNT_DOVOLFS = 0x8000 - MNT_DWAIT = 0x4 - MNT_EXPORTED = 0x100 - MNT_EXT_ROOT_DATA_VOL = 0x1 - MNT_FORCE = 0x80000 - MNT_IGNORE_OWNERSHIP = 0x200000 - MNT_JOURNALED = 0x800000 - MNT_LOCAL = 0x1000 - MNT_MULTILABEL = 0x4000000 - MNT_NOATIME = 0x10000000 - MNT_NOBLOCK = 0x20000 - MNT_NODEV = 0x10 - MNT_NOEXEC = 0x4 - MNT_NOSUID = 0x8 - MNT_NOUSERXATTR = 0x1000000 - MNT_NOWAIT = 0x2 - MNT_QUARANTINE = 0x400 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELOAD = 0x40000 - MNT_REMOVABLE = 0x200 - MNT_ROOTFS = 0x4000 - MNT_SNAPSHOT = 0x40000000 - MNT_STRICTATIME = 0x80000000 - MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UNKNOWNPERMISSIONS = 0x200000 - MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0xd7f0f7ff - MNT_WAIT = 0x1 - MSG_CTRUNC = 0x20 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x80 - MSG_EOF = 0x100 - MSG_EOR = 0x8 - MSG_FLUSH = 0x400 - MSG_HAVEMORE = 0x2000 - MSG_HOLD = 0x800 - MSG_NEEDSA = 0x10000 - MSG_NOSIGNAL = 0x80000 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_RCVMORE = 0x4000 - MSG_SEND = 0x1000 - MSG_TRUNC = 0x10 - MSG_WAITALL = 0x40 - MSG_WAITSTREAM = 0x200 - MS_ASYNC = 0x1 - MS_DEACTIVATE = 0x8 - MS_INVALIDATE = 0x2 - MS_KILLPAGES = 0x4 - MS_SYNC = 0x10 - NAME_MAX = 0xff - NET_RT_DUMP = 0x1 - NET_RT_DUMP2 = 0x7 - NET_RT_FLAGS = 0x2 - NET_RT_FLAGS_PRIV = 0xa - NET_RT_IFLIST = 0x3 - NET_RT_IFLIST2 = 0x6 - NET_RT_MAXID = 0xb - NET_RT_STAT = 0x4 - NET_RT_TRASH = 0x5 - NFDBITS = 0x20 - NL0 = 0x0 - NL1 = 0x100 - NL2 = 0x200 - NL3 = 0x300 - NLDLY = 0x300 - NOFLSH = 0x80000000 - NOKERNINFO = 0x2000000 - NOTE_ABSOLUTE = 0x8 - NOTE_ATTRIB = 0x8 - NOTE_BACKGROUND = 0x40 - NOTE_CHILD = 0x4 - NOTE_CRITICAL = 0x20 - NOTE_DELETE = 0x1 - NOTE_EXEC = 0x20000000 - NOTE_EXIT = 0x80000000 - NOTE_EXITSTATUS = 0x4000000 - NOTE_EXIT_CSERROR = 0x40000 - NOTE_EXIT_DECRYPTFAIL = 0x10000 - NOTE_EXIT_DETAIL = 0x2000000 - NOTE_EXIT_DETAIL_MASK = 0x70000 - NOTE_EXIT_MEMORY = 0x20000 - NOTE_EXIT_REPARENTED = 0x80000 - NOTE_EXTEND = 0x4 - NOTE_FFAND = 0x40000000 - NOTE_FFCOPY = 0xc0000000 - NOTE_FFCTRLMASK = 0xc0000000 - NOTE_FFLAGSMASK = 0xffffff - NOTE_FFNOP = 0x0 - NOTE_FFOR = 0x80000000 - NOTE_FORK = 0x40000000 - NOTE_FUNLOCK = 0x100 - NOTE_LEEWAY = 0x10 - NOTE_LINK = 0x10 - NOTE_LOWAT = 0x1 - NOTE_MACHTIME = 0x100 - NOTE_MACH_CONTINUOUS_TIME = 0x80 - NOTE_NONE = 0x80 - NOTE_NSECONDS = 0x4 - NOTE_OOB = 0x2 - NOTE_PCTRLMASK = -0x100000 - NOTE_PDATAMASK = 0xfffff - NOTE_REAP = 0x10000000 - NOTE_RENAME = 0x20 - NOTE_REVOKE = 0x40 - NOTE_SECONDS = 0x1 - NOTE_SIGNAL = 0x8000000 - NOTE_TRACK = 0x1 - NOTE_TRACKERR = 0x2 - NOTE_TRIGGER = 0x1000000 - NOTE_USECONDS = 0x2 - NOTE_VM_ERROR = 0x10000000 - NOTE_VM_PRESSURE = 0x80000000 - NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 - NOTE_VM_PRESSURE_TERMINATE = 0x40000000 - NOTE_WRITE = 0x2 - OCRNL = 0x10 - OFDEL = 0x20000 - OFILL = 0x80 - ONLCR = 0x2 - ONLRET = 0x40 - ONOCR = 0x20 - ONOEOT = 0x8 - OPOST = 0x1 - OXTABS = 0x4 - O_ACCMODE = 0x3 - O_ALERT = 0x20000000 - O_APPEND = 0x8 - O_ASYNC = 0x40 - O_CLOEXEC = 0x1000000 - O_CREAT = 0x200 - O_DIRECTORY = 0x100000 - O_DP_GETRAWENCRYPTED = 0x1 - O_DP_GETRAWUNENCRYPTED = 0x2 - O_DSYNC = 0x400000 - O_EVTONLY = 0x8000 - O_EXCL = 0x800 - O_EXLOCK = 0x20 - O_FSYNC = 0x80 - O_NDELAY = 0x4 - O_NOCTTY = 0x20000 - O_NOFOLLOW = 0x100 - O_NOFOLLOW_ANY = 0x20000000 - O_NONBLOCK = 0x4 - O_POPUP = 0x80000000 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_SHLOCK = 0x10 - O_SYMLINK = 0x200000 - O_SYNC = 0x80 - O_TRUNC = 0x400 - O_WRONLY = 0x1 - PARENB = 0x1000 - PARMRK = 0x8 - PARODD = 0x2000 - PENDIN = 0x20000000 - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PROT_EXEC = 0x4 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_WRITE = 0x2 - PT_ATTACH = 0xa - PT_ATTACHEXC = 0xe - PT_CONTINUE = 0x7 - PT_DENY_ATTACH = 0x1f - PT_DETACH = 0xb - PT_FIRSTMACH = 0x20 - PT_FORCEQUOTA = 0x1e - PT_KILL = 0x8 - PT_READ_D = 0x2 - PT_READ_I = 0x1 - PT_READ_U = 0x3 - PT_SIGEXC = 0xc - PT_STEP = 0x9 - PT_THUPDATE = 0xd - PT_TRACE_ME = 0x0 - PT_WRITE_D = 0x5 - PT_WRITE_I = 0x4 - PT_WRITE_U = 0x6 - RLIMIT_AS = 0x5 - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_CPU_USAGE_MONITOR = 0x2 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_MEMLOCK = 0x6 - RLIMIT_NOFILE = 0x8 - RLIMIT_NPROC = 0x7 - RLIMIT_RSS = 0x5 - RLIMIT_STACK = 0x3 - RLIM_INFINITY = 0x7fffffffffffffff - RTAX_AUTHOR = 0x6 - RTAX_BRD = 0x7 - RTAX_DST = 0x0 - RTAX_GATEWAY = 0x1 - RTAX_GENMASK = 0x3 - RTAX_IFA = 0x5 - RTAX_IFP = 0x4 - RTAX_MAX = 0x8 - RTAX_NETMASK = 0x2 - RTA_AUTHOR = 0x40 - RTA_BRD = 0x80 - RTA_DST = 0x1 - RTA_GATEWAY = 0x2 - RTA_GENMASK = 0x8 - RTA_IFA = 0x20 - RTA_IFP = 0x10 - RTA_NETMASK = 0x4 - RTF_BLACKHOLE = 0x1000 - RTF_BROADCAST = 0x400000 - RTF_CLONING = 0x100 - RTF_CONDEMNED = 0x2000000 - RTF_DEAD = 0x20000000 - RTF_DELCLONE = 0x80 - RTF_DONE = 0x40 - RTF_DYNAMIC = 0x10 - RTF_GATEWAY = 0x2 - RTF_HOST = 0x4 - RTF_IFREF = 0x4000000 - RTF_IFSCOPE = 0x1000000 - RTF_LLDATA = 0x400 - RTF_LLINFO = 0x400 - RTF_LOCAL = 0x200000 - RTF_MODIFIED = 0x20 - RTF_MULTICAST = 0x800000 - RTF_NOIFREF = 0x2000 - RTF_PINNED = 0x100000 - RTF_PRCLONING = 0x10000 - RTF_PROTO1 = 0x8000 - RTF_PROTO2 = 0x4000 - RTF_PROTO3 = 0x40000 - RTF_PROXY = 0x8000000 - RTF_REJECT = 0x8 - RTF_ROUTER = 0x10000000 - RTF_STATIC = 0x800 - RTF_UP = 0x1 - RTF_WASCLONED = 0x20000 - RTF_XRESOLVE = 0x200 - RTM_ADD = 0x1 - RTM_CHANGE = 0x3 - RTM_DELADDR = 0xd - RTM_DELETE = 0x2 - RTM_DELMADDR = 0x10 - RTM_GET = 0x4 - RTM_GET2 = 0x14 - RTM_IFINFO = 0xe - RTM_IFINFO2 = 0x12 - RTM_LOCK = 0x8 - RTM_LOSING = 0x5 - RTM_MISS = 0x7 - RTM_NEWADDR = 0xc - RTM_NEWMADDR = 0xf - RTM_NEWMADDR2 = 0x13 - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa - RTM_REDIRECT = 0x6 - RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 - RTM_VERSION = 0x5 - RTV_EXPIRE = 0x4 - RTV_HOPCOUNT = 0x2 - RTV_MTU = 0x1 - RTV_RPIPE = 0x8 - RTV_RTT = 0x40 - RTV_RTTVAR = 0x80 - RTV_SPIPE = 0x10 - RTV_SSTHRESH = 0x20 - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - SCM_CREDS = 0x3 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x2 - SCM_TIMESTAMP_MONOTONIC = 0x4 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDMULTI = 0x80206931 - SIOCAIFADDR = 0x8040691a - SIOCARPIPLL = 0xc0206928 - SIOCATMARK = 0x40047307 - SIOCAUTOADDR = 0xc0206926 - SIOCAUTONETMASK = 0x80206927 - SIOCDELMULTI = 0x80206932 - SIOCDIFADDR = 0x80206919 - SIOCDIFPHYADDR = 0x80206941 - SIOCGDRVSPEC = 0xc028697b - SIOCGETVLAN = 0xc020697f - SIOCGHIWAT = 0x40047301 - SIOCGIF6LOWPAN = 0xc02069c5 - SIOCGIFADDR = 0xc0206921 - SIOCGIFALTMTU = 0xc0206948 - SIOCGIFASYNCMAP = 0xc020697c - SIOCGIFBOND = 0xc0206947 - SIOCGIFBRDADDR = 0xc0206923 - SIOCGIFCAP = 0xc020695b - SIOCGIFCONF = 0xc00c6924 - SIOCGIFDEVMTU = 0xc0206944 - SIOCGIFDSTADDR = 0xc0206922 - SIOCGIFFLAGS = 0xc0206911 - SIOCGIFFUNCTIONALTYPE = 0xc02069ad - SIOCGIFGENERIC = 0xc020693a - SIOCGIFKPI = 0xc0206987 - SIOCGIFMAC = 0xc0206982 - SIOCGIFMEDIA = 0xc02c6938 - SIOCGIFMETRIC = 0xc0206917 - SIOCGIFMTU = 0xc0206933 - SIOCGIFNETMASK = 0xc0206925 - SIOCGIFPDSTADDR = 0xc0206940 - SIOCGIFPHYS = 0xc0206935 - SIOCGIFPSRCADDR = 0xc020693f - SIOCGIFSTATUS = 0xc331693d - SIOCGIFVLAN = 0xc020697f - SIOCGIFWAKEFLAGS = 0xc0206988 - SIOCGIFXMEDIA = 0xc02c6948 - SIOCGLOWAT = 0x40047303 - SIOCGPGRP = 0x40047309 - SIOCIFCREATE = 0xc0206978 - SIOCIFCREATE2 = 0xc020697a - SIOCIFDESTROY = 0x80206979 - SIOCIFGCLONERS = 0xc0106981 - SIOCRSLVMULTI = 0xc010693b - SIOCSDRVSPEC = 0x8028697b - SIOCSETVLAN = 0x8020697e - SIOCSHIWAT = 0x80047300 - SIOCSIF6LOWPAN = 0x802069c4 - SIOCSIFADDR = 0x8020690c - SIOCSIFALTMTU = 0x80206945 - SIOCSIFASYNCMAP = 0x8020697d - SIOCSIFBOND = 0x80206946 - SIOCSIFBRDADDR = 0x80206913 - SIOCSIFCAP = 0x8020695a - SIOCSIFDSTADDR = 0x8020690e - SIOCSIFFLAGS = 0x80206910 - SIOCSIFGENERIC = 0x80206939 - SIOCSIFKPI = 0x80206986 - SIOCSIFLLADDR = 0x8020693c - SIOCSIFMAC = 0x80206983 - SIOCSIFMEDIA = 0xc0206937 - SIOCSIFMETRIC = 0x80206918 - SIOCSIFMTU = 0x80206934 - SIOCSIFNETMASK = 0x80206916 - SIOCSIFPHYADDR = 0x8040693e - SIOCSIFPHYS = 0x80206936 - SIOCSIFVLAN = 0x8020697e - SIOCSLOWAT = 0x80047302 - SIOCSPGRP = 0x80047308 - SOCK_DGRAM = 0x2 - SOCK_MAXADDRLEN = 0xff - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_LOCAL = 0x0 - SOL_SOCKET = 0xffff - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x2 - SO_BROADCAST = 0x20 - SO_DEBUG = 0x1 - SO_DONTROUTE = 0x10 - SO_DONTTRUNC = 0x2000 - SO_ERROR = 0x1007 - SO_KEEPALIVE = 0x8 - SO_LABEL = 0x1010 - SO_LINGER = 0x80 - SO_LINGER_SEC = 0x1080 - SO_NETSVC_MARKING_LEVEL = 0x1119 - SO_NET_SERVICE_TYPE = 0x1116 - SO_NKE = 0x1021 - SO_NOADDRERR = 0x1023 - SO_NOSIGPIPE = 0x1022 - SO_NOTIFYCONFLICT = 0x1026 - SO_NP_EXTENSIONS = 0x1083 - SO_NREAD = 0x1020 - SO_NUMRCVPKT = 0x1112 - SO_NWRITE = 0x1024 - SO_OOBINLINE = 0x100 - SO_PEERLABEL = 0x1011 - SO_RANDOMPORT = 0x1082 - SO_RCVBUF = 0x1002 - SO_RCVLOWAT = 0x1004 - SO_RCVTIMEO = 0x1006 - SO_REUSEADDR = 0x4 - SO_REUSEPORT = 0x200 - SO_REUSESHAREUID = 0x1025 - SO_SNDBUF = 0x1001 - SO_SNDLOWAT = 0x1003 - SO_SNDTIMEO = 0x1005 - SO_TIMESTAMP = 0x400 - SO_TIMESTAMP_MONOTONIC = 0x800 - SO_TYPE = 0x1008 - SO_UPCALLCLOSEWAIT = 0x1027 - SO_USELOOPBACK = 0x40 - SO_WANTMORE = 0x4000 - SO_WANTOOBFLAG = 0x8000 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IFWHT = 0xe000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISTXT = 0x200 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - TAB0 = 0x0 - TAB1 = 0x400 - TAB2 = 0x800 - TAB3 = 0x4 - TABDLY = 0xc04 - TCIFLUSH = 0x1 - TCIOFF = 0x3 - TCIOFLUSH = 0x3 - TCION = 0x4 - TCOFLUSH = 0x2 - TCOOFF = 0x1 - TCOON = 0x2 - TCP_CONNECTIONTIMEOUT = 0x20 - TCP_CONNECTION_INFO = 0x106 - TCP_ENABLE_ECN = 0x104 - TCP_FASTOPEN = 0x105 - TCP_KEEPALIVE = 0x10 - TCP_KEEPCNT = 0x102 - TCP_KEEPINTVL = 0x101 - TCP_MAXHLEN = 0x3c - TCP_MAXOLEN = 0x28 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_SACK = 0x4 - TCP_MAX_WINSHIFT = 0xe - TCP_MINMSS = 0xd8 - TCP_MSS = 0x200 - TCP_NODELAY = 0x1 - TCP_NOOPT = 0x8 - TCP_NOPUSH = 0x4 - TCP_NOTSENT_LOWAT = 0x201 - TCP_RXT_CONNDROPTIME = 0x80 - TCP_RXT_FINDROP = 0x100 - TCP_SENDMOREACKS = 0x103 - TCSAFLUSH = 0x2 - TIOCCBRK = 0x2000747a - TIOCCDTR = 0x20007478 - TIOCCONS = 0x80047462 - TIOCDCDTIMESTAMP = 0x40107458 - TIOCDRAIN = 0x2000745e - TIOCDSIMICROCODE = 0x20007455 - TIOCEXCL = 0x2000740d - TIOCEXT = 0x80047460 - TIOCFLUSH = 0x80047410 - TIOCGDRAINWAIT = 0x40047456 - TIOCGETA = 0x40487413 - TIOCGETD = 0x4004741a - TIOCGPGRP = 0x40047477 - TIOCGWINSZ = 0x40087468 - TIOCIXOFF = 0x20007480 - TIOCIXON = 0x20007481 - TIOCMBIC = 0x8004746b - TIOCMBIS = 0x8004746c - TIOCMGDTRWAIT = 0x4004745a - TIOCMGET = 0x4004746a - TIOCMODG = 0x40047403 - TIOCMODS = 0x80047404 - TIOCMSDTRWAIT = 0x8004745b - TIOCMSET = 0x8004746d - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x20007471 - TIOCNXCL = 0x2000740e - TIOCOUTQ = 0x40047473 - TIOCPKT = 0x80047470 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCPTYGNAME = 0x40807453 - TIOCPTYGRANT = 0x20007454 - TIOCPTYUNLK = 0x20007452 - TIOCREMOTE = 0x80047469 - TIOCSBRK = 0x2000747b - TIOCSCONS = 0x20007463 - TIOCSCTTY = 0x20007461 - TIOCSDRAINWAIT = 0x80047457 - TIOCSDTR = 0x20007479 - TIOCSETA = 0x80487414 - TIOCSETAF = 0x80487416 - TIOCSETAW = 0x80487415 - TIOCSETD = 0x8004741b - TIOCSIG = 0x2000745f - TIOCSPGRP = 0x80047476 - TIOCSTART = 0x2000746e - TIOCSTAT = 0x20007465 - TIOCSTI = 0x80017472 - TIOCSTOP = 0x2000746f - TIOCSWINSZ = 0x80087467 - TIOCTIMESTAMP = 0x40107459 - TIOCUCNTL = 0x80047466 - TOSTOP = 0x400000 - VDISCARD = 0xf - VDSUSP = 0xb - VEOF = 0x0 - VEOL = 0x1 - VEOL2 = 0x2 - VERASE = 0x3 - VINTR = 0x8 - VKILL = 0x5 - VLNEXT = 0xe - VMIN = 0x10 - VM_LOADAVG = 0x2 - VM_MACHFACTOR = 0x4 - VM_MAXID = 0x6 - VM_METER = 0x1 - VM_SWAPUSAGE = 0x5 - VQUIT = 0x9 - VREPRINT = 0x6 - VSTART = 0xc - VSTATUS = 0x12 - VSTOP = 0xd - VSUSP = 0xa - VT0 = 0x0 - VT1 = 0x10000 - VTDLY = 0x10000 - VTIME = 0x11 - VWERASE = 0x4 - WCONTINUED = 0x10 - WCOREFLAG = 0x80 - WEXITED = 0x4 - WNOHANG = 0x1 - WNOWAIT = 0x20 - WORDSIZE = 0x40 - WSTOPPED = 0x8 - WUNTRACED = 0x2 - XATTR_CREATE = 0x2 - XATTR_NODEFAULT = 0x10 - XATTR_NOFOLLOW = 0x1 - XATTR_NOSECURITY = 0x8 - XATTR_REPLACE = 0x4 - XATTR_SHOWCOMPRESSION = 0x20 + AF_APPLETALK = 0x10 + AF_CCITT = 0xa + AF_CHAOS = 0x5 + AF_CNT = 0x15 + AF_COIP = 0x14 + AF_DATAKIT = 0x9 + AF_DECnet = 0xc + AF_DLI = 0xd + AF_E164 = 0x1c + AF_ECMA = 0x8 + AF_HYLINK = 0xf + AF_IEEE80211 = 0x25 + AF_IMPLINK = 0x3 + AF_INET = 0x2 + AF_INET6 = 0x1e + AF_IPX = 0x17 + AF_ISDN = 0x1c + AF_ISO = 0x7 + AF_LAT = 0xe + AF_LINK = 0x12 + AF_LOCAL = 0x1 + AF_MAX = 0x29 + AF_NATM = 0x1f + AF_NDRV = 0x1b + AF_NETBIOS = 0x21 + AF_NS = 0x6 + AF_OSI = 0x7 + AF_PPP = 0x22 + AF_PUP = 0x4 + AF_RESERVED_36 = 0x24 + AF_ROUTE = 0x11 + AF_SIP = 0x18 + AF_SNA = 0xb + AF_SYSTEM = 0x20 + AF_SYS_CONTROL = 0x2 + AF_UNIX = 0x1 + AF_UNSPEC = 0x0 + AF_UTUN = 0x26 + AF_VSOCK = 0x28 + ALTWERASE = 0x200 + ATTR_BIT_MAP_COUNT = 0x5 + ATTR_CMN_ACCESSMASK = 0x20000 + ATTR_CMN_ACCTIME = 0x1000 + ATTR_CMN_ADDEDTIME = 0x10000000 + ATTR_CMN_BKUPTIME = 0x2000 + ATTR_CMN_CHGTIME = 0x800 + ATTR_CMN_CRTIME = 0x200 + ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 + ATTR_CMN_DEVID = 0x2 + ATTR_CMN_DOCUMENT_ID = 0x100000 + ATTR_CMN_ERROR = 0x20000000 + ATTR_CMN_EXTENDED_SECURITY = 0x400000 + ATTR_CMN_FILEID = 0x2000000 + ATTR_CMN_FLAGS = 0x40000 + ATTR_CMN_FNDRINFO = 0x4000 + ATTR_CMN_FSID = 0x4 + ATTR_CMN_FULLPATH = 0x8000000 + ATTR_CMN_GEN_COUNT = 0x80000 + ATTR_CMN_GRPID = 0x10000 + ATTR_CMN_GRPUUID = 0x1000000 + ATTR_CMN_MODTIME = 0x400 + ATTR_CMN_NAME = 0x1 + ATTR_CMN_NAMEDATTRCOUNT = 0x80000 + ATTR_CMN_NAMEDATTRLIST = 0x100000 + ATTR_CMN_OBJID = 0x20 + ATTR_CMN_OBJPERMANENTID = 0x40 + ATTR_CMN_OBJTAG = 0x10 + ATTR_CMN_OBJTYPE = 0x8 + ATTR_CMN_OWNERID = 0x8000 + ATTR_CMN_PARENTID = 0x4000000 + ATTR_CMN_PAROBJID = 0x80 + ATTR_CMN_RETURNED_ATTRS = 0x80000000 + ATTR_CMN_SCRIPT = 0x100 + ATTR_CMN_SETMASK = 0x51c7ff00 + ATTR_CMN_USERACCESS = 0x200000 + ATTR_CMN_UUID = 0x800000 + ATTR_CMN_VALIDMASK = 0xffffffff + ATTR_CMN_VOLSETMASK = 0x6700 + ATTR_FILE_ALLOCSIZE = 0x4 + ATTR_FILE_CLUMPSIZE = 0x10 + ATTR_FILE_DATAALLOCSIZE = 0x400 + ATTR_FILE_DATAEXTENTS = 0x800 + ATTR_FILE_DATALENGTH = 0x200 + ATTR_FILE_DEVTYPE = 0x20 + ATTR_FILE_FILETYPE = 0x40 + ATTR_FILE_FORKCOUNT = 0x80 + ATTR_FILE_FORKLIST = 0x100 + ATTR_FILE_IOBLOCKSIZE = 0x8 + ATTR_FILE_LINKCOUNT = 0x1 + ATTR_FILE_RSRCALLOCSIZE = 0x2000 + ATTR_FILE_RSRCEXTENTS = 0x4000 + ATTR_FILE_RSRCLENGTH = 0x1000 + ATTR_FILE_SETMASK = 0x20 + ATTR_FILE_TOTALSIZE = 0x2 + ATTR_FILE_VALIDMASK = 0x37ff + ATTR_VOL_ALLOCATIONCLUMP = 0x40 + ATTR_VOL_ATTRIBUTES = 0x40000000 + ATTR_VOL_CAPABILITIES = 0x20000 + ATTR_VOL_DIRCOUNT = 0x400 + ATTR_VOL_ENCODINGSUSED = 0x10000 + ATTR_VOL_FILECOUNT = 0x200 + ATTR_VOL_FSTYPE = 0x1 + ATTR_VOL_INFO = 0x80000000 + ATTR_VOL_IOBLOCKSIZE = 0x80 + ATTR_VOL_MAXOBJCOUNT = 0x800 + ATTR_VOL_MINALLOCATION = 0x20 + ATTR_VOL_MOUNTEDDEVICE = 0x8000 + ATTR_VOL_MOUNTFLAGS = 0x4000 + ATTR_VOL_MOUNTPOINT = 0x1000 + ATTR_VOL_NAME = 0x2000 + ATTR_VOL_OBJCOUNT = 0x100 + ATTR_VOL_QUOTA_SIZE = 0x10000000 + ATTR_VOL_RESERVED_SIZE = 0x20000000 + ATTR_VOL_SETMASK = 0x80002000 + ATTR_VOL_SIGNATURE = 0x2 + ATTR_VOL_SIZE = 0x4 + ATTR_VOL_SPACEAVAIL = 0x10 + ATTR_VOL_SPACEFREE = 0x8 + ATTR_VOL_SPACEUSED = 0x800000 + ATTR_VOL_UUID = 0x40000 + ATTR_VOL_VALIDMASK = 0xf087ffff + B0 = 0x0 + B110 = 0x6e + B115200 = 0x1c200 + B1200 = 0x4b0 + B134 = 0x86 + B14400 = 0x3840 + B150 = 0x96 + B1800 = 0x708 + B19200 = 0x4b00 + B200 = 0xc8 + B230400 = 0x38400 + B2400 = 0x960 + B28800 = 0x7080 + B300 = 0x12c + B38400 = 0x9600 + B4800 = 0x12c0 + B50 = 0x32 + B57600 = 0xe100 + B600 = 0x258 + B7200 = 0x1c20 + B75 = 0x4b + B76800 = 0x12c00 + B9600 = 0x2580 + BIOCFLUSH = 0x20004268 + BIOCGBLEN = 0x40044266 + BIOCGDLT = 0x4004426a + BIOCGDLTLIST = 0xc00c4279 + BIOCGETIF = 0x4020426b + BIOCGHDRCMPLT = 0x40044274 + BIOCGRSIG = 0x40044272 + BIOCGRTIMEOUT = 0x4010426e + BIOCGSEESENT = 0x40044276 + BIOCGSTATS = 0x4008426f + BIOCIMMEDIATE = 0x80044270 + BIOCPROMISC = 0x20004269 + BIOCSBLEN = 0xc0044266 + BIOCSDLT = 0x80044278 + BIOCSETF = 0x80104267 + BIOCSETFNR = 0x8010427e + BIOCSETIF = 0x8020426c + BIOCSHDRCMPLT = 0x80044275 + BIOCSRSIG = 0x80044273 + BIOCSRTIMEOUT = 0x8010426d + BIOCSSEESENT = 0x80044277 + BIOCVERSION = 0x40044271 + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0x0 + BPF_ALIGNMENT = 0x4 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DIV = 0x30 + BPF_H = 0x8 + BPF_IMM = 0x0 + BPF_IND = 0x40 + BPF_JA = 0x0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0x0 + BPF_LD = 0x0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXBUFSIZE = 0x80000 + BPF_MAXINSNS = 0x200 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINBUFSIZE = 0x20 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RELEASE = 0x30bb6 + BPF_RET = 0x6 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0x0 + BPF_TXA = 0x80 + BPF_W = 0x0 + BPF_X = 0x8 + BRKINT = 0x2 + BS0 = 0x0 + BS1 = 0x8000 + BSDLY = 0x8000 + CFLUSH = 0xf + CLOCAL = 0x8000 + CLOCK_MONOTONIC = 0x6 + CLOCK_MONOTONIC_RAW = 0x4 + CLOCK_MONOTONIC_RAW_APPROX = 0x5 + CLOCK_PROCESS_CPUTIME_ID = 0xc + CLOCK_REALTIME = 0x0 + CLOCK_THREAD_CPUTIME_ID = 0x10 + CLOCK_UPTIME_RAW = 0x8 + CLOCK_UPTIME_RAW_APPROX = 0x9 + CLONE_NOFOLLOW = 0x1 + CLONE_NOOWNERCOPY = 0x2 + CR0 = 0x0 + CR1 = 0x1000 + CR2 = 0x2000 + CR3 = 0x3000 + CRDLY = 0x3000 + CREAD = 0x800 + CRTSCTS = 0x30000 + CS5 = 0x0 + CS6 = 0x100 + CS7 = 0x200 + CS8 = 0x300 + CSIZE = 0x300 + CSTART = 0x11 + CSTATUS = 0x14 + CSTOP = 0x13 + CSTOPB = 0x400 + CSUSP = 0x1a + CTLIOCGINFO = 0xc0644e03 + CTL_HW = 0x6 + CTL_KERN = 0x1 + CTL_MAXNAME = 0xc + CTL_NET = 0x4 + DLT_A429 = 0xb8 + DLT_A653_ICM = 0xb9 + DLT_AIRONET_HEADER = 0x78 + DLT_AOS = 0xde + DLT_APPLE_IP_OVER_IEEE1394 = 0x8a + DLT_ARCNET = 0x7 + DLT_ARCNET_LINUX = 0x81 + DLT_ATM_CLIP = 0x13 + DLT_ATM_RFC1483 = 0xb + DLT_AURORA = 0x7e + DLT_AX25 = 0x3 + DLT_AX25_KISS = 0xca + DLT_BACNET_MS_TP = 0xa5 + DLT_BLUETOOTH_HCI_H4 = 0xbb + DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 + DLT_CAN20B = 0xbe + DLT_CAN_SOCKETCAN = 0xe3 + DLT_CHAOS = 0x5 + DLT_CHDLC = 0x68 + DLT_CISCO_IOS = 0x76 + DLT_C_HDLC = 0x68 + DLT_C_HDLC_WITH_DIR = 0xcd + DLT_DBUS = 0xe7 + DLT_DECT = 0xdd + DLT_DOCSIS = 0x8f + DLT_DVB_CI = 0xeb + DLT_ECONET = 0x73 + DLT_EN10MB = 0x1 + DLT_EN3MB = 0x2 + DLT_ENC = 0x6d + DLT_ERF = 0xc5 + DLT_ERF_ETH = 0xaf + DLT_ERF_POS = 0xb0 + DLT_FC_2 = 0xe0 + DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 + DLT_FDDI = 0xa + DLT_FLEXRAY = 0xd2 + DLT_FRELAY = 0x6b + DLT_FRELAY_WITH_DIR = 0xce + DLT_GCOM_SERIAL = 0xad + DLT_GCOM_T1E1 = 0xac + DLT_GPF_F = 0xab + DLT_GPF_T = 0xaa + DLT_GPRS_LLC = 0xa9 + DLT_GSMTAP_ABIS = 0xda + DLT_GSMTAP_UM = 0xd9 + DLT_HHDLC = 0x79 + DLT_IBM_SN = 0x92 + DLT_IBM_SP = 0x91 + DLT_IEEE802 = 0x6 + DLT_IEEE802_11 = 0x69 + DLT_IEEE802_11_RADIO = 0x7f + DLT_IEEE802_11_RADIO_AVS = 0xa3 + DLT_IEEE802_15_4 = 0xc3 + DLT_IEEE802_15_4_LINUX = 0xbf + DLT_IEEE802_15_4_NOFCS = 0xe6 + DLT_IEEE802_15_4_NONASK_PHY = 0xd7 + DLT_IEEE802_16_MAC_CPS = 0xbc + DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 + DLT_IPFILTER = 0x74 + DLT_IPMB = 0xc7 + DLT_IPMB_LINUX = 0xd1 + DLT_IPNET = 0xe2 + DLT_IPOIB = 0xf2 + DLT_IPV4 = 0xe4 + DLT_IPV6 = 0xe5 + DLT_IP_OVER_FC = 0x7a + DLT_JUNIPER_ATM1 = 0x89 + DLT_JUNIPER_ATM2 = 0x87 + DLT_JUNIPER_ATM_CEMIC = 0xee + DLT_JUNIPER_CHDLC = 0xb5 + DLT_JUNIPER_ES = 0x84 + DLT_JUNIPER_ETHER = 0xb2 + DLT_JUNIPER_FIBRECHANNEL = 0xea + DLT_JUNIPER_FRELAY = 0xb4 + DLT_JUNIPER_GGSN = 0x85 + DLT_JUNIPER_ISM = 0xc2 + DLT_JUNIPER_MFR = 0x86 + DLT_JUNIPER_MLFR = 0x83 + DLT_JUNIPER_MLPPP = 0x82 + DLT_JUNIPER_MONITOR = 0xa4 + DLT_JUNIPER_PIC_PEER = 0xae + DLT_JUNIPER_PPP = 0xb3 + DLT_JUNIPER_PPPOE = 0xa7 + DLT_JUNIPER_PPPOE_ATM = 0xa8 + DLT_JUNIPER_SERVICES = 0x88 + DLT_JUNIPER_SRX_E2E = 0xe9 + DLT_JUNIPER_ST = 0xc8 + DLT_JUNIPER_VP = 0xb7 + DLT_JUNIPER_VS = 0xe8 + DLT_LAPB_WITH_DIR = 0xcf + DLT_LAPD = 0xcb + DLT_LIN = 0xd4 + DLT_LINUX_EVDEV = 0xd8 + DLT_LINUX_IRDA = 0x90 + DLT_LINUX_LAPD = 0xb1 + DLT_LINUX_PPP_WITHDIRECTION = 0xa6 + DLT_LINUX_SLL = 0x71 + DLT_LOOP = 0x6c + DLT_LTALK = 0x72 + DLT_MATCHING_MAX = 0x10a + DLT_MATCHING_MIN = 0x68 + DLT_MFR = 0xb6 + DLT_MOST = 0xd3 + DLT_MPEG_2_TS = 0xf3 + DLT_MPLS = 0xdb + DLT_MTP2 = 0x8c + DLT_MTP2_WITH_PHDR = 0x8b + DLT_MTP3 = 0x8d + DLT_MUX27010 = 0xec + DLT_NETANALYZER = 0xf0 + DLT_NETANALYZER_TRANSPARENT = 0xf1 + DLT_NFC_LLCP = 0xf5 + DLT_NFLOG = 0xef + DLT_NG40 = 0xf4 + DLT_NULL = 0x0 + DLT_PCI_EXP = 0x7d + DLT_PFLOG = 0x75 + DLT_PFSYNC = 0x12 + DLT_PPI = 0xc0 + DLT_PPP = 0x9 + DLT_PPP_BSDOS = 0x10 + DLT_PPP_ETHER = 0x33 + DLT_PPP_PPPD = 0xa6 + DLT_PPP_SERIAL = 0x32 + DLT_PPP_WITH_DIR = 0xcc + DLT_PPP_WITH_DIRECTION = 0xa6 + DLT_PRISM_HEADER = 0x77 + DLT_PRONET = 0x4 + DLT_RAIF1 = 0xc6 + DLT_RAW = 0xc + DLT_RIO = 0x7c + DLT_SCCP = 0x8e + DLT_SITA = 0xc4 + DLT_SLIP = 0x8 + DLT_SLIP_BSDOS = 0xf + DLT_STANAG_5066_D_PDU = 0xed + DLT_SUNATM = 0x7b + DLT_SYMANTEC_FIREWALL = 0x63 + DLT_TZSP = 0x80 + DLT_USB = 0xba + DLT_USB_DARWIN = 0x10a + DLT_USB_LINUX = 0xbd + DLT_USB_LINUX_MMAPPED = 0xdc + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c + DLT_WIHART = 0xdf + DLT_X2E_SERIAL = 0xd5 + DLT_X2E_XORAYA = 0xd6 + DT_BLK = 0x6 + DT_CHR = 0x2 + DT_DIR = 0x4 + DT_FIFO = 0x1 + DT_LNK = 0xa + DT_REG = 0x8 + DT_SOCK = 0xc + DT_UNKNOWN = 0x0 + DT_WHT = 0xe + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 + EVFILT_AIO = -0x3 + EVFILT_EXCEPT = -0xf + EVFILT_FS = -0x9 + EVFILT_MACHPORT = -0x8 + EVFILT_PROC = -0x5 + EVFILT_READ = -0x1 + EVFILT_SIGNAL = -0x6 + EVFILT_SYSCOUNT = 0x11 + EVFILT_THREADMARKER = 0x11 + EVFILT_TIMER = -0x7 + EVFILT_USER = -0xa + EVFILT_VM = -0xc + EVFILT_VNODE = -0x4 + EVFILT_WRITE = -0x2 + EV_ADD = 0x1 + EV_CLEAR = 0x20 + EV_DELETE = 0x2 + EV_DISABLE = 0x8 + EV_DISPATCH = 0x80 + EV_DISPATCH2 = 0x180 + EV_ENABLE = 0x4 + EV_EOF = 0x8000 + EV_ERROR = 0x4000 + EV_FLAG0 = 0x1000 + EV_FLAG1 = 0x2000 + EV_ONESHOT = 0x10 + EV_OOBAND = 0x2000 + EV_POLL = 0x1000 + EV_RECEIPT = 0x40 + EV_SYSFLAGS = 0xf000 + EV_UDATA_SPECIFIC = 0x100 + EV_VANISHED = 0x200 + EXTA = 0x4b00 + EXTB = 0x9600 + EXTPROC = 0x800 + FD_CLOEXEC = 0x1 + FD_SETSIZE = 0x400 + FF0 = 0x0 + FF1 = 0x4000 + FFDLY = 0x4000 + FLUSHO = 0x800000 + FSOPT_ATTR_CMN_EXTENDED = 0x20 + FSOPT_NOFOLLOW = 0x1 + FSOPT_NOINMEMUPDATE = 0x2 + FSOPT_PACK_INVAL_ATTRS = 0x8 + FSOPT_REPORT_FULLSIZE = 0x4 + FSOPT_RETURN_REALDEV = 0x200 + F_ADDFILESIGS = 0x3d + F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 + F_ADDFILESIGS_INFO = 0x67 + F_ADDFILESIGS_RETURN = 0x61 + F_ADDFILESUPPL = 0x68 + F_ADDSIGS = 0x3b + F_ALLOCATEALL = 0x4 + F_ALLOCATECONTIG = 0x2 + F_BARRIERFSYNC = 0x55 + F_CHECK_LV = 0x62 + F_CHKCLEAN = 0x29 + F_DUPFD = 0x0 + F_DUPFD_CLOEXEC = 0x43 + F_FINDSIGS = 0x4e + F_FLUSH_DATA = 0x28 + F_FREEZE_FS = 0x35 + F_FULLFSYNC = 0x33 + F_GETCODEDIR = 0x48 + F_GETFD = 0x1 + F_GETFL = 0x3 + F_GETLK = 0x7 + F_GETLKPID = 0x42 + F_GETNOSIGPIPE = 0x4a + F_GETOWN = 0x5 + F_GETPATH = 0x32 + F_GETPATH_MTMINFO = 0x47 + F_GETPATH_NOFIRMLINK = 0x66 + F_GETPROTECTIONCLASS = 0x3f + F_GETPROTECTIONLEVEL = 0x4d + F_GETSIGSINFO = 0x69 + F_GLOBAL_NOCACHE = 0x37 + F_LOG2PHYS = 0x31 + F_LOG2PHYS_EXT = 0x41 + F_NOCACHE = 0x30 + F_NODIRECT = 0x3e + F_OK = 0x0 + F_PATHPKG_CHECK = 0x34 + F_PEOFPOSMODE = 0x3 + F_PREALLOCATE = 0x2a + F_PUNCHHOLE = 0x63 + F_RDADVISE = 0x2c + F_RDAHEAD = 0x2d + F_RDLCK = 0x1 + F_SETBACKINGSTORE = 0x46 + F_SETFD = 0x2 + F_SETFL = 0x4 + F_SETLK = 0x8 + F_SETLKW = 0x9 + F_SETLKWTIMEOUT = 0xa + F_SETNOSIGPIPE = 0x49 + F_SETOWN = 0x6 + F_SETPROTECTIONCLASS = 0x40 + F_SETSIZE = 0x2b + F_SINGLE_WRITER = 0x4c + F_SPECULATIVE_READ = 0x65 + F_THAW_FS = 0x36 + F_TRANSCODEKEY = 0x4b + F_TRIM_ACTIVE_FILE = 0x64 + F_UNLCK = 0x2 + F_VOLPOSMODE = 0x4 + F_WRLCK = 0x3 + HUPCL = 0x4000 + HW_MACHINE = 0x1 + ICANON = 0x100 + ICMP6_FILTER = 0x12 + ICRNL = 0x100 + IEXTEN = 0x400 + IFF_ALLMULTI = 0x200 + IFF_ALTPHYS = 0x4000 + IFF_BROADCAST = 0x2 + IFF_DEBUG = 0x4 + IFF_LINK0 = 0x1000 + IFF_LINK1 = 0x2000 + IFF_LINK2 = 0x4000 + IFF_LOOPBACK = 0x8 + IFF_MULTICAST = 0x8000 + IFF_NOARP = 0x80 + IFF_NOTRAILERS = 0x20 + IFF_OACTIVE = 0x400 + IFF_POINTOPOINT = 0x10 + IFF_PROMISC = 0x100 + IFF_RUNNING = 0x40 + IFF_SIMPLEX = 0x800 + IFF_UP = 0x1 + IFNAMSIZ = 0x10 + IFT_1822 = 0x2 + IFT_6LOWPAN = 0x40 + IFT_AAL5 = 0x31 + IFT_ARCNET = 0x23 + IFT_ARCNETPLUS = 0x24 + IFT_ATM = 0x25 + IFT_BRIDGE = 0xd1 + IFT_CARP = 0xf8 + IFT_CELLULAR = 0xff + IFT_CEPT = 0x13 + IFT_DS3 = 0x1e + IFT_ENC = 0xf4 + IFT_EON = 0x19 + IFT_ETHER = 0x6 + IFT_FAITH = 0x38 + IFT_FDDI = 0xf + IFT_FRELAY = 0x20 + IFT_FRELAYDCE = 0x2c + IFT_GIF = 0x37 + IFT_HDH1822 = 0x3 + IFT_HIPPI = 0x2f + IFT_HSSI = 0x2e + IFT_HY = 0xe + IFT_IEEE1394 = 0x90 + IFT_IEEE8023ADLAG = 0x88 + IFT_ISDNBASIC = 0x14 + IFT_ISDNPRIMARY = 0x15 + IFT_ISO88022LLC = 0x29 + IFT_ISO88023 = 0x7 + IFT_ISO88024 = 0x8 + IFT_ISO88025 = 0x9 + IFT_ISO88026 = 0xa + IFT_L2VLAN = 0x87 + IFT_LAPB = 0x10 + IFT_LOCALTALK = 0x2a + IFT_LOOP = 0x18 + IFT_MIOX25 = 0x26 + IFT_MODEM = 0x30 + IFT_NSIP = 0x1b + IFT_OTHER = 0x1 + IFT_P10 = 0xc + IFT_P80 = 0xd + IFT_PARA = 0x22 + IFT_PDP = 0xff + IFT_PFLOG = 0xf5 + IFT_PFSYNC = 0xf6 + IFT_PKTAP = 0xfe + IFT_PPP = 0x17 + IFT_PROPMUX = 0x36 + IFT_PROPVIRTUAL = 0x35 + IFT_PTPSERIAL = 0x16 + IFT_RS232 = 0x21 + IFT_SDLC = 0x11 + IFT_SIP = 0x1f + IFT_SLIP = 0x1c + IFT_SMDSDXI = 0x2b + IFT_SMDSICIP = 0x34 + IFT_SONET = 0x27 + IFT_SONETPATH = 0x32 + IFT_SONETVT = 0x33 + IFT_STARLAN = 0xb + IFT_STF = 0x39 + IFT_T1 = 0x12 + IFT_ULTRA = 0x1d + IFT_V35 = 0x2d + IFT_X25 = 0x5 + IFT_X25DDN = 0x4 + IFT_X25PLE = 0x28 + IFT_XETHER = 0x1a + IGNBRK = 0x1 + IGNCR = 0x80 + IGNPAR = 0x4 + IMAXBEL = 0x2000 + INLCR = 0x40 + INPCK = 0x10 + IN_CLASSA_HOST = 0xffffff + IN_CLASSA_MAX = 0x80 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 0x18 + IN_CLASSB_HOST = 0xffff + IN_CLASSB_MAX = 0x10000 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 0x10 + IN_CLASSC_HOST = 0xff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 0x8 + IN_CLASSD_HOST = 0xfffffff + IN_CLASSD_NET = 0xf0000000 + IN_CLASSD_NSHIFT = 0x1c + IN_LINKLOCALNETNUM = 0xa9fe0000 + IN_LOOPBACKNET = 0x7f + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x400473d1 + IPPROTO_3PC = 0x22 + IPPROTO_ADFS = 0x44 + IPPROTO_AH = 0x33 + IPPROTO_AHIP = 0x3d + IPPROTO_APES = 0x63 + IPPROTO_ARGUS = 0xd + IPPROTO_AX25 = 0x5d + IPPROTO_BHA = 0x31 + IPPROTO_BLT = 0x1e + IPPROTO_BRSATMON = 0x4c + IPPROTO_CFTP = 0x3e + IPPROTO_CHAOS = 0x10 + IPPROTO_CMTP = 0x26 + IPPROTO_CPHB = 0x49 + IPPROTO_CPNX = 0x48 + IPPROTO_DDP = 0x25 + IPPROTO_DGP = 0x56 + IPPROTO_DIVERT = 0xfe + IPPROTO_DONE = 0x101 + IPPROTO_DSTOPTS = 0x3c + IPPROTO_EGP = 0x8 + IPPROTO_EMCON = 0xe + IPPROTO_ENCAP = 0x62 + IPPROTO_EON = 0x50 + IPPROTO_ESP = 0x32 + IPPROTO_ETHERIP = 0x61 + IPPROTO_FRAGMENT = 0x2c + IPPROTO_GGP = 0x3 + IPPROTO_GMTP = 0x64 + IPPROTO_GRE = 0x2f + IPPROTO_HELLO = 0x3f + IPPROTO_HMP = 0x14 + IPPROTO_HOPOPTS = 0x0 + IPPROTO_ICMP = 0x1 + IPPROTO_ICMPV6 = 0x3a + IPPROTO_IDP = 0x16 + IPPROTO_IDPR = 0x23 + IPPROTO_IDRP = 0x2d + IPPROTO_IGMP = 0x2 + IPPROTO_IGP = 0x55 + IPPROTO_IGRP = 0x58 + IPPROTO_IL = 0x28 + IPPROTO_INLSP = 0x34 + IPPROTO_INP = 0x20 + IPPROTO_IP = 0x0 + IPPROTO_IPCOMP = 0x6c + IPPROTO_IPCV = 0x47 + IPPROTO_IPEIP = 0x5e + IPPROTO_IPIP = 0x4 + IPPROTO_IPPC = 0x43 + IPPROTO_IPV4 = 0x4 + IPPROTO_IPV6 = 0x29 + IPPROTO_IRTP = 0x1c + IPPROTO_KRYPTOLAN = 0x41 + IPPROTO_LARP = 0x5b + IPPROTO_LEAF1 = 0x19 + IPPROTO_LEAF2 = 0x1a + IPPROTO_MAX = 0x100 + IPPROTO_MAXID = 0x34 + IPPROTO_MEAS = 0x13 + IPPROTO_MHRP = 0x30 + IPPROTO_MICP = 0x5f + IPPROTO_MTP = 0x5c + IPPROTO_MUX = 0x12 + IPPROTO_ND = 0x4d + IPPROTO_NHRP = 0x36 + IPPROTO_NONE = 0x3b + IPPROTO_NSP = 0x1f + IPPROTO_NVPII = 0xb + IPPROTO_OSPFIGP = 0x59 + IPPROTO_PGM = 0x71 + IPPROTO_PIGP = 0x9 + IPPROTO_PIM = 0x67 + IPPROTO_PRM = 0x15 + IPPROTO_PUP = 0xc + IPPROTO_PVP = 0x4b + IPPROTO_RAW = 0xff + IPPROTO_RCCMON = 0xa + IPPROTO_RDP = 0x1b + IPPROTO_ROUTING = 0x2b + IPPROTO_RSVP = 0x2e + IPPROTO_RVD = 0x42 + IPPROTO_SATEXPAK = 0x40 + IPPROTO_SATMON = 0x45 + IPPROTO_SCCSP = 0x60 + IPPROTO_SCTP = 0x84 + IPPROTO_SDRP = 0x2a + IPPROTO_SEP = 0x21 + IPPROTO_SRPC = 0x5a + IPPROTO_ST = 0x7 + IPPROTO_SVMTP = 0x52 + IPPROTO_SWIPE = 0x35 + IPPROTO_TCF = 0x57 + IPPROTO_TCP = 0x6 + IPPROTO_TP = 0x1d + IPPROTO_TPXX = 0x27 + IPPROTO_TRUNK1 = 0x17 + IPPROTO_TRUNK2 = 0x18 + IPPROTO_TTP = 0x54 + IPPROTO_UDP = 0x11 + IPPROTO_VINES = 0x53 + IPPROTO_VISA = 0x46 + IPPROTO_VMTP = 0x51 + IPPROTO_WBEXPAK = 0x4f + IPPROTO_WBMON = 0x4e + IPPROTO_WSN = 0x4a + IPPROTO_XNET = 0xf + IPPROTO_XTP = 0x24 + IPV6_2292DSTOPTS = 0x17 + IPV6_2292HOPLIMIT = 0x14 + IPV6_2292HOPOPTS = 0x16 + IPV6_2292NEXTHOP = 0x15 + IPV6_2292PKTINFO = 0x13 + IPV6_2292PKTOPTIONS = 0x19 + IPV6_2292RTHDR = 0x18 + IPV6_3542DSTOPTS = 0x32 + IPV6_3542HOPLIMIT = 0x2f + IPV6_3542HOPOPTS = 0x31 + IPV6_3542NEXTHOP = 0x30 + IPV6_3542PKTINFO = 0x2e + IPV6_3542RTHDR = 0x33 + IPV6_ADDR_MC_FLAGS_PREFIX = 0x20 + IPV6_ADDR_MC_FLAGS_TRANSIENT = 0x10 + IPV6_ADDR_MC_FLAGS_UNICAST_BASED = 0x30 + IPV6_AUTOFLOWLABEL = 0x3b + IPV6_BINDV6ONLY = 0x1b + IPV6_BOUND_IF = 0x7d + IPV6_CHECKSUM = 0x1a + IPV6_DEFAULT_MULTICAST_HOPS = 0x1 + IPV6_DEFAULT_MULTICAST_LOOP = 0x1 + IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 + IPV6_FAITH = 0x1d + IPV6_FLOWINFO_MASK = 0xffffff0f + IPV6_FLOWLABEL_MASK = 0xffff0f00 + IPV6_FLOW_ECN_MASK = 0x3000 + IPV6_FRAGTTL = 0x3c + IPV6_FW_ADD = 0x1e + IPV6_FW_DEL = 0x1f + IPV6_FW_FLUSH = 0x20 + IPV6_FW_GET = 0x22 + IPV6_FW_ZERO = 0x21 + IPV6_HLIMDEC = 0x1 + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 + IPV6_IPSEC_POLICY = 0x1c + IPV6_JOIN_GROUP = 0xc + IPV6_LEAVE_GROUP = 0xd + IPV6_MAXHLIM = 0xff + IPV6_MAXOPTHDR = 0x800 + IPV6_MAXPACKET = 0xffff + IPV6_MAX_GROUP_SRC_FILTER = 0x200 + IPV6_MAX_MEMBERSHIPS = 0xfff + IPV6_MAX_SOCK_SRC_FILTER = 0x80 + IPV6_MIN_MEMBERSHIPS = 0x1f + IPV6_MMTU = 0x500 + IPV6_MSFILTER = 0x4a + IPV6_MULTICAST_HOPS = 0xa + IPV6_MULTICAST_IF = 0x9 + IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_PATHMTU = 0x2c + IPV6_PKTINFO = 0x2e + IPV6_PORTRANGE = 0xe + IPV6_PORTRANGE_DEFAULT = 0x0 + IPV6_PORTRANGE_HIGH = 0x1 + IPV6_PORTRANGE_LOW = 0x2 + IPV6_PREFER_TEMPADDR = 0x3f + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x3d + IPV6_RECVRTHDR = 0x26 + IPV6_RECVTCLASS = 0x23 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x39 + IPV6_RTHDR_LOOSE = 0x0 + IPV6_RTHDR_STRICT = 0x1 + IPV6_RTHDR_TYPE_0 = 0x0 + IPV6_SOCKOPT_RESERVED1 = 0x3 + IPV6_TCLASS = 0x24 + IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a + IPV6_V6ONLY = 0x1b + IPV6_VERSION = 0x60 + IPV6_VERSION_MASK = 0xf0 + IP_ADD_MEMBERSHIP = 0xc + IP_ADD_SOURCE_MEMBERSHIP = 0x46 + IP_BLOCK_SOURCE = 0x48 + IP_BOUND_IF = 0x19 + IP_DEFAULT_MULTICAST_LOOP = 0x1 + IP_DEFAULT_MULTICAST_TTL = 0x1 + IP_DF = 0x4000 + IP_DONTFRAG = 0x1c + IP_DROP_MEMBERSHIP = 0xd + IP_DROP_SOURCE_MEMBERSHIP = 0x47 + IP_DUMMYNET_CONFIGURE = 0x3c + IP_DUMMYNET_DEL = 0x3d + IP_DUMMYNET_FLUSH = 0x3e + IP_DUMMYNET_GET = 0x40 + IP_FAITH = 0x16 + IP_FW_ADD = 0x28 + IP_FW_DEL = 0x29 + IP_FW_FLUSH = 0x2a + IP_FW_GET = 0x2c + IP_FW_RESETLOG = 0x2d + IP_FW_ZERO = 0x2b + IP_HDRINCL = 0x2 + IP_IPSEC_POLICY = 0x15 + IP_MAXPACKET = 0xffff + IP_MAX_GROUP_SRC_FILTER = 0x200 + IP_MAX_MEMBERSHIPS = 0xfff + IP_MAX_SOCK_MUTE_FILTER = 0x80 + IP_MAX_SOCK_SRC_FILTER = 0x80 + IP_MF = 0x2000 + IP_MIN_MEMBERSHIPS = 0x1f + IP_MSFILTER = 0x4a + IP_MSS = 0x240 + IP_MULTICAST_IF = 0x9 + IP_MULTICAST_IFINDEX = 0x42 + IP_MULTICAST_LOOP = 0xb + IP_MULTICAST_TTL = 0xa + IP_MULTICAST_VIF = 0xe + IP_NAT__XXX = 0x37 + IP_OFFMASK = 0x1fff + IP_OLD_FW_ADD = 0x32 + IP_OLD_FW_DEL = 0x33 + IP_OLD_FW_FLUSH = 0x34 + IP_OLD_FW_GET = 0x36 + IP_OLD_FW_RESETLOG = 0x38 + IP_OLD_FW_ZERO = 0x35 + IP_OPTIONS = 0x1 + IP_PKTINFO = 0x1a + IP_PORTRANGE = 0x13 + IP_PORTRANGE_DEFAULT = 0x0 + IP_PORTRANGE_HIGH = 0x1 + IP_PORTRANGE_LOW = 0x2 + IP_RECVDSTADDR = 0x7 + IP_RECVIF = 0x14 + IP_RECVOPTS = 0x5 + IP_RECVPKTINFO = 0x1a + IP_RECVRETOPTS = 0x6 + IP_RECVTOS = 0x1b + IP_RECVTTL = 0x18 + IP_RETOPTS = 0x8 + IP_RF = 0x8000 + IP_RSVP_OFF = 0x10 + IP_RSVP_ON = 0xf + IP_RSVP_VIF_OFF = 0x12 + IP_RSVP_VIF_ON = 0x11 + IP_STRIPHDR = 0x17 + IP_TOS = 0x3 + IP_TRAFFIC_MGT_BACKGROUND = 0x41 + IP_TTL = 0x4 + IP_UNBLOCK_SOURCE = 0x49 + ISIG = 0x80 + ISTRIP = 0x20 + IUTF8 = 0x4000 + IXANY = 0x800 + IXOFF = 0x400 + IXON = 0x200 + KERN_HOSTNAME = 0xa + KERN_OSRELEASE = 0x2 + KERN_OSTYPE = 0x1 + KERN_VERSION = 0x4 + LOCAL_PEERCRED = 0x1 + LOCAL_PEEREPID = 0x3 + LOCAL_PEEREUUID = 0x5 + LOCAL_PEERPID = 0x2 + LOCAL_PEERTOKEN = 0x6 + LOCAL_PEERUUID = 0x4 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_SH = 0x1 + LOCK_UN = 0x8 + MADV_CAN_REUSE = 0x9 + MADV_DONTNEED = 0x4 + MADV_FREE = 0x5 + MADV_FREE_REUSABLE = 0x7 + MADV_FREE_REUSE = 0x8 + MADV_NORMAL = 0x0 + MADV_PAGEOUT = 0xa + MADV_RANDOM = 0x1 + MADV_SEQUENTIAL = 0x2 + MADV_WILLNEED = 0x3 + MADV_ZERO_WIRED_PAGES = 0x6 + MAP_32BIT = 0x8000 + MAP_ANON = 0x1000 + MAP_ANONYMOUS = 0x1000 + MAP_COPY = 0x2 + MAP_FILE = 0x0 + MAP_FIXED = 0x10 + MAP_HASSEMAPHORE = 0x200 + MAP_JIT = 0x800 + MAP_NOCACHE = 0x400 + MAP_NOEXTEND = 0x100 + MAP_NORESERVE = 0x40 + MAP_PRIVATE = 0x2 + MAP_RENAME = 0x20 + MAP_RESERVED0080 = 0x80 + MAP_RESILIENT_CODESIGN = 0x2000 + MAP_RESILIENT_MEDIA = 0x4000 + MAP_SHARED = 0x1 + MAP_TRANSLATED_ALLOW_EXECUTE = 0x20000 + MAP_UNIX03 = 0x40000 + MCAST_BLOCK_SOURCE = 0x54 + MCAST_EXCLUDE = 0x2 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x50 + MCAST_JOIN_SOURCE_GROUP = 0x52 + MCAST_LEAVE_GROUP = 0x51 + MCAST_LEAVE_SOURCE_GROUP = 0x53 + MCAST_UNBLOCK_SOURCE = 0x55 + MCAST_UNDEFINED = 0x0 + MCL_CURRENT = 0x1 + MCL_FUTURE = 0x2 + MNT_ASYNC = 0x40 + MNT_AUTOMOUNTED = 0x400000 + MNT_CMDFLAGS = 0xf0000 + MNT_CPROTECT = 0x80 + MNT_DEFWRITE = 0x2000000 + MNT_DONTBROWSE = 0x100000 + MNT_DOVOLFS = 0x8000 + MNT_DWAIT = 0x4 + MNT_EXPORTED = 0x100 + MNT_EXT_ROOT_DATA_VOL = 0x1 + MNT_FORCE = 0x80000 + MNT_IGNORE_OWNERSHIP = 0x200000 + MNT_JOURNALED = 0x800000 + MNT_LOCAL = 0x1000 + MNT_MULTILABEL = 0x4000000 + MNT_NOATIME = 0x10000000 + MNT_NOBLOCK = 0x20000 + MNT_NODEV = 0x10 + MNT_NOEXEC = 0x4 + MNT_NOSUID = 0x8 + MNT_NOUSERXATTR = 0x1000000 + MNT_NOWAIT = 0x2 + MNT_QUARANTINE = 0x400 + MNT_QUOTA = 0x2000 + MNT_RDONLY = 0x1 + MNT_RELOAD = 0x40000 + MNT_REMOVABLE = 0x200 + MNT_ROOTFS = 0x4000 + MNT_SNAPSHOT = 0x40000000 + MNT_STRICTATIME = 0x80000000 + MNT_SYNCHRONOUS = 0x2 + MNT_UNION = 0x20 + MNT_UNKNOWNPERMISSIONS = 0x200000 + MNT_UPDATE = 0x10000 + MNT_VISFLAGMASK = 0xd7f0f7ff + MNT_WAIT = 0x1 + MSG_CTRUNC = 0x20 + MSG_DONTROUTE = 0x4 + MSG_DONTWAIT = 0x80 + MSG_EOF = 0x100 + MSG_EOR = 0x8 + MSG_FLUSH = 0x400 + MSG_HAVEMORE = 0x2000 + MSG_HOLD = 0x800 + MSG_NEEDSA = 0x10000 + MSG_NOSIGNAL = 0x80000 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_RCVMORE = 0x4000 + MSG_SEND = 0x1000 + MSG_TRUNC = 0x10 + MSG_WAITALL = 0x40 + MSG_WAITSTREAM = 0x200 + MS_ASYNC = 0x1 + MS_DEACTIVATE = 0x8 + MS_INVALIDATE = 0x2 + MS_KILLPAGES = 0x4 + MS_SYNC = 0x10 + NAME_MAX = 0xff + NET_RT_DUMP = 0x1 + NET_RT_DUMP2 = 0x7 + NET_RT_FLAGS = 0x2 + NET_RT_FLAGS_PRIV = 0xa + NET_RT_IFLIST = 0x3 + NET_RT_IFLIST2 = 0x6 + NET_RT_MAXID = 0xb + NET_RT_STAT = 0x4 + NET_RT_TRASH = 0x5 + NFDBITS = 0x20 + NL0 = 0x0 + NL1 = 0x100 + NL2 = 0x200 + NL3 = 0x300 + NLDLY = 0x300 + NOFLSH = 0x80000000 + NOKERNINFO = 0x2000000 + NOTE_ABSOLUTE = 0x8 + NOTE_ATTRIB = 0x8 + NOTE_BACKGROUND = 0x40 + NOTE_CHILD = 0x4 + NOTE_CRITICAL = 0x20 + NOTE_DELETE = 0x1 + NOTE_EXEC = 0x20000000 + NOTE_EXIT = 0x80000000 + NOTE_EXITSTATUS = 0x4000000 + NOTE_EXIT_CSERROR = 0x40000 + NOTE_EXIT_DECRYPTFAIL = 0x10000 + NOTE_EXIT_DETAIL = 0x2000000 + NOTE_EXIT_DETAIL_MASK = 0x70000 + NOTE_EXIT_MEMORY = 0x20000 + NOTE_EXIT_REPARENTED = 0x80000 + NOTE_EXTEND = 0x4 + NOTE_FFAND = 0x40000000 + NOTE_FFCOPY = 0xc0000000 + NOTE_FFCTRLMASK = 0xc0000000 + NOTE_FFLAGSMASK = 0xffffff + NOTE_FFNOP = 0x0 + NOTE_FFOR = 0x80000000 + NOTE_FORK = 0x40000000 + NOTE_FUNLOCK = 0x100 + NOTE_LEEWAY = 0x10 + NOTE_LINK = 0x10 + NOTE_LOWAT = 0x1 + NOTE_MACHTIME = 0x100 + NOTE_MACH_CONTINUOUS_TIME = 0x80 + NOTE_NONE = 0x80 + NOTE_NSECONDS = 0x4 + NOTE_OOB = 0x2 + NOTE_PCTRLMASK = -0x100000 + NOTE_PDATAMASK = 0xfffff + NOTE_REAP = 0x10000000 + NOTE_RENAME = 0x20 + NOTE_REVOKE = 0x40 + NOTE_SECONDS = 0x1 + NOTE_SIGNAL = 0x8000000 + NOTE_TRACK = 0x1 + NOTE_TRACKERR = 0x2 + NOTE_TRIGGER = 0x1000000 + NOTE_USECONDS = 0x2 + NOTE_VM_ERROR = 0x10000000 + NOTE_VM_PRESSURE = 0x80000000 + NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 + NOTE_VM_PRESSURE_TERMINATE = 0x40000000 + NOTE_WRITE = 0x2 + OCRNL = 0x10 + OFDEL = 0x20000 + OFILL = 0x80 + ONLCR = 0x2 + ONLRET = 0x40 + ONOCR = 0x20 + ONOEOT = 0x8 + OPOST = 0x1 + OXTABS = 0x4 + O_ACCMODE = 0x3 + O_ALERT = 0x20000000 + O_APPEND = 0x8 + O_ASYNC = 0x40 + O_CLOEXEC = 0x1000000 + O_CREAT = 0x200 + O_DIRECTORY = 0x100000 + O_DP_GETRAWENCRYPTED = 0x1 + O_DP_GETRAWUNENCRYPTED = 0x2 + O_DSYNC = 0x400000 + O_EVTONLY = 0x8000 + O_EXCL = 0x800 + O_EXLOCK = 0x20 + O_FSYNC = 0x80 + O_NDELAY = 0x4 + O_NOCTTY = 0x20000 + O_NOFOLLOW = 0x100 + O_NOFOLLOW_ANY = 0x20000000 + O_NONBLOCK = 0x4 + O_POPUP = 0x80000000 + O_RDONLY = 0x0 + O_RDWR = 0x2 + O_SHLOCK = 0x10 + O_SYMLINK = 0x200000 + O_SYNC = 0x80 + O_TRUNC = 0x400 + O_WRONLY = 0x1 + PARENB = 0x1000 + PARMRK = 0x8 + PARODD = 0x2000 + PENDIN = 0x20000000 + PRIO_PGRP = 0x1 + PRIO_PROCESS = 0x0 + PRIO_USER = 0x2 + PROT_EXEC = 0x4 + PROT_NONE = 0x0 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + PT_ATTACH = 0xa + PT_ATTACHEXC = 0xe + PT_CONTINUE = 0x7 + PT_DENY_ATTACH = 0x1f + PT_DETACH = 0xb + PT_FIRSTMACH = 0x20 + PT_FORCEQUOTA = 0x1e + PT_KILL = 0x8 + PT_READ_D = 0x2 + PT_READ_I = 0x1 + PT_READ_U = 0x3 + PT_SIGEXC = 0xc + PT_STEP = 0x9 + PT_THUPDATE = 0xd + PT_TRACE_ME = 0x0 + PT_WRITE_D = 0x5 + PT_WRITE_I = 0x4 + PT_WRITE_U = 0x6 + RLIMIT_AS = 0x5 + RLIMIT_CORE = 0x4 + RLIMIT_CPU = 0x0 + RLIMIT_CPU_USAGE_MONITOR = 0x2 + RLIMIT_DATA = 0x2 + RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 + RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 + RLIMIT_STACK = 0x3 + RLIM_INFINITY = 0x7fffffffffffffff + RTAX_AUTHOR = 0x6 + RTAX_BRD = 0x7 + RTAX_DST = 0x0 + RTAX_GATEWAY = 0x1 + RTAX_GENMASK = 0x3 + RTAX_IFA = 0x5 + RTAX_IFP = 0x4 + RTAX_MAX = 0x8 + RTAX_NETMASK = 0x2 + RTA_AUTHOR = 0x40 + RTA_BRD = 0x80 + RTA_DST = 0x1 + RTA_GATEWAY = 0x2 + RTA_GENMASK = 0x8 + RTA_IFA = 0x20 + RTA_IFP = 0x10 + RTA_NETMASK = 0x4 + RTF_BLACKHOLE = 0x1000 + RTF_BROADCAST = 0x400000 + RTF_CLONING = 0x100 + RTF_CONDEMNED = 0x2000000 + RTF_DEAD = 0x20000000 + RTF_DELCLONE = 0x80 + RTF_DONE = 0x40 + RTF_DYNAMIC = 0x10 + RTF_GATEWAY = 0x2 + RTF_GLOBAL = 0x40000000 + RTF_HOST = 0x4 + RTF_IFREF = 0x4000000 + RTF_IFSCOPE = 0x1000000 + RTF_LLDATA = 0x400 + RTF_LLINFO = 0x400 + RTF_LOCAL = 0x200000 + RTF_MODIFIED = 0x20 + RTF_MULTICAST = 0x800000 + RTF_NOIFREF = 0x2000 + RTF_PINNED = 0x100000 + RTF_PRCLONING = 0x10000 + RTF_PROTO1 = 0x8000 + RTF_PROTO2 = 0x4000 + RTF_PROTO3 = 0x40000 + RTF_PROXY = 0x8000000 + RTF_REJECT = 0x8 + RTF_ROUTER = 0x10000000 + RTF_STATIC = 0x800 + RTF_UP = 0x1 + RTF_WASCLONED = 0x20000 + RTF_XRESOLVE = 0x200 + RTM_ADD = 0x1 + RTM_CHANGE = 0x3 + RTM_DELADDR = 0xd + RTM_DELETE = 0x2 + RTM_DELMADDR = 0x10 + RTM_GET = 0x4 + RTM_GET2 = 0x14 + RTM_IFINFO = 0xe + RTM_IFINFO2 = 0x12 + RTM_LOCK = 0x8 + RTM_LOSING = 0x5 + RTM_MISS = 0x7 + RTM_NEWADDR = 0xc + RTM_NEWMADDR = 0xf + RTM_NEWMADDR2 = 0x13 + RTM_OLDADD = 0x9 + RTM_OLDDEL = 0xa + RTM_REDIRECT = 0x6 + RTM_RESOLVE = 0xb + RTM_RTTUNIT = 0xf4240 + RTM_VERSION = 0x5 + RTV_EXPIRE = 0x4 + RTV_HOPCOUNT = 0x2 + RTV_MTU = 0x1 + RTV_RPIPE = 0x8 + RTV_RTT = 0x40 + RTV_RTTVAR = 0x80 + RTV_SPIPE = 0x10 + RTV_SSTHRESH = 0x20 + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 + SCM_CREDS = 0x3 + SCM_RIGHTS = 0x1 + SCM_TIMESTAMP = 0x2 + SCM_TIMESTAMP_MONOTONIC = 0x4 + SEEK_CUR = 0x1 + SEEK_DATA = 0x4 + SEEK_END = 0x2 + SEEK_HOLE = 0x3 + SEEK_SET = 0x0 + SHUT_RD = 0x0 + SHUT_RDWR = 0x2 + SHUT_WR = 0x1 + SIOCADDMULTI = 0x80206931 + SIOCAIFADDR = 0x8040691a + SIOCARPIPLL = 0xc0206928 + SIOCATMARK = 0x40047307 + SIOCAUTOADDR = 0xc0206926 + SIOCAUTONETMASK = 0x80206927 + SIOCDELMULTI = 0x80206932 + SIOCDIFADDR = 0x80206919 + SIOCDIFPHYADDR = 0x80206941 + SIOCGDRVSPEC = 0xc028697b + SIOCGETVLAN = 0xc020697f + SIOCGHIWAT = 0x40047301 + SIOCGIF6LOWPAN = 0xc02069c5 + SIOCGIFADDR = 0xc0206921 + SIOCGIFALTMTU = 0xc0206948 + SIOCGIFASYNCMAP = 0xc020697c + SIOCGIFBOND = 0xc0206947 + SIOCGIFBRDADDR = 0xc0206923 + SIOCGIFCAP = 0xc020695b + SIOCGIFCONF = 0xc00c6924 + SIOCGIFDEVMTU = 0xc0206944 + SIOCGIFDSTADDR = 0xc0206922 + SIOCGIFFLAGS = 0xc0206911 + SIOCGIFFUNCTIONALTYPE = 0xc02069ad + SIOCGIFGENERIC = 0xc020693a + SIOCGIFKPI = 0xc0206987 + SIOCGIFMAC = 0xc0206982 + SIOCGIFMEDIA = 0xc02c6938 + SIOCGIFMETRIC = 0xc0206917 + SIOCGIFMTU = 0xc0206933 + SIOCGIFNETMASK = 0xc0206925 + SIOCGIFPDSTADDR = 0xc0206940 + SIOCGIFPHYS = 0xc0206935 + SIOCGIFPSRCADDR = 0xc020693f + SIOCGIFSTATUS = 0xc331693d + SIOCGIFVLAN = 0xc020697f + SIOCGIFWAKEFLAGS = 0xc0206988 + SIOCGIFXMEDIA = 0xc02c6948 + SIOCGLOWAT = 0x40047303 + SIOCGPGRP = 0x40047309 + SIOCIFCREATE = 0xc0206978 + SIOCIFCREATE2 = 0xc020697a + SIOCIFDESTROY = 0x80206979 + SIOCIFGCLONERS = 0xc0106981 + SIOCRSLVMULTI = 0xc010693b + SIOCSDRVSPEC = 0x8028697b + SIOCSETVLAN = 0x8020697e + SIOCSHIWAT = 0x80047300 + SIOCSIF6LOWPAN = 0x802069c4 + SIOCSIFADDR = 0x8020690c + SIOCSIFALTMTU = 0x80206945 + SIOCSIFASYNCMAP = 0x8020697d + SIOCSIFBOND = 0x80206946 + SIOCSIFBRDADDR = 0x80206913 + SIOCSIFCAP = 0x8020695a + SIOCSIFDSTADDR = 0x8020690e + SIOCSIFFLAGS = 0x80206910 + SIOCSIFGENERIC = 0x80206939 + SIOCSIFKPI = 0x80206986 + SIOCSIFLLADDR = 0x8020693c + SIOCSIFMAC = 0x80206983 + SIOCSIFMEDIA = 0xc0206937 + SIOCSIFMETRIC = 0x80206918 + SIOCSIFMTU = 0x80206934 + SIOCSIFNETMASK = 0x80206916 + SIOCSIFPHYADDR = 0x8040693e + SIOCSIFPHYS = 0x80206936 + SIOCSIFVLAN = 0x8020697e + SIOCSLOWAT = 0x80047302 + SIOCSPGRP = 0x80047308 + SOCK_DGRAM = 0x2 + SOCK_MAXADDRLEN = 0xff + SOCK_RAW = 0x3 + SOCK_RDM = 0x4 + SOCK_SEQPACKET = 0x5 + SOCK_STREAM = 0x1 + SOL_LOCAL = 0x0 + SOL_SOCKET = 0xffff + SOMAXCONN = 0x80 + SO_ACCEPTCONN = 0x2 + SO_BROADCAST = 0x20 + SO_DEBUG = 0x1 + SO_DONTROUTE = 0x10 + SO_DONTTRUNC = 0x2000 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x8 + SO_LABEL = 0x1010 + SO_LINGER = 0x80 + SO_LINGER_SEC = 0x1080 + SO_NETSVC_MARKING_LEVEL = 0x1119 + SO_NET_SERVICE_TYPE = 0x1116 + SO_NKE = 0x1021 + SO_NOADDRERR = 0x1023 + SO_NOSIGPIPE = 0x1022 + SO_NOTIFYCONFLICT = 0x1026 + SO_NP_EXTENSIONS = 0x1083 + SO_NREAD = 0x1020 + SO_NUMRCVPKT = 0x1112 + SO_NWRITE = 0x1024 + SO_OOBINLINE = 0x100 + SO_PEERLABEL = 0x1011 + SO_RANDOMPORT = 0x1082 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x1006 + SO_REUSEADDR = 0x4 + SO_REUSEPORT = 0x200 + SO_REUSESHAREUID = 0x1025 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x1005 + SO_TIMESTAMP = 0x400 + SO_TIMESTAMP_MONOTONIC = 0x800 + SO_TRACKER_ATTRIBUTE_FLAGS_APP_APPROVED = 0x1 + SO_TRACKER_ATTRIBUTE_FLAGS_DOMAIN_SHORT = 0x4 + SO_TRACKER_ATTRIBUTE_FLAGS_TRACKER = 0x2 + SO_TRACKER_TRANSPARENCY_VERSION = 0x3 + SO_TYPE = 0x1008 + SO_UPCALLCLOSEWAIT = 0x1027 + SO_USELOOPBACK = 0x40 + SO_WANTMORE = 0x4000 + SO_WANTOOBFLAG = 0x8000 + S_IEXEC = 0x40 + S_IFBLK = 0x6000 + S_IFCHR = 0x2000 + S_IFDIR = 0x4000 + S_IFIFO = 0x1000 + S_IFLNK = 0xa000 + S_IFMT = 0xf000 + S_IFREG = 0x8000 + S_IFSOCK = 0xc000 + S_IFWHT = 0xe000 + S_IREAD = 0x100 + S_IRGRP = 0x20 + S_IROTH = 0x4 + S_IRUSR = 0x100 + S_IRWXG = 0x38 + S_IRWXO = 0x7 + S_IRWXU = 0x1c0 + S_ISGID = 0x400 + S_ISTXT = 0x200 + S_ISUID = 0x800 + S_ISVTX = 0x200 + S_IWGRP = 0x10 + S_IWOTH = 0x2 + S_IWRITE = 0x80 + S_IWUSR = 0x80 + S_IXGRP = 0x8 + S_IXOTH = 0x1 + S_IXUSR = 0x40 + TAB0 = 0x0 + TAB1 = 0x400 + TAB2 = 0x800 + TAB3 = 0x4 + TABDLY = 0xc04 + TCIFLUSH = 0x1 + TCIOFF = 0x3 + TCIOFLUSH = 0x3 + TCION = 0x4 + TCOFLUSH = 0x2 + TCOOFF = 0x1 + TCOON = 0x2 + TCPOPT_CC = 0xb + TCPOPT_CCECHO = 0xd + TCPOPT_CCNEW = 0xc + TCPOPT_EOL = 0x0 + TCPOPT_FASTOPEN = 0x22 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_HDR = 0x1010500 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SACK_PERMIT_HDR = 0x1010402 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_TSTAMP_HDR = 0x101080a + TCPOPT_WINDOW = 0x3 + TCP_CONNECTIONTIMEOUT = 0x20 + TCP_CONNECTION_INFO = 0x106 + TCP_ENABLE_ECN = 0x104 + TCP_FASTOPEN = 0x105 + TCP_KEEPALIVE = 0x10 + TCP_KEEPCNT = 0x102 + TCP_KEEPINTVL = 0x101 + TCP_MAXHLEN = 0x3c + TCP_MAXOLEN = 0x28 + TCP_MAXSEG = 0x2 + TCP_MAXWIN = 0xffff + TCP_MAX_SACK = 0x4 + TCP_MAX_WINSHIFT = 0xe + TCP_MINMSS = 0xd8 + TCP_MSS = 0x200 + TCP_NODELAY = 0x1 + TCP_NOOPT = 0x8 + TCP_NOPUSH = 0x4 + TCP_NOTSENT_LOWAT = 0x201 + TCP_RXT_CONNDROPTIME = 0x80 + TCP_RXT_FINDROP = 0x100 + TCP_SENDMOREACKS = 0x103 + TCSAFLUSH = 0x2 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCONS = 0x80047462 + TIOCDCDTIMESTAMP = 0x40107458 + TIOCDRAIN = 0x2000745e + TIOCDSIMICROCODE = 0x20007455 + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLUSH = 0x80047410 + TIOCGDRAINWAIT = 0x40047456 + TIOCGETA = 0x40487413 + TIOCGETD = 0x4004741a + TIOCGPGRP = 0x40047477 + TIOCGWINSZ = 0x40087468 + TIOCIXOFF = 0x20007480 + TIOCIXON = 0x20007481 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGDTRWAIT = 0x4004745a + TIOCMGET = 0x4004746a + TIOCMODG = 0x40047403 + TIOCMODS = 0x80047404 + TIOCMSDTRWAIT = 0x8004745b + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0x0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCPTYGNAME = 0x40807453 + TIOCPTYGRANT = 0x20007454 + TIOCPTYUNLK = 0x20007452 + TIOCREMOTE = 0x80047469 + TIOCSBRK = 0x2000747b + TIOCSCONS = 0x20007463 + TIOCSCTTY = 0x20007461 + TIOCSDRAINWAIT = 0x80047457 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x80487414 + TIOCSETAF = 0x80487416 + TIOCSETAW = 0x80487415 + TIOCSETD = 0x8004741b + TIOCSIG = 0x2000745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTI = 0x80017472 + TIOCSTOP = 0x2000746f + TIOCSWINSZ = 0x80087467 + TIOCTIMESTAMP = 0x40107459 + TIOCUCNTL = 0x80047466 + TOSTOP = 0x400000 + VDISCARD = 0xf + VDSUSP = 0xb + VEOF = 0x0 + VEOL = 0x1 + VEOL2 = 0x2 + VERASE = 0x3 + VINTR = 0x8 + VKILL = 0x5 + VLNEXT = 0xe + VMADDR_CID_ANY = 0xffffffff + VMADDR_CID_HOST = 0x2 + VMADDR_CID_HYPERVISOR = 0x0 + VMADDR_CID_RESERVED = 0x1 + VMADDR_PORT_ANY = 0xffffffff + VMIN = 0x10 + VM_LOADAVG = 0x2 + VM_MACHFACTOR = 0x4 + VM_MAXID = 0x6 + VM_METER = 0x1 + VM_SWAPUSAGE = 0x5 + VQUIT = 0x9 + VREPRINT = 0x6 + VSTART = 0xc + VSTATUS = 0x12 + VSTOP = 0xd + VSUSP = 0xa + VT0 = 0x0 + VT1 = 0x10000 + VTDLY = 0x10000 + VTIME = 0x11 + VWERASE = 0x4 + WCONTINUED = 0x10 + WCOREFLAG = 0x80 + WEXITED = 0x4 + WNOHANG = 0x1 + WNOWAIT = 0x20 + WORDSIZE = 0x40 + WSTOPPED = 0x8 + WUNTRACED = 0x2 + XATTR_CREATE = 0x2 + XATTR_NODEFAULT = 0x10 + XATTR_NOFOLLOW = 0x1 + XATTR_NOSECURITY = 0x8 + XATTR_REPLACE = 0x4 + XATTR_SHOWCOMPRESSION = 0x20 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go index 9c7c5e165..440900112 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go @@ -1297,6 +1297,11 @@ const ( SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 SCM_TIME_INFO = 0x7 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go index b265abb25..64520d312 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go @@ -1298,6 +1298,11 @@ const ( SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 SCM_TIME_INFO = 0x7 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go index 3df99f285..99e9a0e06 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go @@ -1276,6 +1276,11 @@ const ( SCM_CREDS = 0x3 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go index 218d39906..4c8377114 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go @@ -1298,6 +1298,11 @@ const ( SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 SCM_TIME_INFO = 0x7 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index c3fa22486..78d4b85ec 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -228,7 +228,11 @@ const ( BPF_OR = 0x40 BPF_PSEUDO_BTF_ID = 0x3 BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_FUNC = 0x4 + BPF_PSEUDO_KFUNC_CALL = 0x2 BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_IDX = 0x5 + BPF_PSEUDO_MAP_IDX_VALUE = 0x6 BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 @@ -475,6 +479,8 @@ const ( DM_LIST_VERSIONS = 0xc138fd0d DM_MAX_TYPE_NAME = 0x10 DM_NAME_LEN = 0x80 + DM_NAME_LIST_FLAG_DOESNT_HAVE_UUID = 0x2 + DM_NAME_LIST_FLAG_HAS_UUID = 0x1 DM_NOFLUSH_FLAG = 0x800 DM_PERSISTENT_DEV_FLAG = 0x8 DM_QUERY_INACTIVE_TABLE_FLAG = 0x1000 @@ -494,9 +500,9 @@ const ( DM_UUID_FLAG = 0x4000 DM_UUID_LEN = 0x81 DM_VERSION = 0xc138fd00 - DM_VERSION_EXTRA = "-ioctl (2021-02-01)" + DM_VERSION_EXTRA = "-ioctl (2021-03-22)" DM_VERSION_MAJOR = 0x4 - DM_VERSION_MINOR = 0x2c + DM_VERSION_MINOR = 0x2d DM_VERSION_PATCHLEVEL = 0x0 DT_BLK = 0x6 DT_CHR = 0x2 @@ -981,12 +987,6 @@ const ( HPFS_SUPER_MAGIC = 0xf995e849 HUGETLBFS_MAGIC = 0x958458f6 IBSHIFT = 0x10 - ICMPV6_FILTER = 0x1 - ICMPV6_FILTER_BLOCK = 0x1 - ICMPV6_FILTER_BLOCKOTHERS = 0x3 - ICMPV6_FILTER_PASS = 0x2 - ICMPV6_FILTER_PASSONLY = 0x4 - ICMP_FILTER = 0x1 ICRNL = 0x100 IFA_F_DADFAILED = 0x8 IFA_F_DEPRECATED = 0x20 @@ -1257,6 +1257,7 @@ const ( KEXEC_ARCH_PARISC = 0xf0000 KEXEC_ARCH_PPC = 0x140000 KEXEC_ARCH_PPC64 = 0x150000 + KEXEC_ARCH_RISCV = 0xf30000 KEXEC_ARCH_S390 = 0x160000 KEXEC_ARCH_SH = 0x2a0000 KEXEC_ARCH_X86_64 = 0x3e0000 @@ -1332,6 +1333,20 @@ const ( KEY_SPEC_THREAD_KEYRING = -0x1 KEY_SPEC_USER_KEYRING = -0x4 KEY_SPEC_USER_SESSION_KEYRING = -0x5 + LANDLOCK_ACCESS_FS_EXECUTE = 0x1 + LANDLOCK_ACCESS_FS_MAKE_BLOCK = 0x800 + LANDLOCK_ACCESS_FS_MAKE_CHAR = 0x40 + LANDLOCK_ACCESS_FS_MAKE_DIR = 0x80 + LANDLOCK_ACCESS_FS_MAKE_FIFO = 0x400 + LANDLOCK_ACCESS_FS_MAKE_REG = 0x100 + LANDLOCK_ACCESS_FS_MAKE_SOCK = 0x200 + LANDLOCK_ACCESS_FS_MAKE_SYM = 0x1000 + LANDLOCK_ACCESS_FS_READ_DIR = 0x8 + LANDLOCK_ACCESS_FS_READ_FILE = 0x4 + LANDLOCK_ACCESS_FS_REMOVE_DIR = 0x10 + LANDLOCK_ACCESS_FS_REMOVE_FILE = 0x20 + LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2 + LANDLOCK_CREATE_RULESET_VERSION = 0x1 LINUX_REBOOT_CMD_CAD_OFF = 0x0 LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef LINUX_REBOOT_CMD_HALT = 0xcdef0123 @@ -1382,6 +1397,8 @@ const ( MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 MADV_PAGEOUT = 0x15 + MADV_POPULATE_READ = 0x16 + MADV_POPULATE_WRITE = 0x17 MADV_RANDOM = 0x1 MADV_REMOVE = 0x9 MADV_SEQUENTIAL = 0x2 @@ -1636,11 +1653,12 @@ const ( NFNL_MSG_BATCH_END = 0x11 NFNL_NFA_NEST = 0x8000 NFNL_SUBSYS_ACCT = 0x7 - NFNL_SUBSYS_COUNT = 0xc + NFNL_SUBSYS_COUNT = 0xd NFNL_SUBSYS_CTHELPER = 0x9 NFNL_SUBSYS_CTNETLINK = 0x1 NFNL_SUBSYS_CTNETLINK_EXP = 0x2 NFNL_SUBSYS_CTNETLINK_TIMEOUT = 0x8 + NFNL_SUBSYS_HOOK = 0xc NFNL_SUBSYS_IPSET = 0x6 NFNL_SUBSYS_NFTABLES = 0xa NFNL_SUBSYS_NFT_COMPAT = 0xb @@ -1756,14 +1774,19 @@ const ( PERF_ATTR_SIZE_VER4 = 0x68 PERF_ATTR_SIZE_VER5 = 0x70 PERF_ATTR_SIZE_VER6 = 0x78 + PERF_ATTR_SIZE_VER7 = 0x80 PERF_AUX_FLAG_COLLISION = 0x8 + PERF_AUX_FLAG_CORESIGHT_FORMAT_CORESIGHT = 0x0 + PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW = 0x100 PERF_AUX_FLAG_OVERWRITE = 0x2 PERF_AUX_FLAG_PARTIAL = 0x4 + PERF_AUX_FLAG_PMU_FORMAT_TYPE_MASK = 0xff00 PERF_AUX_FLAG_TRUNCATED = 0x1 PERF_FLAG_FD_CLOEXEC = 0x8 PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 + PERF_HW_EVENT_MASK = 0xffffffff PERF_MAX_CONTEXTS_PER_STACK = 0x8 PERF_MAX_STACK_DEPTH = 0x7f PERF_MEM_BLK_ADDR = 0x4 @@ -1822,6 +1845,7 @@ const ( PERF_MEM_TLB_OS = 0x40 PERF_MEM_TLB_SHIFT = 0x1a PERF_MEM_TLB_WK = 0x20 + PERF_PMU_TYPE_SHIFT = 0x20 PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER = 0x1 PERF_RECORD_MISC_COMM_EXEC = 0x2000 PERF_RECORD_MISC_CPUMODE_MASK = 0x7 @@ -1921,7 +1945,15 @@ const ( PR_PAC_APGAKEY = 0x10 PR_PAC_APIAKEY = 0x1 PR_PAC_APIBKEY = 0x2 + PR_PAC_GET_ENABLED_KEYS = 0x3d PR_PAC_RESET_KEYS = 0x36 + PR_PAC_SET_ENABLED_KEYS = 0x3c + PR_SCHED_CORE = 0x3e + PR_SCHED_CORE_CREATE = 0x1 + PR_SCHED_CORE_GET = 0x0 + PR_SCHED_CORE_MAX = 0x4 + PR_SCHED_CORE_SHARE_FROM = 0x3 + PR_SCHED_CORE_SHARE_TO = 0x2 PR_SET_CHILD_SUBREAPER = 0x24 PR_SET_DUMPABLE = 0x4 PR_SET_ENDIAN = 0x14 @@ -2003,6 +2035,7 @@ const ( PTRACE_GETREGSET = 0x4204 PTRACE_GETSIGINFO = 0x4202 PTRACE_GETSIGMASK = 0x420a + PTRACE_GET_RSEQ_CONFIGURATION = 0x420f PTRACE_GET_SYSCALL_INFO = 0x420e PTRACE_INTERRUPT = 0x4207 PTRACE_KILL = 0x8 @@ -2163,6 +2196,7 @@ const ( RTM_DELNEIGH = 0x1d RTM_DELNETCONF = 0x51 RTM_DELNEXTHOP = 0x69 + RTM_DELNEXTHOPBUCKET = 0x75 RTM_DELNSID = 0x59 RTM_DELQDISC = 0x25 RTM_DELROUTE = 0x19 @@ -2193,6 +2227,7 @@ const ( RTM_GETNEIGHTBL = 0x42 RTM_GETNETCONF = 0x52 RTM_GETNEXTHOP = 0x6a + RTM_GETNEXTHOPBUCKET = 0x76 RTM_GETNSID = 0x5a RTM_GETQDISC = 0x26 RTM_GETROUTE = 0x1a @@ -2201,7 +2236,7 @@ const ( RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e RTM_GETVLAN = 0x72 - RTM_MAX = 0x73 + RTM_MAX = 0x77 RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 @@ -2215,6 +2250,7 @@ const ( RTM_NEWNEIGHTBL = 0x40 RTM_NEWNETCONF = 0x50 RTM_NEWNEXTHOP = 0x68 + RTM_NEWNEXTHOPBUCKET = 0x74 RTM_NEWNSID = 0x58 RTM_NEWNVLAN = 0x70 RTM_NEWPREFIX = 0x34 @@ -2224,8 +2260,8 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x19 - RTM_NR_MSGTYPES = 0x64 + RTM_NR_FAMILIES = 0x1a + RTM_NR_MSGTYPES = 0x68 RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 @@ -2253,6 +2289,7 @@ const ( RTPROT_MROUTED = 0x11 RTPROT_MRT = 0xa RTPROT_NTK = 0xf + RTPROT_OPENR = 0x63 RTPROT_OSPF = 0xbc RTPROT_RA = 0x9 RTPROT_REDIRECT = 0x1 @@ -2283,7 +2320,14 @@ const ( SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 + SECRETMEM_MAGIC = 0x5345434d SECURITYFS_MAGIC = 0x73636673 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_MAX = 0x4 + SEEK_SET = 0x0 SELINUX_MAGIC = 0xf97cff8c SHUT_RD = 0x0 SHUT_RDWR = 0x2 @@ -2530,6 +2574,14 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCPOPT_EOL = 0x0 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_TSTAMP_HDR = 0x101080a + TCPOPT_WINDOW = 0x3 TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 09fc559ed..697811a46 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -147,6 +147,7 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 OTPGETREGIONCOUNT = 0x40044d0e OTPGETREGIONINFO = 0x400c4d0f OTPLOCK = 0x800c4d10 @@ -308,6 +309,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 75730cc22..7d8d93bfc 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -147,6 +147,7 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 OTPGETREGIONCOUNT = 0x40044d0e OTPGETREGIONINFO = 0x400c4d0f OTPLOCK = 0x800c4d10 @@ -309,6 +310,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 127cf17ad..f707d5089 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -145,6 +145,7 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 OTPGETREGIONCOUNT = 0x40044d0e OTPGETREGIONINFO = 0x400c4d0f OTPLOCK = 0x800c4d10 @@ -315,6 +316,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 957ca1ff1..3a67a9c85 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -148,6 +148,7 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 OTPGETREGIONCOUNT = 0x40044d0e OTPGETREGIONINFO = 0x400c4d0f OTPLOCK = 0x800c4d10 @@ -305,6 +306,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 314a2054f..a7ccef56c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -145,6 +145,7 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x800c4d19 OTPGETREGIONCOUNT = 0x80044d0e OTPGETREGIONINFO = 0x800c4d0f OTPLOCK = 0x400c4d10 @@ -308,6 +309,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 457e8de97..f7b7cec91 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -145,6 +145,7 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x800c4d19 OTPGETREGIONCOUNT = 0x80044d0e OTPGETREGIONINFO = 0x800c4d0f OTPLOCK = 0x400c4d10 @@ -308,6 +309,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index 33cd28f6b..4fcacf958 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -145,6 +145,7 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x800c4d19 OTPGETREGIONCOUNT = 0x80044d0e OTPGETREGIONINFO = 0x800c4d0f OTPLOCK = 0x400c4d10 @@ -308,6 +309,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 0e085ba14..6f6c223a2 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -145,6 +145,7 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x800c4d19 OTPGETREGIONCOUNT = 0x80044d0e OTPGETREGIONINFO = 0x800c4d0f OTPLOCK = 0x400c4d10 @@ -308,6 +309,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index 1b5928cff..59e522bcf 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -147,6 +147,7 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x4 ONLCR = 0x2 + OTPERASE = 0x800c4d19 OTPGETREGIONCOUNT = 0x80044d0e OTPGETREGIONINFO = 0x800c4d0f OTPLOCK = 0x400c4d10 @@ -363,6 +364,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index f3a41d6ec..d4264a0f7 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -147,6 +147,7 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x4 ONLCR = 0x2 + OTPERASE = 0x800c4d19 OTPGETREGIONCOUNT = 0x80044d0e OTPGETREGIONINFO = 0x800c4d0f OTPLOCK = 0x400c4d10 @@ -367,6 +368,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 6a5a555d5..21cbec1dd 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -147,6 +147,7 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x4 ONLCR = 0x2 + OTPERASE = 0x800c4d19 OTPGETREGIONCOUNT = 0x80044d0e OTPGETREGIONINFO = 0x800c4d0f OTPLOCK = 0x400c4d10 @@ -367,6 +368,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index a4da67edb..9b05bf12f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -145,6 +145,7 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 OTPGETREGIONCOUNT = 0x40044d0e OTPGETREGIONINFO = 0x400c4d0f OTPLOCK = 0x800c4d10 @@ -296,6 +297,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index a7028e0ef..bd82ace09 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -145,6 +145,7 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 OTPGETREGIONCOUNT = 0x40044d0e OTPGETREGIONINFO = 0x400c4d0f OTPLOCK = 0x800c4d10 @@ -371,6 +372,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index ed3b3286c..1f8bded56 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -150,6 +150,7 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x800c4d19 OTPGETREGIONCOUNT = 0x80044d0e OTPGETREGIONINFO = 0x800c4d0f OTPLOCK = 0x400c4d10 @@ -362,6 +363,7 @@ const ( SO_MARK = 0x22 SO_MAX_PACING_RATE = 0x31 SO_MEMINFO = 0x39 + SO_NETNS_COOKIE = 0x50 SO_NOFCS = 0x27 SO_OOBINLINE = 0x100 SO_PASSCRED = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go index 593cc0fef..6d56edc05 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go @@ -1020,7 +1020,10 @@ const ( RLIMIT_CPU = 0x0 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go index a4e4c2231..aef6c0856 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go @@ -1020,7 +1020,10 @@ const ( RLIMIT_CPU = 0x0 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index d4efe8d45..0ae0ed4cb 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -734,6 +734,65 @@ var libc_sendfile_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) { + r0, _, e1 := syscall_syscall(libc_shmat_trampoline_addr, uintptr(id), uintptr(addr), uintptr(flag)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmat shmat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) { + r0, _, e1 := syscall_syscall(libc_shmctl_trampoline_addr, uintptr(id), uintptr(cmd), uintptr(unsafe.Pointer(buf))) + result = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmctl shmctl "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmdt(addr uintptr) (err error) { + _, _, e1 := syscall_syscall(libc_shmdt_trampoline_addr, uintptr(addr), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmdt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmdt shmdt "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmget(key int, size int, flag int) (id int, err error) { + r0, _, e1 := syscall_syscall(libc_shmget_trampoline_addr, uintptr(key), uintptr(size), uintptr(flag)) + id = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmget_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmget shmget "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index bc169c2ab..eac6ca806 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -264,6 +264,30 @@ TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 DATA ·libc_sendfile_trampoline_addr(SB)/8, $libc_sendfile_trampoline<>(SB) +TEXT libc_shmat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmat(SB) + +GLOBL ·libc_shmat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmat_trampoline_addr(SB)/8, $libc_shmat_trampoline<>(SB) + +TEXT libc_shmctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmctl(SB) + +GLOBL ·libc_shmctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmctl_trampoline_addr(SB)/8, $libc_shmctl_trampoline<>(SB) + +TEXT libc_shmdt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmdt(SB) + +GLOBL ·libc_shmdt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmdt_trampoline_addr(SB)/8, $libc_shmdt_trampoline<>(SB) + +TEXT libc_shmget_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmget(SB) + +GLOBL ·libc_shmget_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmget_trampoline_addr(SB)/8, $libc_shmget_trampoline<>(SB) + TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_access(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index f2ee2bd33..cf71be3ed 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -734,6 +734,65 @@ var libc_sendfile_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) { + r0, _, e1 := syscall_syscall(libc_shmat_trampoline_addr, uintptr(id), uintptr(addr), uintptr(flag)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmat shmat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) { + r0, _, e1 := syscall_syscall(libc_shmctl_trampoline_addr, uintptr(id), uintptr(cmd), uintptr(unsafe.Pointer(buf))) + result = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmctl shmctl "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmdt(addr uintptr) (err error) { + _, _, e1 := syscall_syscall(libc_shmdt_trampoline_addr, uintptr(addr), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmdt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmdt shmdt "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmget(key int, size int, flag int) (id int, err error) { + r0, _, e1 := syscall_syscall(libc_shmget_trampoline_addr, uintptr(key), uintptr(size), uintptr(flag)) + id = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmget_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmget shmget "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s index 33e19776d..4ebcf2175 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s @@ -264,6 +264,30 @@ TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 DATA ·libc_sendfile_trampoline_addr(SB)/8, $libc_sendfile_trampoline<>(SB) +TEXT libc_shmat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmat(SB) + +GLOBL ·libc_shmat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmat_trampoline_addr(SB)/8, $libc_shmat_trampoline<>(SB) + +TEXT libc_shmctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmctl(SB) + +GLOBL ·libc_shmctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmctl_trampoline_addr(SB)/8, $libc_shmctl_trampoline<>(SB) + +TEXT libc_shmdt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmdt(SB) + +GLOBL ·libc_shmdt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmdt_trampoline_addr(SB)/8, $libc_shmdt_trampoline<>(SB) + +TEXT libc_shmget_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmget(SB) + +GLOBL ·libc_shmget_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmget_trampoline_addr(SB)/8, $libc_shmget_trampoline<>(SB) + TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_access(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 7305cc915..4f5da1f54 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -48,6 +48,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -100,6 +110,16 @@ func openat2(dirfd int, path string, open_how *OpenHow, size int) (fd int, err e // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -1201,7 +1221,7 @@ func PivotRoot(newroot string, putold string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) { +func Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) { _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0) if e1 != 0 { err = errnoErr(e1) @@ -1935,8 +1955,63 @@ func ProcessVMWritev(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags u // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) +func PidfdOpen(pid int, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_PIDFD_OPEN, uintptr(pid), uintptr(flags), 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func PidfdGetfd(pidfd int, targetfd int, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_PIDFD_GETFD, uintptr(pidfd), uintptr(targetfd), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) { + r0, _, e1 := Syscall(SYS_SHMAT, uintptr(id), uintptr(addr), uintptr(flag)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) { + r0, _, e1 := Syscall(SYS_SHMCTL, uintptr(id), uintptr(cmd), uintptr(unsafe.Pointer(buf))) + result = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmdt(addr uintptr) (err error) { + _, _, e1 := Syscall(SYS_SHMDT, uintptr(addr), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmget(key int, size int, flag int) (id int, err error) { + r0, _, e1 := Syscall(SYS_SHMGET, uintptr(key), uintptr(size), uintptr(flag)) + id = int(r0) if e1 != 0 { err = errnoErr(e1) } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index e37096e4d..ff90c81e7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -46,37 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -181,17 +150,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -566,14 +524,3 @@ func utimes(path string, times *[2]Timeval) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index 9919d8486..fa7d3dbe4 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -46,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -191,17 +170,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func inotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -711,27 +679,6 @@ func utimes(path string, times *[2]Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(cmdline) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index 076754d48..654f91530 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -46,16 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) @@ -235,27 +225,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -340,17 +309,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -681,17 +639,6 @@ func setrlimit(resource int, rlim *rlimit32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func armSyncFileRange(fd int, flags int, off int64, n int64) (err error) { _, _, e1 := Syscall6(SYS_ARM_SYNC_FILE_RANGE, uintptr(fd), uintptr(flags), uintptr(off), uintptr(off>>32), uintptr(n), uintptr(n>>32)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go index 4703cf3c3..6d1552885 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go @@ -46,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -544,17 +523,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -706,18 +674,6 @@ func Pause() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe() (p1 int, p2 int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - p1 = int(r0) - p2 = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) { r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset)) xaddr = uintptr(r0) @@ -746,14 +702,3 @@ func setrlimit(resource int, rlim *rlimit32) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go index a134f9a4d..1e20d72df 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go @@ -46,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -717,14 +696,3 @@ func stat(path string, st *stat_t) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go index b1fff2d94..82b5e2d9e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go @@ -46,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -717,14 +696,3 @@ func stat(path string, st *stat_t) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go index d13d6da01..a0440c1d4 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go @@ -46,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -544,17 +523,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -706,18 +674,6 @@ func Pause() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe() (p1 int, p2 int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - p1 = int(r0) - p2 = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) { r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset)) xaddr = uintptr(r0) @@ -746,14 +702,3 @@ func setrlimit(resource int, rlim *rlimit32) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go index 927cf1a00..5864b9ca6 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go @@ -46,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -161,17 +140,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -717,27 +685,6 @@ func setrlimit(resource int, rlim *rlimit32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(flags), uintptr(off>>32), uintptr(off), uintptr(n>>32), uintptr(n)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index da8ec0396..beeb49e34 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -46,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -191,17 +170,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -763,27 +731,6 @@ func utimes(path string, times *[2]Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(flags), uintptr(off), uintptr(n), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index 083f493bb..53139b82c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -46,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -191,17 +170,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -763,27 +731,6 @@ func utimes(path string, times *[2]Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(flags), uintptr(off), uintptr(n), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index bb347407d..202add37d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -46,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -191,17 +170,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -553,17 +521,6 @@ func utimes(path string, times *[2]Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(cmdline) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go index 8edc517e1..2ab268c34 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go @@ -73,16 +73,6 @@ func Fadvise(fd int, offset int64, length int64, advice int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { @@ -180,17 +170,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -718,24 +697,3 @@ func utimes(path string, times *[2]Timeval) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index 4e18d5c99..b5f926cee 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -141,6 +141,11 @@ import ( //go:cgo_import_dynamic libc_getpeername getpeername "libsocket.so" //go:cgo_import_dynamic libc_setsockopt setsockopt "libsocket.so" //go:cgo_import_dynamic libc_recvfrom recvfrom "libsocket.so" +//go:cgo_import_dynamic libc_port_create port_create "libc.so" +//go:cgo_import_dynamic libc_port_associate port_associate "libc.so" +//go:cgo_import_dynamic libc_port_dissociate port_dissociate "libc.so" +//go:cgo_import_dynamic libc_port_get port_get "libc.so" +//go:cgo_import_dynamic libc_port_getn port_getn "libc.so" //go:linkname procpipe libc_pipe //go:linkname procpipe2 libc_pipe2 @@ -272,6 +277,11 @@ import ( //go:linkname procgetpeername libc_getpeername //go:linkname procsetsockopt libc_setsockopt //go:linkname procrecvfrom libc_recvfrom +//go:linkname procport_create libc_port_create +//go:linkname procport_associate libc_port_associate +//go:linkname procport_dissociate libc_port_dissociate +//go:linkname procport_get libc_port_get +//go:linkname procport_getn libc_port_getn var ( procpipe, @@ -403,7 +413,12 @@ var ( proc__xnet_getsockopt, procgetpeername, procsetsockopt, - procrecvfrom syscallFunc + procrecvfrom, + procport_create, + procport_associate, + procport_dissociate, + procport_get, + procport_getn syscallFunc ) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1981,3 +1996,58 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_create() (n int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_create)), 0, 0, 0, 0, 0, 0, 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_associate(port int, source int, object uintptr, events int, user *byte) (n int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_associate)), 5, uintptr(port), uintptr(source), uintptr(object), uintptr(events), uintptr(unsafe.Pointer(user)), 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_dissociate(port int, source int, object uintptr) (n int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_dissociate)), 3, uintptr(port), uintptr(source), uintptr(object), 0, 0, 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_get(port int, pe *portEvent, timeout *Timespec) (n int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_get)), 3, uintptr(port), uintptr(unsafe.Pointer(pe)), uintptr(unsafe.Pointer(timeout)), 0, 0, 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_getn(port int, pe *portEvent, max uint32, nget *uint32, timeout *Timespec) (n int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_getn)), 5, uintptr(port), uintptr(unsafe.Pointer(pe)), uintptr(max), uintptr(unsafe.Pointer(nget)), uintptr(unsafe.Pointer(timeout)), 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index fbc59b7fd..aa7ce85d1 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -439,4 +439,9 @@ const ( SYS_PROCESS_MADVISE = 440 SYS_EPOLL_PWAIT2 = 441 SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_MEMFD_SECRET = 447 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 04d16d771..b83032638 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -7,358 +7,363 @@ package unix const ( - SYS_READ = 0 - SYS_WRITE = 1 - SYS_OPEN = 2 - SYS_CLOSE = 3 - SYS_STAT = 4 - SYS_FSTAT = 5 - SYS_LSTAT = 6 - SYS_POLL = 7 - SYS_LSEEK = 8 - SYS_MMAP = 9 - SYS_MPROTECT = 10 - SYS_MUNMAP = 11 - SYS_BRK = 12 - SYS_RT_SIGACTION = 13 - SYS_RT_SIGPROCMASK = 14 - SYS_RT_SIGRETURN = 15 - SYS_IOCTL = 16 - SYS_PREAD64 = 17 - SYS_PWRITE64 = 18 - SYS_READV = 19 - SYS_WRITEV = 20 - SYS_ACCESS = 21 - SYS_PIPE = 22 - SYS_SELECT = 23 - SYS_SCHED_YIELD = 24 - SYS_MREMAP = 25 - SYS_MSYNC = 26 - SYS_MINCORE = 27 - SYS_MADVISE = 28 - SYS_SHMGET = 29 - SYS_SHMAT = 30 - SYS_SHMCTL = 31 - SYS_DUP = 32 - SYS_DUP2 = 33 - SYS_PAUSE = 34 - SYS_NANOSLEEP = 35 - SYS_GETITIMER = 36 - SYS_ALARM = 37 - SYS_SETITIMER = 38 - SYS_GETPID = 39 - SYS_SENDFILE = 40 - SYS_SOCKET = 41 - SYS_CONNECT = 42 - SYS_ACCEPT = 43 - SYS_SENDTO = 44 - SYS_RECVFROM = 45 - SYS_SENDMSG = 46 - SYS_RECVMSG = 47 - SYS_SHUTDOWN = 48 - SYS_BIND = 49 - SYS_LISTEN = 50 - SYS_GETSOCKNAME = 51 - SYS_GETPEERNAME = 52 - SYS_SOCKETPAIR = 53 - SYS_SETSOCKOPT = 54 - SYS_GETSOCKOPT = 55 - SYS_CLONE = 56 - SYS_FORK = 57 - SYS_VFORK = 58 - SYS_EXECVE = 59 - SYS_EXIT = 60 - SYS_WAIT4 = 61 - SYS_KILL = 62 - SYS_UNAME = 63 - SYS_SEMGET = 64 - SYS_SEMOP = 65 - SYS_SEMCTL = 66 - SYS_SHMDT = 67 - SYS_MSGGET = 68 - SYS_MSGSND = 69 - SYS_MSGRCV = 70 - SYS_MSGCTL = 71 - SYS_FCNTL = 72 - SYS_FLOCK = 73 - SYS_FSYNC = 74 - SYS_FDATASYNC = 75 - SYS_TRUNCATE = 76 - SYS_FTRUNCATE = 77 - SYS_GETDENTS = 78 - SYS_GETCWD = 79 - SYS_CHDIR = 80 - SYS_FCHDIR = 81 - SYS_RENAME = 82 - SYS_MKDIR = 83 - SYS_RMDIR = 84 - SYS_CREAT = 85 - SYS_LINK = 86 - SYS_UNLINK = 87 - SYS_SYMLINK = 88 - SYS_READLINK = 89 - SYS_CHMOD = 90 - SYS_FCHMOD = 91 - SYS_CHOWN = 92 - SYS_FCHOWN = 93 - SYS_LCHOWN = 94 - SYS_UMASK = 95 - SYS_GETTIMEOFDAY = 96 - SYS_GETRLIMIT = 97 - SYS_GETRUSAGE = 98 - SYS_SYSINFO = 99 - SYS_TIMES = 100 - SYS_PTRACE = 101 - SYS_GETUID = 102 - SYS_SYSLOG = 103 - SYS_GETGID = 104 - SYS_SETUID = 105 - SYS_SETGID = 106 - SYS_GETEUID = 107 - SYS_GETEGID = 108 - SYS_SETPGID = 109 - SYS_GETPPID = 110 - SYS_GETPGRP = 111 - SYS_SETSID = 112 - SYS_SETREUID = 113 - SYS_SETREGID = 114 - SYS_GETGROUPS = 115 - SYS_SETGROUPS = 116 - SYS_SETRESUID = 117 - SYS_GETRESUID = 118 - SYS_SETRESGID = 119 - SYS_GETRESGID = 120 - SYS_GETPGID = 121 - SYS_SETFSUID = 122 - SYS_SETFSGID = 123 - SYS_GETSID = 124 - SYS_CAPGET = 125 - SYS_CAPSET = 126 - SYS_RT_SIGPENDING = 127 - SYS_RT_SIGTIMEDWAIT = 128 - SYS_RT_SIGQUEUEINFO = 129 - SYS_RT_SIGSUSPEND = 130 - SYS_SIGALTSTACK = 131 - SYS_UTIME = 132 - SYS_MKNOD = 133 - SYS_USELIB = 134 - SYS_PERSONALITY = 135 - SYS_USTAT = 136 - SYS_STATFS = 137 - SYS_FSTATFS = 138 - SYS_SYSFS = 139 - SYS_GETPRIORITY = 140 - SYS_SETPRIORITY = 141 - SYS_SCHED_SETPARAM = 142 - SYS_SCHED_GETPARAM = 143 - SYS_SCHED_SETSCHEDULER = 144 - SYS_SCHED_GETSCHEDULER = 145 - SYS_SCHED_GET_PRIORITY_MAX = 146 - SYS_SCHED_GET_PRIORITY_MIN = 147 - SYS_SCHED_RR_GET_INTERVAL = 148 - SYS_MLOCK = 149 - SYS_MUNLOCK = 150 - SYS_MLOCKALL = 151 - SYS_MUNLOCKALL = 152 - SYS_VHANGUP = 153 - SYS_MODIFY_LDT = 154 - SYS_PIVOT_ROOT = 155 - SYS__SYSCTL = 156 - SYS_PRCTL = 157 - SYS_ARCH_PRCTL = 158 - SYS_ADJTIMEX = 159 - SYS_SETRLIMIT = 160 - SYS_CHROOT = 161 - SYS_SYNC = 162 - SYS_ACCT = 163 - SYS_SETTIMEOFDAY = 164 - SYS_MOUNT = 165 - SYS_UMOUNT2 = 166 - SYS_SWAPON = 167 - SYS_SWAPOFF = 168 - SYS_REBOOT = 169 - SYS_SETHOSTNAME = 170 - SYS_SETDOMAINNAME = 171 - SYS_IOPL = 172 - SYS_IOPERM = 173 - SYS_CREATE_MODULE = 174 - SYS_INIT_MODULE = 175 - SYS_DELETE_MODULE = 176 - SYS_GET_KERNEL_SYMS = 177 - SYS_QUERY_MODULE = 178 - SYS_QUOTACTL = 179 - SYS_NFSSERVCTL = 180 - SYS_GETPMSG = 181 - SYS_PUTPMSG = 182 - SYS_AFS_SYSCALL = 183 - SYS_TUXCALL = 184 - SYS_SECURITY = 185 - SYS_GETTID = 186 - SYS_READAHEAD = 187 - SYS_SETXATTR = 188 - SYS_LSETXATTR = 189 - SYS_FSETXATTR = 190 - SYS_GETXATTR = 191 - SYS_LGETXATTR = 192 - SYS_FGETXATTR = 193 - SYS_LISTXATTR = 194 - SYS_LLISTXATTR = 195 - SYS_FLISTXATTR = 196 - SYS_REMOVEXATTR = 197 - SYS_LREMOVEXATTR = 198 - SYS_FREMOVEXATTR = 199 - SYS_TKILL = 200 - SYS_TIME = 201 - SYS_FUTEX = 202 - SYS_SCHED_SETAFFINITY = 203 - SYS_SCHED_GETAFFINITY = 204 - SYS_SET_THREAD_AREA = 205 - SYS_IO_SETUP = 206 - SYS_IO_DESTROY = 207 - SYS_IO_GETEVENTS = 208 - SYS_IO_SUBMIT = 209 - SYS_IO_CANCEL = 210 - SYS_GET_THREAD_AREA = 211 - SYS_LOOKUP_DCOOKIE = 212 - SYS_EPOLL_CREATE = 213 - SYS_EPOLL_CTL_OLD = 214 - SYS_EPOLL_WAIT_OLD = 215 - SYS_REMAP_FILE_PAGES = 216 - SYS_GETDENTS64 = 217 - SYS_SET_TID_ADDRESS = 218 - SYS_RESTART_SYSCALL = 219 - SYS_SEMTIMEDOP = 220 - SYS_FADVISE64 = 221 - SYS_TIMER_CREATE = 222 - SYS_TIMER_SETTIME = 223 - SYS_TIMER_GETTIME = 224 - SYS_TIMER_GETOVERRUN = 225 - SYS_TIMER_DELETE = 226 - SYS_CLOCK_SETTIME = 227 - SYS_CLOCK_GETTIME = 228 - SYS_CLOCK_GETRES = 229 - SYS_CLOCK_NANOSLEEP = 230 - SYS_EXIT_GROUP = 231 - SYS_EPOLL_WAIT = 232 - SYS_EPOLL_CTL = 233 - SYS_TGKILL = 234 - SYS_UTIMES = 235 - SYS_VSERVER = 236 - SYS_MBIND = 237 - SYS_SET_MEMPOLICY = 238 - SYS_GET_MEMPOLICY = 239 - SYS_MQ_OPEN = 240 - SYS_MQ_UNLINK = 241 - SYS_MQ_TIMEDSEND = 242 - SYS_MQ_TIMEDRECEIVE = 243 - SYS_MQ_NOTIFY = 244 - SYS_MQ_GETSETATTR = 245 - SYS_KEXEC_LOAD = 246 - SYS_WAITID = 247 - SYS_ADD_KEY = 248 - SYS_REQUEST_KEY = 249 - SYS_KEYCTL = 250 - SYS_IOPRIO_SET = 251 - SYS_IOPRIO_GET = 252 - SYS_INOTIFY_INIT = 253 - SYS_INOTIFY_ADD_WATCH = 254 - SYS_INOTIFY_RM_WATCH = 255 - SYS_MIGRATE_PAGES = 256 - SYS_OPENAT = 257 - SYS_MKDIRAT = 258 - SYS_MKNODAT = 259 - SYS_FCHOWNAT = 260 - SYS_FUTIMESAT = 261 - SYS_NEWFSTATAT = 262 - SYS_UNLINKAT = 263 - SYS_RENAMEAT = 264 - SYS_LINKAT = 265 - SYS_SYMLINKAT = 266 - SYS_READLINKAT = 267 - SYS_FCHMODAT = 268 - SYS_FACCESSAT = 269 - SYS_PSELECT6 = 270 - SYS_PPOLL = 271 - SYS_UNSHARE = 272 - SYS_SET_ROBUST_LIST = 273 - SYS_GET_ROBUST_LIST = 274 - SYS_SPLICE = 275 - SYS_TEE = 276 - SYS_SYNC_FILE_RANGE = 277 - SYS_VMSPLICE = 278 - SYS_MOVE_PAGES = 279 - SYS_UTIMENSAT = 280 - SYS_EPOLL_PWAIT = 281 - SYS_SIGNALFD = 282 - SYS_TIMERFD_CREATE = 283 - SYS_EVENTFD = 284 - SYS_FALLOCATE = 285 - SYS_TIMERFD_SETTIME = 286 - SYS_TIMERFD_GETTIME = 287 - SYS_ACCEPT4 = 288 - SYS_SIGNALFD4 = 289 - SYS_EVENTFD2 = 290 - SYS_EPOLL_CREATE1 = 291 - SYS_DUP3 = 292 - SYS_PIPE2 = 293 - SYS_INOTIFY_INIT1 = 294 - SYS_PREADV = 295 - SYS_PWRITEV = 296 - SYS_RT_TGSIGQUEUEINFO = 297 - SYS_PERF_EVENT_OPEN = 298 - SYS_RECVMMSG = 299 - SYS_FANOTIFY_INIT = 300 - SYS_FANOTIFY_MARK = 301 - SYS_PRLIMIT64 = 302 - SYS_NAME_TO_HANDLE_AT = 303 - SYS_OPEN_BY_HANDLE_AT = 304 - SYS_CLOCK_ADJTIME = 305 - SYS_SYNCFS = 306 - SYS_SENDMMSG = 307 - SYS_SETNS = 308 - SYS_GETCPU = 309 - SYS_PROCESS_VM_READV = 310 - SYS_PROCESS_VM_WRITEV = 311 - SYS_KCMP = 312 - SYS_FINIT_MODULE = 313 - SYS_SCHED_SETATTR = 314 - SYS_SCHED_GETATTR = 315 - SYS_RENAMEAT2 = 316 - SYS_SECCOMP = 317 - SYS_GETRANDOM = 318 - SYS_MEMFD_CREATE = 319 - SYS_KEXEC_FILE_LOAD = 320 - SYS_BPF = 321 - SYS_EXECVEAT = 322 - SYS_USERFAULTFD = 323 - SYS_MEMBARRIER = 324 - SYS_MLOCK2 = 325 - SYS_COPY_FILE_RANGE = 326 - SYS_PREADV2 = 327 - SYS_PWRITEV2 = 328 - SYS_PKEY_MPROTECT = 329 - SYS_PKEY_ALLOC = 330 - SYS_PKEY_FREE = 331 - SYS_STATX = 332 - SYS_IO_PGETEVENTS = 333 - SYS_RSEQ = 334 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_CLOSE_RANGE = 436 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 - SYS_FACCESSAT2 = 439 - SYS_PROCESS_MADVISE = 440 - SYS_EPOLL_PWAIT2 = 441 - SYS_MOUNT_SETATTR = 442 + SYS_READ = 0 + SYS_WRITE = 1 + SYS_OPEN = 2 + SYS_CLOSE = 3 + SYS_STAT = 4 + SYS_FSTAT = 5 + SYS_LSTAT = 6 + SYS_POLL = 7 + SYS_LSEEK = 8 + SYS_MMAP = 9 + SYS_MPROTECT = 10 + SYS_MUNMAP = 11 + SYS_BRK = 12 + SYS_RT_SIGACTION = 13 + SYS_RT_SIGPROCMASK = 14 + SYS_RT_SIGRETURN = 15 + SYS_IOCTL = 16 + SYS_PREAD64 = 17 + SYS_PWRITE64 = 18 + SYS_READV = 19 + SYS_WRITEV = 20 + SYS_ACCESS = 21 + SYS_PIPE = 22 + SYS_SELECT = 23 + SYS_SCHED_YIELD = 24 + SYS_MREMAP = 25 + SYS_MSYNC = 26 + SYS_MINCORE = 27 + SYS_MADVISE = 28 + SYS_SHMGET = 29 + SYS_SHMAT = 30 + SYS_SHMCTL = 31 + SYS_DUP = 32 + SYS_DUP2 = 33 + SYS_PAUSE = 34 + SYS_NANOSLEEP = 35 + SYS_GETITIMER = 36 + SYS_ALARM = 37 + SYS_SETITIMER = 38 + SYS_GETPID = 39 + SYS_SENDFILE = 40 + SYS_SOCKET = 41 + SYS_CONNECT = 42 + SYS_ACCEPT = 43 + SYS_SENDTO = 44 + SYS_RECVFROM = 45 + SYS_SENDMSG = 46 + SYS_RECVMSG = 47 + SYS_SHUTDOWN = 48 + SYS_BIND = 49 + SYS_LISTEN = 50 + SYS_GETSOCKNAME = 51 + SYS_GETPEERNAME = 52 + SYS_SOCKETPAIR = 53 + SYS_SETSOCKOPT = 54 + SYS_GETSOCKOPT = 55 + SYS_CLONE = 56 + SYS_FORK = 57 + SYS_VFORK = 58 + SYS_EXECVE = 59 + SYS_EXIT = 60 + SYS_WAIT4 = 61 + SYS_KILL = 62 + SYS_UNAME = 63 + SYS_SEMGET = 64 + SYS_SEMOP = 65 + SYS_SEMCTL = 66 + SYS_SHMDT = 67 + SYS_MSGGET = 68 + SYS_MSGSND = 69 + SYS_MSGRCV = 70 + SYS_MSGCTL = 71 + SYS_FCNTL = 72 + SYS_FLOCK = 73 + SYS_FSYNC = 74 + SYS_FDATASYNC = 75 + SYS_TRUNCATE = 76 + SYS_FTRUNCATE = 77 + SYS_GETDENTS = 78 + SYS_GETCWD = 79 + SYS_CHDIR = 80 + SYS_FCHDIR = 81 + SYS_RENAME = 82 + SYS_MKDIR = 83 + SYS_RMDIR = 84 + SYS_CREAT = 85 + SYS_LINK = 86 + SYS_UNLINK = 87 + SYS_SYMLINK = 88 + SYS_READLINK = 89 + SYS_CHMOD = 90 + SYS_FCHMOD = 91 + SYS_CHOWN = 92 + SYS_FCHOWN = 93 + SYS_LCHOWN = 94 + SYS_UMASK = 95 + SYS_GETTIMEOFDAY = 96 + SYS_GETRLIMIT = 97 + SYS_GETRUSAGE = 98 + SYS_SYSINFO = 99 + SYS_TIMES = 100 + SYS_PTRACE = 101 + SYS_GETUID = 102 + SYS_SYSLOG = 103 + SYS_GETGID = 104 + SYS_SETUID = 105 + SYS_SETGID = 106 + SYS_GETEUID = 107 + SYS_GETEGID = 108 + SYS_SETPGID = 109 + SYS_GETPPID = 110 + SYS_GETPGRP = 111 + SYS_SETSID = 112 + SYS_SETREUID = 113 + SYS_SETREGID = 114 + SYS_GETGROUPS = 115 + SYS_SETGROUPS = 116 + SYS_SETRESUID = 117 + SYS_GETRESUID = 118 + SYS_SETRESGID = 119 + SYS_GETRESGID = 120 + SYS_GETPGID = 121 + SYS_SETFSUID = 122 + SYS_SETFSGID = 123 + SYS_GETSID = 124 + SYS_CAPGET = 125 + SYS_CAPSET = 126 + SYS_RT_SIGPENDING = 127 + SYS_RT_SIGTIMEDWAIT = 128 + SYS_RT_SIGQUEUEINFO = 129 + SYS_RT_SIGSUSPEND = 130 + SYS_SIGALTSTACK = 131 + SYS_UTIME = 132 + SYS_MKNOD = 133 + SYS_USELIB = 134 + SYS_PERSONALITY = 135 + SYS_USTAT = 136 + SYS_STATFS = 137 + SYS_FSTATFS = 138 + SYS_SYSFS = 139 + SYS_GETPRIORITY = 140 + SYS_SETPRIORITY = 141 + SYS_SCHED_SETPARAM = 142 + SYS_SCHED_GETPARAM = 143 + SYS_SCHED_SETSCHEDULER = 144 + SYS_SCHED_GETSCHEDULER = 145 + SYS_SCHED_GET_PRIORITY_MAX = 146 + SYS_SCHED_GET_PRIORITY_MIN = 147 + SYS_SCHED_RR_GET_INTERVAL = 148 + SYS_MLOCK = 149 + SYS_MUNLOCK = 150 + SYS_MLOCKALL = 151 + SYS_MUNLOCKALL = 152 + SYS_VHANGUP = 153 + SYS_MODIFY_LDT = 154 + SYS_PIVOT_ROOT = 155 + SYS__SYSCTL = 156 + SYS_PRCTL = 157 + SYS_ARCH_PRCTL = 158 + SYS_ADJTIMEX = 159 + SYS_SETRLIMIT = 160 + SYS_CHROOT = 161 + SYS_SYNC = 162 + SYS_ACCT = 163 + SYS_SETTIMEOFDAY = 164 + SYS_MOUNT = 165 + SYS_UMOUNT2 = 166 + SYS_SWAPON = 167 + SYS_SWAPOFF = 168 + SYS_REBOOT = 169 + SYS_SETHOSTNAME = 170 + SYS_SETDOMAINNAME = 171 + SYS_IOPL = 172 + SYS_IOPERM = 173 + SYS_CREATE_MODULE = 174 + SYS_INIT_MODULE = 175 + SYS_DELETE_MODULE = 176 + SYS_GET_KERNEL_SYMS = 177 + SYS_QUERY_MODULE = 178 + SYS_QUOTACTL = 179 + SYS_NFSSERVCTL = 180 + SYS_GETPMSG = 181 + SYS_PUTPMSG = 182 + SYS_AFS_SYSCALL = 183 + SYS_TUXCALL = 184 + SYS_SECURITY = 185 + SYS_GETTID = 186 + SYS_READAHEAD = 187 + SYS_SETXATTR = 188 + SYS_LSETXATTR = 189 + SYS_FSETXATTR = 190 + SYS_GETXATTR = 191 + SYS_LGETXATTR = 192 + SYS_FGETXATTR = 193 + SYS_LISTXATTR = 194 + SYS_LLISTXATTR = 195 + SYS_FLISTXATTR = 196 + SYS_REMOVEXATTR = 197 + SYS_LREMOVEXATTR = 198 + SYS_FREMOVEXATTR = 199 + SYS_TKILL = 200 + SYS_TIME = 201 + SYS_FUTEX = 202 + SYS_SCHED_SETAFFINITY = 203 + SYS_SCHED_GETAFFINITY = 204 + SYS_SET_THREAD_AREA = 205 + SYS_IO_SETUP = 206 + SYS_IO_DESTROY = 207 + SYS_IO_GETEVENTS = 208 + SYS_IO_SUBMIT = 209 + SYS_IO_CANCEL = 210 + SYS_GET_THREAD_AREA = 211 + SYS_LOOKUP_DCOOKIE = 212 + SYS_EPOLL_CREATE = 213 + SYS_EPOLL_CTL_OLD = 214 + SYS_EPOLL_WAIT_OLD = 215 + SYS_REMAP_FILE_PAGES = 216 + SYS_GETDENTS64 = 217 + SYS_SET_TID_ADDRESS = 218 + SYS_RESTART_SYSCALL = 219 + SYS_SEMTIMEDOP = 220 + SYS_FADVISE64 = 221 + SYS_TIMER_CREATE = 222 + SYS_TIMER_SETTIME = 223 + SYS_TIMER_GETTIME = 224 + SYS_TIMER_GETOVERRUN = 225 + SYS_TIMER_DELETE = 226 + SYS_CLOCK_SETTIME = 227 + SYS_CLOCK_GETTIME = 228 + SYS_CLOCK_GETRES = 229 + SYS_CLOCK_NANOSLEEP = 230 + SYS_EXIT_GROUP = 231 + SYS_EPOLL_WAIT = 232 + SYS_EPOLL_CTL = 233 + SYS_TGKILL = 234 + SYS_UTIMES = 235 + SYS_VSERVER = 236 + SYS_MBIND = 237 + SYS_SET_MEMPOLICY = 238 + SYS_GET_MEMPOLICY = 239 + SYS_MQ_OPEN = 240 + SYS_MQ_UNLINK = 241 + SYS_MQ_TIMEDSEND = 242 + SYS_MQ_TIMEDRECEIVE = 243 + SYS_MQ_NOTIFY = 244 + SYS_MQ_GETSETATTR = 245 + SYS_KEXEC_LOAD = 246 + SYS_WAITID = 247 + SYS_ADD_KEY = 248 + SYS_REQUEST_KEY = 249 + SYS_KEYCTL = 250 + SYS_IOPRIO_SET = 251 + SYS_IOPRIO_GET = 252 + SYS_INOTIFY_INIT = 253 + SYS_INOTIFY_ADD_WATCH = 254 + SYS_INOTIFY_RM_WATCH = 255 + SYS_MIGRATE_PAGES = 256 + SYS_OPENAT = 257 + SYS_MKDIRAT = 258 + SYS_MKNODAT = 259 + SYS_FCHOWNAT = 260 + SYS_FUTIMESAT = 261 + SYS_NEWFSTATAT = 262 + SYS_UNLINKAT = 263 + SYS_RENAMEAT = 264 + SYS_LINKAT = 265 + SYS_SYMLINKAT = 266 + SYS_READLINKAT = 267 + SYS_FCHMODAT = 268 + SYS_FACCESSAT = 269 + SYS_PSELECT6 = 270 + SYS_PPOLL = 271 + SYS_UNSHARE = 272 + SYS_SET_ROBUST_LIST = 273 + SYS_GET_ROBUST_LIST = 274 + SYS_SPLICE = 275 + SYS_TEE = 276 + SYS_SYNC_FILE_RANGE = 277 + SYS_VMSPLICE = 278 + SYS_MOVE_PAGES = 279 + SYS_UTIMENSAT = 280 + SYS_EPOLL_PWAIT = 281 + SYS_SIGNALFD = 282 + SYS_TIMERFD_CREATE = 283 + SYS_EVENTFD = 284 + SYS_FALLOCATE = 285 + SYS_TIMERFD_SETTIME = 286 + SYS_TIMERFD_GETTIME = 287 + SYS_ACCEPT4 = 288 + SYS_SIGNALFD4 = 289 + SYS_EVENTFD2 = 290 + SYS_EPOLL_CREATE1 = 291 + SYS_DUP3 = 292 + SYS_PIPE2 = 293 + SYS_INOTIFY_INIT1 = 294 + SYS_PREADV = 295 + SYS_PWRITEV = 296 + SYS_RT_TGSIGQUEUEINFO = 297 + SYS_PERF_EVENT_OPEN = 298 + SYS_RECVMMSG = 299 + SYS_FANOTIFY_INIT = 300 + SYS_FANOTIFY_MARK = 301 + SYS_PRLIMIT64 = 302 + SYS_NAME_TO_HANDLE_AT = 303 + SYS_OPEN_BY_HANDLE_AT = 304 + SYS_CLOCK_ADJTIME = 305 + SYS_SYNCFS = 306 + SYS_SENDMMSG = 307 + SYS_SETNS = 308 + SYS_GETCPU = 309 + SYS_PROCESS_VM_READV = 310 + SYS_PROCESS_VM_WRITEV = 311 + SYS_KCMP = 312 + SYS_FINIT_MODULE = 313 + SYS_SCHED_SETATTR = 314 + SYS_SCHED_GETATTR = 315 + SYS_RENAMEAT2 = 316 + SYS_SECCOMP = 317 + SYS_GETRANDOM = 318 + SYS_MEMFD_CREATE = 319 + SYS_KEXEC_FILE_LOAD = 320 + SYS_BPF = 321 + SYS_EXECVEAT = 322 + SYS_USERFAULTFD = 323 + SYS_MEMBARRIER = 324 + SYS_MLOCK2 = 325 + SYS_COPY_FILE_RANGE = 326 + SYS_PREADV2 = 327 + SYS_PWRITEV2 = 328 + SYS_PKEY_MPROTECT = 329 + SYS_PKEY_ALLOC = 330 + SYS_PKEY_FREE = 331 + SYS_STATX = 332 + SYS_IO_PGETEVENTS = 333 + SYS_RSEQ = 334 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_MEMFD_SECRET = 447 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index 3b1c10513..d75f65a0a 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -403,4 +403,8 @@ const ( SYS_PROCESS_MADVISE = 440 SYS_EPOLL_PWAIT2 = 441 SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index 3198adcf7..8b02f09e9 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -7,303 +7,308 @@ package unix const ( - SYS_IO_SETUP = 0 - SYS_IO_DESTROY = 1 - SYS_IO_SUBMIT = 2 - SYS_IO_CANCEL = 3 - SYS_IO_GETEVENTS = 4 - SYS_SETXATTR = 5 - SYS_LSETXATTR = 6 - SYS_FSETXATTR = 7 - SYS_GETXATTR = 8 - SYS_LGETXATTR = 9 - SYS_FGETXATTR = 10 - SYS_LISTXATTR = 11 - SYS_LLISTXATTR = 12 - SYS_FLISTXATTR = 13 - SYS_REMOVEXATTR = 14 - SYS_LREMOVEXATTR = 15 - SYS_FREMOVEXATTR = 16 - SYS_GETCWD = 17 - SYS_LOOKUP_DCOOKIE = 18 - SYS_EVENTFD2 = 19 - SYS_EPOLL_CREATE1 = 20 - SYS_EPOLL_CTL = 21 - SYS_EPOLL_PWAIT = 22 - SYS_DUP = 23 - SYS_DUP3 = 24 - SYS_FCNTL = 25 - SYS_INOTIFY_INIT1 = 26 - SYS_INOTIFY_ADD_WATCH = 27 - SYS_INOTIFY_RM_WATCH = 28 - SYS_IOCTL = 29 - SYS_IOPRIO_SET = 30 - SYS_IOPRIO_GET = 31 - SYS_FLOCK = 32 - SYS_MKNODAT = 33 - SYS_MKDIRAT = 34 - SYS_UNLINKAT = 35 - SYS_SYMLINKAT = 36 - SYS_LINKAT = 37 - SYS_RENAMEAT = 38 - SYS_UMOUNT2 = 39 - SYS_MOUNT = 40 - SYS_PIVOT_ROOT = 41 - SYS_NFSSERVCTL = 42 - SYS_STATFS = 43 - SYS_FSTATFS = 44 - SYS_TRUNCATE = 45 - SYS_FTRUNCATE = 46 - SYS_FALLOCATE = 47 - SYS_FACCESSAT = 48 - SYS_CHDIR = 49 - SYS_FCHDIR = 50 - SYS_CHROOT = 51 - SYS_FCHMOD = 52 - SYS_FCHMODAT = 53 - SYS_FCHOWNAT = 54 - SYS_FCHOWN = 55 - SYS_OPENAT = 56 - SYS_CLOSE = 57 - SYS_VHANGUP = 58 - SYS_PIPE2 = 59 - SYS_QUOTACTL = 60 - SYS_GETDENTS64 = 61 - SYS_LSEEK = 62 - SYS_READ = 63 - SYS_WRITE = 64 - SYS_READV = 65 - SYS_WRITEV = 66 - SYS_PREAD64 = 67 - SYS_PWRITE64 = 68 - SYS_PREADV = 69 - SYS_PWRITEV = 70 - SYS_SENDFILE = 71 - SYS_PSELECT6 = 72 - SYS_PPOLL = 73 - SYS_SIGNALFD4 = 74 - SYS_VMSPLICE = 75 - SYS_SPLICE = 76 - SYS_TEE = 77 - SYS_READLINKAT = 78 - SYS_FSTATAT = 79 - SYS_FSTAT = 80 - SYS_SYNC = 81 - SYS_FSYNC = 82 - SYS_FDATASYNC = 83 - SYS_SYNC_FILE_RANGE = 84 - SYS_TIMERFD_CREATE = 85 - SYS_TIMERFD_SETTIME = 86 - SYS_TIMERFD_GETTIME = 87 - SYS_UTIMENSAT = 88 - SYS_ACCT = 89 - SYS_CAPGET = 90 - SYS_CAPSET = 91 - SYS_PERSONALITY = 92 - SYS_EXIT = 93 - SYS_EXIT_GROUP = 94 - SYS_WAITID = 95 - SYS_SET_TID_ADDRESS = 96 - SYS_UNSHARE = 97 - SYS_FUTEX = 98 - SYS_SET_ROBUST_LIST = 99 - SYS_GET_ROBUST_LIST = 100 - SYS_NANOSLEEP = 101 - SYS_GETITIMER = 102 - SYS_SETITIMER = 103 - SYS_KEXEC_LOAD = 104 - SYS_INIT_MODULE = 105 - SYS_DELETE_MODULE = 106 - SYS_TIMER_CREATE = 107 - SYS_TIMER_GETTIME = 108 - SYS_TIMER_GETOVERRUN = 109 - SYS_TIMER_SETTIME = 110 - SYS_TIMER_DELETE = 111 - SYS_CLOCK_SETTIME = 112 - SYS_CLOCK_GETTIME = 113 - SYS_CLOCK_GETRES = 114 - SYS_CLOCK_NANOSLEEP = 115 - SYS_SYSLOG = 116 - SYS_PTRACE = 117 - SYS_SCHED_SETPARAM = 118 - SYS_SCHED_SETSCHEDULER = 119 - SYS_SCHED_GETSCHEDULER = 120 - SYS_SCHED_GETPARAM = 121 - SYS_SCHED_SETAFFINITY = 122 - SYS_SCHED_GETAFFINITY = 123 - SYS_SCHED_YIELD = 124 - SYS_SCHED_GET_PRIORITY_MAX = 125 - SYS_SCHED_GET_PRIORITY_MIN = 126 - SYS_SCHED_RR_GET_INTERVAL = 127 - SYS_RESTART_SYSCALL = 128 - SYS_KILL = 129 - SYS_TKILL = 130 - SYS_TGKILL = 131 - SYS_SIGALTSTACK = 132 - SYS_RT_SIGSUSPEND = 133 - SYS_RT_SIGACTION = 134 - SYS_RT_SIGPROCMASK = 135 - SYS_RT_SIGPENDING = 136 - SYS_RT_SIGTIMEDWAIT = 137 - SYS_RT_SIGQUEUEINFO = 138 - SYS_RT_SIGRETURN = 139 - SYS_SETPRIORITY = 140 - SYS_GETPRIORITY = 141 - SYS_REBOOT = 142 - SYS_SETREGID = 143 - SYS_SETGID = 144 - SYS_SETREUID = 145 - SYS_SETUID = 146 - SYS_SETRESUID = 147 - SYS_GETRESUID = 148 - SYS_SETRESGID = 149 - SYS_GETRESGID = 150 - SYS_SETFSUID = 151 - SYS_SETFSGID = 152 - SYS_TIMES = 153 - SYS_SETPGID = 154 - SYS_GETPGID = 155 - SYS_GETSID = 156 - SYS_SETSID = 157 - SYS_GETGROUPS = 158 - SYS_SETGROUPS = 159 - SYS_UNAME = 160 - SYS_SETHOSTNAME = 161 - SYS_SETDOMAINNAME = 162 - SYS_GETRLIMIT = 163 - SYS_SETRLIMIT = 164 - SYS_GETRUSAGE = 165 - SYS_UMASK = 166 - SYS_PRCTL = 167 - SYS_GETCPU = 168 - SYS_GETTIMEOFDAY = 169 - SYS_SETTIMEOFDAY = 170 - SYS_ADJTIMEX = 171 - SYS_GETPID = 172 - SYS_GETPPID = 173 - SYS_GETUID = 174 - SYS_GETEUID = 175 - SYS_GETGID = 176 - SYS_GETEGID = 177 - SYS_GETTID = 178 - SYS_SYSINFO = 179 - SYS_MQ_OPEN = 180 - SYS_MQ_UNLINK = 181 - SYS_MQ_TIMEDSEND = 182 - SYS_MQ_TIMEDRECEIVE = 183 - SYS_MQ_NOTIFY = 184 - SYS_MQ_GETSETATTR = 185 - SYS_MSGGET = 186 - SYS_MSGCTL = 187 - SYS_MSGRCV = 188 - SYS_MSGSND = 189 - SYS_SEMGET = 190 - SYS_SEMCTL = 191 - SYS_SEMTIMEDOP = 192 - SYS_SEMOP = 193 - SYS_SHMGET = 194 - SYS_SHMCTL = 195 - SYS_SHMAT = 196 - SYS_SHMDT = 197 - SYS_SOCKET = 198 - SYS_SOCKETPAIR = 199 - SYS_BIND = 200 - SYS_LISTEN = 201 - SYS_ACCEPT = 202 - SYS_CONNECT = 203 - SYS_GETSOCKNAME = 204 - SYS_GETPEERNAME = 205 - SYS_SENDTO = 206 - SYS_RECVFROM = 207 - SYS_SETSOCKOPT = 208 - SYS_GETSOCKOPT = 209 - SYS_SHUTDOWN = 210 - SYS_SENDMSG = 211 - SYS_RECVMSG = 212 - SYS_READAHEAD = 213 - SYS_BRK = 214 - SYS_MUNMAP = 215 - SYS_MREMAP = 216 - SYS_ADD_KEY = 217 - SYS_REQUEST_KEY = 218 - SYS_KEYCTL = 219 - SYS_CLONE = 220 - SYS_EXECVE = 221 - SYS_MMAP = 222 - SYS_FADVISE64 = 223 - SYS_SWAPON = 224 - SYS_SWAPOFF = 225 - SYS_MPROTECT = 226 - SYS_MSYNC = 227 - SYS_MLOCK = 228 - SYS_MUNLOCK = 229 - SYS_MLOCKALL = 230 - SYS_MUNLOCKALL = 231 - SYS_MINCORE = 232 - SYS_MADVISE = 233 - SYS_REMAP_FILE_PAGES = 234 - SYS_MBIND = 235 - SYS_GET_MEMPOLICY = 236 - SYS_SET_MEMPOLICY = 237 - SYS_MIGRATE_PAGES = 238 - SYS_MOVE_PAGES = 239 - SYS_RT_TGSIGQUEUEINFO = 240 - SYS_PERF_EVENT_OPEN = 241 - SYS_ACCEPT4 = 242 - SYS_RECVMMSG = 243 - SYS_ARCH_SPECIFIC_SYSCALL = 244 - SYS_WAIT4 = 260 - SYS_PRLIMIT64 = 261 - SYS_FANOTIFY_INIT = 262 - SYS_FANOTIFY_MARK = 263 - SYS_NAME_TO_HANDLE_AT = 264 - SYS_OPEN_BY_HANDLE_AT = 265 - SYS_CLOCK_ADJTIME = 266 - SYS_SYNCFS = 267 - SYS_SETNS = 268 - SYS_SENDMMSG = 269 - SYS_PROCESS_VM_READV = 270 - SYS_PROCESS_VM_WRITEV = 271 - SYS_KCMP = 272 - SYS_FINIT_MODULE = 273 - SYS_SCHED_SETATTR = 274 - SYS_SCHED_GETATTR = 275 - SYS_RENAMEAT2 = 276 - SYS_SECCOMP = 277 - SYS_GETRANDOM = 278 - SYS_MEMFD_CREATE = 279 - SYS_BPF = 280 - SYS_EXECVEAT = 281 - SYS_USERFAULTFD = 282 - SYS_MEMBARRIER = 283 - SYS_MLOCK2 = 284 - SYS_COPY_FILE_RANGE = 285 - SYS_PREADV2 = 286 - SYS_PWRITEV2 = 287 - SYS_PKEY_MPROTECT = 288 - SYS_PKEY_ALLOC = 289 - SYS_PKEY_FREE = 290 - SYS_STATX = 291 - SYS_IO_PGETEVENTS = 292 - SYS_RSEQ = 293 - SYS_KEXEC_FILE_LOAD = 294 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_CLOSE_RANGE = 436 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 - SYS_FACCESSAT2 = 439 - SYS_PROCESS_MADVISE = 440 - SYS_EPOLL_PWAIT2 = 441 - SYS_MOUNT_SETATTR = 442 + SYS_IO_SETUP = 0 + SYS_IO_DESTROY = 1 + SYS_IO_SUBMIT = 2 + SYS_IO_CANCEL = 3 + SYS_IO_GETEVENTS = 4 + SYS_SETXATTR = 5 + SYS_LSETXATTR = 6 + SYS_FSETXATTR = 7 + SYS_GETXATTR = 8 + SYS_LGETXATTR = 9 + SYS_FGETXATTR = 10 + SYS_LISTXATTR = 11 + SYS_LLISTXATTR = 12 + SYS_FLISTXATTR = 13 + SYS_REMOVEXATTR = 14 + SYS_LREMOVEXATTR = 15 + SYS_FREMOVEXATTR = 16 + SYS_GETCWD = 17 + SYS_LOOKUP_DCOOKIE = 18 + SYS_EVENTFD2 = 19 + SYS_EPOLL_CREATE1 = 20 + SYS_EPOLL_CTL = 21 + SYS_EPOLL_PWAIT = 22 + SYS_DUP = 23 + SYS_DUP3 = 24 + SYS_FCNTL = 25 + SYS_INOTIFY_INIT1 = 26 + SYS_INOTIFY_ADD_WATCH = 27 + SYS_INOTIFY_RM_WATCH = 28 + SYS_IOCTL = 29 + SYS_IOPRIO_SET = 30 + SYS_IOPRIO_GET = 31 + SYS_FLOCK = 32 + SYS_MKNODAT = 33 + SYS_MKDIRAT = 34 + SYS_UNLINKAT = 35 + SYS_SYMLINKAT = 36 + SYS_LINKAT = 37 + SYS_RENAMEAT = 38 + SYS_UMOUNT2 = 39 + SYS_MOUNT = 40 + SYS_PIVOT_ROOT = 41 + SYS_NFSSERVCTL = 42 + SYS_STATFS = 43 + SYS_FSTATFS = 44 + SYS_TRUNCATE = 45 + SYS_FTRUNCATE = 46 + SYS_FALLOCATE = 47 + SYS_FACCESSAT = 48 + SYS_CHDIR = 49 + SYS_FCHDIR = 50 + SYS_CHROOT = 51 + SYS_FCHMOD = 52 + SYS_FCHMODAT = 53 + SYS_FCHOWNAT = 54 + SYS_FCHOWN = 55 + SYS_OPENAT = 56 + SYS_CLOSE = 57 + SYS_VHANGUP = 58 + SYS_PIPE2 = 59 + SYS_QUOTACTL = 60 + SYS_GETDENTS64 = 61 + SYS_LSEEK = 62 + SYS_READ = 63 + SYS_WRITE = 64 + SYS_READV = 65 + SYS_WRITEV = 66 + SYS_PREAD64 = 67 + SYS_PWRITE64 = 68 + SYS_PREADV = 69 + SYS_PWRITEV = 70 + SYS_SENDFILE = 71 + SYS_PSELECT6 = 72 + SYS_PPOLL = 73 + SYS_SIGNALFD4 = 74 + SYS_VMSPLICE = 75 + SYS_SPLICE = 76 + SYS_TEE = 77 + SYS_READLINKAT = 78 + SYS_FSTATAT = 79 + SYS_FSTAT = 80 + SYS_SYNC = 81 + SYS_FSYNC = 82 + SYS_FDATASYNC = 83 + SYS_SYNC_FILE_RANGE = 84 + SYS_TIMERFD_CREATE = 85 + SYS_TIMERFD_SETTIME = 86 + SYS_TIMERFD_GETTIME = 87 + SYS_UTIMENSAT = 88 + SYS_ACCT = 89 + SYS_CAPGET = 90 + SYS_CAPSET = 91 + SYS_PERSONALITY = 92 + SYS_EXIT = 93 + SYS_EXIT_GROUP = 94 + SYS_WAITID = 95 + SYS_SET_TID_ADDRESS = 96 + SYS_UNSHARE = 97 + SYS_FUTEX = 98 + SYS_SET_ROBUST_LIST = 99 + SYS_GET_ROBUST_LIST = 100 + SYS_NANOSLEEP = 101 + SYS_GETITIMER = 102 + SYS_SETITIMER = 103 + SYS_KEXEC_LOAD = 104 + SYS_INIT_MODULE = 105 + SYS_DELETE_MODULE = 106 + SYS_TIMER_CREATE = 107 + SYS_TIMER_GETTIME = 108 + SYS_TIMER_GETOVERRUN = 109 + SYS_TIMER_SETTIME = 110 + SYS_TIMER_DELETE = 111 + SYS_CLOCK_SETTIME = 112 + SYS_CLOCK_GETTIME = 113 + SYS_CLOCK_GETRES = 114 + SYS_CLOCK_NANOSLEEP = 115 + SYS_SYSLOG = 116 + SYS_PTRACE = 117 + SYS_SCHED_SETPARAM = 118 + SYS_SCHED_SETSCHEDULER = 119 + SYS_SCHED_GETSCHEDULER = 120 + SYS_SCHED_GETPARAM = 121 + SYS_SCHED_SETAFFINITY = 122 + SYS_SCHED_GETAFFINITY = 123 + SYS_SCHED_YIELD = 124 + SYS_SCHED_GET_PRIORITY_MAX = 125 + SYS_SCHED_GET_PRIORITY_MIN = 126 + SYS_SCHED_RR_GET_INTERVAL = 127 + SYS_RESTART_SYSCALL = 128 + SYS_KILL = 129 + SYS_TKILL = 130 + SYS_TGKILL = 131 + SYS_SIGALTSTACK = 132 + SYS_RT_SIGSUSPEND = 133 + SYS_RT_SIGACTION = 134 + SYS_RT_SIGPROCMASK = 135 + SYS_RT_SIGPENDING = 136 + SYS_RT_SIGTIMEDWAIT = 137 + SYS_RT_SIGQUEUEINFO = 138 + SYS_RT_SIGRETURN = 139 + SYS_SETPRIORITY = 140 + SYS_GETPRIORITY = 141 + SYS_REBOOT = 142 + SYS_SETREGID = 143 + SYS_SETGID = 144 + SYS_SETREUID = 145 + SYS_SETUID = 146 + SYS_SETRESUID = 147 + SYS_GETRESUID = 148 + SYS_SETRESGID = 149 + SYS_GETRESGID = 150 + SYS_SETFSUID = 151 + SYS_SETFSGID = 152 + SYS_TIMES = 153 + SYS_SETPGID = 154 + SYS_GETPGID = 155 + SYS_GETSID = 156 + SYS_SETSID = 157 + SYS_GETGROUPS = 158 + SYS_SETGROUPS = 159 + SYS_UNAME = 160 + SYS_SETHOSTNAME = 161 + SYS_SETDOMAINNAME = 162 + SYS_GETRLIMIT = 163 + SYS_SETRLIMIT = 164 + SYS_GETRUSAGE = 165 + SYS_UMASK = 166 + SYS_PRCTL = 167 + SYS_GETCPU = 168 + SYS_GETTIMEOFDAY = 169 + SYS_SETTIMEOFDAY = 170 + SYS_ADJTIMEX = 171 + SYS_GETPID = 172 + SYS_GETPPID = 173 + SYS_GETUID = 174 + SYS_GETEUID = 175 + SYS_GETGID = 176 + SYS_GETEGID = 177 + SYS_GETTID = 178 + SYS_SYSINFO = 179 + SYS_MQ_OPEN = 180 + SYS_MQ_UNLINK = 181 + SYS_MQ_TIMEDSEND = 182 + SYS_MQ_TIMEDRECEIVE = 183 + SYS_MQ_NOTIFY = 184 + SYS_MQ_GETSETATTR = 185 + SYS_MSGGET = 186 + SYS_MSGCTL = 187 + SYS_MSGRCV = 188 + SYS_MSGSND = 189 + SYS_SEMGET = 190 + SYS_SEMCTL = 191 + SYS_SEMTIMEDOP = 192 + SYS_SEMOP = 193 + SYS_SHMGET = 194 + SYS_SHMCTL = 195 + SYS_SHMAT = 196 + SYS_SHMDT = 197 + SYS_SOCKET = 198 + SYS_SOCKETPAIR = 199 + SYS_BIND = 200 + SYS_LISTEN = 201 + SYS_ACCEPT = 202 + SYS_CONNECT = 203 + SYS_GETSOCKNAME = 204 + SYS_GETPEERNAME = 205 + SYS_SENDTO = 206 + SYS_RECVFROM = 207 + SYS_SETSOCKOPT = 208 + SYS_GETSOCKOPT = 209 + SYS_SHUTDOWN = 210 + SYS_SENDMSG = 211 + SYS_RECVMSG = 212 + SYS_READAHEAD = 213 + SYS_BRK = 214 + SYS_MUNMAP = 215 + SYS_MREMAP = 216 + SYS_ADD_KEY = 217 + SYS_REQUEST_KEY = 218 + SYS_KEYCTL = 219 + SYS_CLONE = 220 + SYS_EXECVE = 221 + SYS_MMAP = 222 + SYS_FADVISE64 = 223 + SYS_SWAPON = 224 + SYS_SWAPOFF = 225 + SYS_MPROTECT = 226 + SYS_MSYNC = 227 + SYS_MLOCK = 228 + SYS_MUNLOCK = 229 + SYS_MLOCKALL = 230 + SYS_MUNLOCKALL = 231 + SYS_MINCORE = 232 + SYS_MADVISE = 233 + SYS_REMAP_FILE_PAGES = 234 + SYS_MBIND = 235 + SYS_GET_MEMPOLICY = 236 + SYS_SET_MEMPOLICY = 237 + SYS_MIGRATE_PAGES = 238 + SYS_MOVE_PAGES = 239 + SYS_RT_TGSIGQUEUEINFO = 240 + SYS_PERF_EVENT_OPEN = 241 + SYS_ACCEPT4 = 242 + SYS_RECVMMSG = 243 + SYS_ARCH_SPECIFIC_SYSCALL = 244 + SYS_WAIT4 = 260 + SYS_PRLIMIT64 = 261 + SYS_FANOTIFY_INIT = 262 + SYS_FANOTIFY_MARK = 263 + SYS_NAME_TO_HANDLE_AT = 264 + SYS_OPEN_BY_HANDLE_AT = 265 + SYS_CLOCK_ADJTIME = 266 + SYS_SYNCFS = 267 + SYS_SETNS = 268 + SYS_SENDMMSG = 269 + SYS_PROCESS_VM_READV = 270 + SYS_PROCESS_VM_WRITEV = 271 + SYS_KCMP = 272 + SYS_FINIT_MODULE = 273 + SYS_SCHED_SETATTR = 274 + SYS_SCHED_GETATTR = 275 + SYS_RENAMEAT2 = 276 + SYS_SECCOMP = 277 + SYS_GETRANDOM = 278 + SYS_MEMFD_CREATE = 279 + SYS_BPF = 280 + SYS_EXECVEAT = 281 + SYS_USERFAULTFD = 282 + SYS_MEMBARRIER = 283 + SYS_MLOCK2 = 284 + SYS_COPY_FILE_RANGE = 285 + SYS_PREADV2 = 286 + SYS_PWRITEV2 = 287 + SYS_PKEY_MPROTECT = 288 + SYS_PKEY_ALLOC = 289 + SYS_PKEY_FREE = 290 + SYS_STATX = 291 + SYS_IO_PGETEVENTS = 292 + SYS_RSEQ = 293 + SYS_KEXEC_FILE_LOAD = 294 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_MEMFD_SECRET = 447 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index c877ec6e6..026695abb 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -424,4 +424,8 @@ const ( SYS_PROCESS_MADVISE = 4440 SYS_EPOLL_PWAIT2 = 4441 SYS_MOUNT_SETATTR = 4442 + SYS_QUOTACTL_FD = 4443 + SYS_LANDLOCK_CREATE_RULESET = 4444 + SYS_LANDLOCK_ADD_RULE = 4445 + SYS_LANDLOCK_RESTRICT_SELF = 4446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index b5f290372..7320ba958 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -7,351 +7,355 @@ package unix const ( - SYS_READ = 5000 - SYS_WRITE = 5001 - SYS_OPEN = 5002 - SYS_CLOSE = 5003 - SYS_STAT = 5004 - SYS_FSTAT = 5005 - SYS_LSTAT = 5006 - SYS_POLL = 5007 - SYS_LSEEK = 5008 - SYS_MMAP = 5009 - SYS_MPROTECT = 5010 - SYS_MUNMAP = 5011 - SYS_BRK = 5012 - SYS_RT_SIGACTION = 5013 - SYS_RT_SIGPROCMASK = 5014 - SYS_IOCTL = 5015 - SYS_PREAD64 = 5016 - SYS_PWRITE64 = 5017 - SYS_READV = 5018 - SYS_WRITEV = 5019 - SYS_ACCESS = 5020 - SYS_PIPE = 5021 - SYS__NEWSELECT = 5022 - SYS_SCHED_YIELD = 5023 - SYS_MREMAP = 5024 - SYS_MSYNC = 5025 - SYS_MINCORE = 5026 - SYS_MADVISE = 5027 - SYS_SHMGET = 5028 - SYS_SHMAT = 5029 - SYS_SHMCTL = 5030 - SYS_DUP = 5031 - SYS_DUP2 = 5032 - SYS_PAUSE = 5033 - SYS_NANOSLEEP = 5034 - SYS_GETITIMER = 5035 - SYS_SETITIMER = 5036 - SYS_ALARM = 5037 - SYS_GETPID = 5038 - SYS_SENDFILE = 5039 - SYS_SOCKET = 5040 - SYS_CONNECT = 5041 - SYS_ACCEPT = 5042 - SYS_SENDTO = 5043 - SYS_RECVFROM = 5044 - SYS_SENDMSG = 5045 - SYS_RECVMSG = 5046 - SYS_SHUTDOWN = 5047 - SYS_BIND = 5048 - SYS_LISTEN = 5049 - SYS_GETSOCKNAME = 5050 - SYS_GETPEERNAME = 5051 - SYS_SOCKETPAIR = 5052 - SYS_SETSOCKOPT = 5053 - SYS_GETSOCKOPT = 5054 - SYS_CLONE = 5055 - SYS_FORK = 5056 - SYS_EXECVE = 5057 - SYS_EXIT = 5058 - SYS_WAIT4 = 5059 - SYS_KILL = 5060 - SYS_UNAME = 5061 - SYS_SEMGET = 5062 - SYS_SEMOP = 5063 - SYS_SEMCTL = 5064 - SYS_SHMDT = 5065 - SYS_MSGGET = 5066 - SYS_MSGSND = 5067 - SYS_MSGRCV = 5068 - SYS_MSGCTL = 5069 - SYS_FCNTL = 5070 - SYS_FLOCK = 5071 - SYS_FSYNC = 5072 - SYS_FDATASYNC = 5073 - SYS_TRUNCATE = 5074 - SYS_FTRUNCATE = 5075 - SYS_GETDENTS = 5076 - SYS_GETCWD = 5077 - SYS_CHDIR = 5078 - SYS_FCHDIR = 5079 - SYS_RENAME = 5080 - SYS_MKDIR = 5081 - SYS_RMDIR = 5082 - SYS_CREAT = 5083 - SYS_LINK = 5084 - SYS_UNLINK = 5085 - SYS_SYMLINK = 5086 - SYS_READLINK = 5087 - SYS_CHMOD = 5088 - SYS_FCHMOD = 5089 - SYS_CHOWN = 5090 - SYS_FCHOWN = 5091 - SYS_LCHOWN = 5092 - SYS_UMASK = 5093 - SYS_GETTIMEOFDAY = 5094 - SYS_GETRLIMIT = 5095 - SYS_GETRUSAGE = 5096 - SYS_SYSINFO = 5097 - SYS_TIMES = 5098 - SYS_PTRACE = 5099 - SYS_GETUID = 5100 - SYS_SYSLOG = 5101 - SYS_GETGID = 5102 - SYS_SETUID = 5103 - SYS_SETGID = 5104 - SYS_GETEUID = 5105 - SYS_GETEGID = 5106 - SYS_SETPGID = 5107 - SYS_GETPPID = 5108 - SYS_GETPGRP = 5109 - SYS_SETSID = 5110 - SYS_SETREUID = 5111 - SYS_SETREGID = 5112 - SYS_GETGROUPS = 5113 - SYS_SETGROUPS = 5114 - SYS_SETRESUID = 5115 - SYS_GETRESUID = 5116 - SYS_SETRESGID = 5117 - SYS_GETRESGID = 5118 - SYS_GETPGID = 5119 - SYS_SETFSUID = 5120 - SYS_SETFSGID = 5121 - SYS_GETSID = 5122 - SYS_CAPGET = 5123 - SYS_CAPSET = 5124 - SYS_RT_SIGPENDING = 5125 - SYS_RT_SIGTIMEDWAIT = 5126 - SYS_RT_SIGQUEUEINFO = 5127 - SYS_RT_SIGSUSPEND = 5128 - SYS_SIGALTSTACK = 5129 - SYS_UTIME = 5130 - SYS_MKNOD = 5131 - SYS_PERSONALITY = 5132 - SYS_USTAT = 5133 - SYS_STATFS = 5134 - SYS_FSTATFS = 5135 - SYS_SYSFS = 5136 - SYS_GETPRIORITY = 5137 - SYS_SETPRIORITY = 5138 - SYS_SCHED_SETPARAM = 5139 - SYS_SCHED_GETPARAM = 5140 - SYS_SCHED_SETSCHEDULER = 5141 - SYS_SCHED_GETSCHEDULER = 5142 - SYS_SCHED_GET_PRIORITY_MAX = 5143 - SYS_SCHED_GET_PRIORITY_MIN = 5144 - SYS_SCHED_RR_GET_INTERVAL = 5145 - SYS_MLOCK = 5146 - SYS_MUNLOCK = 5147 - SYS_MLOCKALL = 5148 - SYS_MUNLOCKALL = 5149 - SYS_VHANGUP = 5150 - SYS_PIVOT_ROOT = 5151 - SYS__SYSCTL = 5152 - SYS_PRCTL = 5153 - SYS_ADJTIMEX = 5154 - SYS_SETRLIMIT = 5155 - SYS_CHROOT = 5156 - SYS_SYNC = 5157 - SYS_ACCT = 5158 - SYS_SETTIMEOFDAY = 5159 - SYS_MOUNT = 5160 - SYS_UMOUNT2 = 5161 - SYS_SWAPON = 5162 - SYS_SWAPOFF = 5163 - SYS_REBOOT = 5164 - SYS_SETHOSTNAME = 5165 - SYS_SETDOMAINNAME = 5166 - SYS_CREATE_MODULE = 5167 - SYS_INIT_MODULE = 5168 - SYS_DELETE_MODULE = 5169 - SYS_GET_KERNEL_SYMS = 5170 - SYS_QUERY_MODULE = 5171 - SYS_QUOTACTL = 5172 - SYS_NFSSERVCTL = 5173 - SYS_GETPMSG = 5174 - SYS_PUTPMSG = 5175 - SYS_AFS_SYSCALL = 5176 - SYS_RESERVED177 = 5177 - SYS_GETTID = 5178 - SYS_READAHEAD = 5179 - SYS_SETXATTR = 5180 - SYS_LSETXATTR = 5181 - SYS_FSETXATTR = 5182 - SYS_GETXATTR = 5183 - SYS_LGETXATTR = 5184 - SYS_FGETXATTR = 5185 - SYS_LISTXATTR = 5186 - SYS_LLISTXATTR = 5187 - SYS_FLISTXATTR = 5188 - SYS_REMOVEXATTR = 5189 - SYS_LREMOVEXATTR = 5190 - SYS_FREMOVEXATTR = 5191 - SYS_TKILL = 5192 - SYS_RESERVED193 = 5193 - SYS_FUTEX = 5194 - SYS_SCHED_SETAFFINITY = 5195 - SYS_SCHED_GETAFFINITY = 5196 - SYS_CACHEFLUSH = 5197 - SYS_CACHECTL = 5198 - SYS_SYSMIPS = 5199 - SYS_IO_SETUP = 5200 - SYS_IO_DESTROY = 5201 - SYS_IO_GETEVENTS = 5202 - SYS_IO_SUBMIT = 5203 - SYS_IO_CANCEL = 5204 - SYS_EXIT_GROUP = 5205 - SYS_LOOKUP_DCOOKIE = 5206 - SYS_EPOLL_CREATE = 5207 - SYS_EPOLL_CTL = 5208 - SYS_EPOLL_WAIT = 5209 - SYS_REMAP_FILE_PAGES = 5210 - SYS_RT_SIGRETURN = 5211 - SYS_SET_TID_ADDRESS = 5212 - SYS_RESTART_SYSCALL = 5213 - SYS_SEMTIMEDOP = 5214 - SYS_FADVISE64 = 5215 - SYS_TIMER_CREATE = 5216 - SYS_TIMER_SETTIME = 5217 - SYS_TIMER_GETTIME = 5218 - SYS_TIMER_GETOVERRUN = 5219 - SYS_TIMER_DELETE = 5220 - SYS_CLOCK_SETTIME = 5221 - SYS_CLOCK_GETTIME = 5222 - SYS_CLOCK_GETRES = 5223 - SYS_CLOCK_NANOSLEEP = 5224 - SYS_TGKILL = 5225 - SYS_UTIMES = 5226 - SYS_MBIND = 5227 - SYS_GET_MEMPOLICY = 5228 - SYS_SET_MEMPOLICY = 5229 - SYS_MQ_OPEN = 5230 - SYS_MQ_UNLINK = 5231 - SYS_MQ_TIMEDSEND = 5232 - SYS_MQ_TIMEDRECEIVE = 5233 - SYS_MQ_NOTIFY = 5234 - SYS_MQ_GETSETATTR = 5235 - SYS_VSERVER = 5236 - SYS_WAITID = 5237 - SYS_ADD_KEY = 5239 - SYS_REQUEST_KEY = 5240 - SYS_KEYCTL = 5241 - SYS_SET_THREAD_AREA = 5242 - SYS_INOTIFY_INIT = 5243 - SYS_INOTIFY_ADD_WATCH = 5244 - SYS_INOTIFY_RM_WATCH = 5245 - SYS_MIGRATE_PAGES = 5246 - SYS_OPENAT = 5247 - SYS_MKDIRAT = 5248 - SYS_MKNODAT = 5249 - SYS_FCHOWNAT = 5250 - SYS_FUTIMESAT = 5251 - SYS_NEWFSTATAT = 5252 - SYS_UNLINKAT = 5253 - SYS_RENAMEAT = 5254 - SYS_LINKAT = 5255 - SYS_SYMLINKAT = 5256 - SYS_READLINKAT = 5257 - SYS_FCHMODAT = 5258 - SYS_FACCESSAT = 5259 - SYS_PSELECT6 = 5260 - SYS_PPOLL = 5261 - SYS_UNSHARE = 5262 - SYS_SPLICE = 5263 - SYS_SYNC_FILE_RANGE = 5264 - SYS_TEE = 5265 - SYS_VMSPLICE = 5266 - SYS_MOVE_PAGES = 5267 - SYS_SET_ROBUST_LIST = 5268 - SYS_GET_ROBUST_LIST = 5269 - SYS_KEXEC_LOAD = 5270 - SYS_GETCPU = 5271 - SYS_EPOLL_PWAIT = 5272 - SYS_IOPRIO_SET = 5273 - SYS_IOPRIO_GET = 5274 - SYS_UTIMENSAT = 5275 - SYS_SIGNALFD = 5276 - SYS_TIMERFD = 5277 - SYS_EVENTFD = 5278 - SYS_FALLOCATE = 5279 - SYS_TIMERFD_CREATE = 5280 - SYS_TIMERFD_GETTIME = 5281 - SYS_TIMERFD_SETTIME = 5282 - SYS_SIGNALFD4 = 5283 - SYS_EVENTFD2 = 5284 - SYS_EPOLL_CREATE1 = 5285 - SYS_DUP3 = 5286 - SYS_PIPE2 = 5287 - SYS_INOTIFY_INIT1 = 5288 - SYS_PREADV = 5289 - SYS_PWRITEV = 5290 - SYS_RT_TGSIGQUEUEINFO = 5291 - SYS_PERF_EVENT_OPEN = 5292 - SYS_ACCEPT4 = 5293 - SYS_RECVMMSG = 5294 - SYS_FANOTIFY_INIT = 5295 - SYS_FANOTIFY_MARK = 5296 - SYS_PRLIMIT64 = 5297 - SYS_NAME_TO_HANDLE_AT = 5298 - SYS_OPEN_BY_HANDLE_AT = 5299 - SYS_CLOCK_ADJTIME = 5300 - SYS_SYNCFS = 5301 - SYS_SENDMMSG = 5302 - SYS_SETNS = 5303 - SYS_PROCESS_VM_READV = 5304 - SYS_PROCESS_VM_WRITEV = 5305 - SYS_KCMP = 5306 - SYS_FINIT_MODULE = 5307 - SYS_GETDENTS64 = 5308 - SYS_SCHED_SETATTR = 5309 - SYS_SCHED_GETATTR = 5310 - SYS_RENAMEAT2 = 5311 - SYS_SECCOMP = 5312 - SYS_GETRANDOM = 5313 - SYS_MEMFD_CREATE = 5314 - SYS_BPF = 5315 - SYS_EXECVEAT = 5316 - SYS_USERFAULTFD = 5317 - SYS_MEMBARRIER = 5318 - SYS_MLOCK2 = 5319 - SYS_COPY_FILE_RANGE = 5320 - SYS_PREADV2 = 5321 - SYS_PWRITEV2 = 5322 - SYS_PKEY_MPROTECT = 5323 - SYS_PKEY_ALLOC = 5324 - SYS_PKEY_FREE = 5325 - SYS_STATX = 5326 - SYS_RSEQ = 5327 - SYS_IO_PGETEVENTS = 5328 - SYS_PIDFD_SEND_SIGNAL = 5424 - SYS_IO_URING_SETUP = 5425 - SYS_IO_URING_ENTER = 5426 - SYS_IO_URING_REGISTER = 5427 - SYS_OPEN_TREE = 5428 - SYS_MOVE_MOUNT = 5429 - SYS_FSOPEN = 5430 - SYS_FSCONFIG = 5431 - SYS_FSMOUNT = 5432 - SYS_FSPICK = 5433 - SYS_PIDFD_OPEN = 5434 - SYS_CLONE3 = 5435 - SYS_CLOSE_RANGE = 5436 - SYS_OPENAT2 = 5437 - SYS_PIDFD_GETFD = 5438 - SYS_FACCESSAT2 = 5439 - SYS_PROCESS_MADVISE = 5440 - SYS_EPOLL_PWAIT2 = 5441 - SYS_MOUNT_SETATTR = 5442 + SYS_READ = 5000 + SYS_WRITE = 5001 + SYS_OPEN = 5002 + SYS_CLOSE = 5003 + SYS_STAT = 5004 + SYS_FSTAT = 5005 + SYS_LSTAT = 5006 + SYS_POLL = 5007 + SYS_LSEEK = 5008 + SYS_MMAP = 5009 + SYS_MPROTECT = 5010 + SYS_MUNMAP = 5011 + SYS_BRK = 5012 + SYS_RT_SIGACTION = 5013 + SYS_RT_SIGPROCMASK = 5014 + SYS_IOCTL = 5015 + SYS_PREAD64 = 5016 + SYS_PWRITE64 = 5017 + SYS_READV = 5018 + SYS_WRITEV = 5019 + SYS_ACCESS = 5020 + SYS_PIPE = 5021 + SYS__NEWSELECT = 5022 + SYS_SCHED_YIELD = 5023 + SYS_MREMAP = 5024 + SYS_MSYNC = 5025 + SYS_MINCORE = 5026 + SYS_MADVISE = 5027 + SYS_SHMGET = 5028 + SYS_SHMAT = 5029 + SYS_SHMCTL = 5030 + SYS_DUP = 5031 + SYS_DUP2 = 5032 + SYS_PAUSE = 5033 + SYS_NANOSLEEP = 5034 + SYS_GETITIMER = 5035 + SYS_SETITIMER = 5036 + SYS_ALARM = 5037 + SYS_GETPID = 5038 + SYS_SENDFILE = 5039 + SYS_SOCKET = 5040 + SYS_CONNECT = 5041 + SYS_ACCEPT = 5042 + SYS_SENDTO = 5043 + SYS_RECVFROM = 5044 + SYS_SENDMSG = 5045 + SYS_RECVMSG = 5046 + SYS_SHUTDOWN = 5047 + SYS_BIND = 5048 + SYS_LISTEN = 5049 + SYS_GETSOCKNAME = 5050 + SYS_GETPEERNAME = 5051 + SYS_SOCKETPAIR = 5052 + SYS_SETSOCKOPT = 5053 + SYS_GETSOCKOPT = 5054 + SYS_CLONE = 5055 + SYS_FORK = 5056 + SYS_EXECVE = 5057 + SYS_EXIT = 5058 + SYS_WAIT4 = 5059 + SYS_KILL = 5060 + SYS_UNAME = 5061 + SYS_SEMGET = 5062 + SYS_SEMOP = 5063 + SYS_SEMCTL = 5064 + SYS_SHMDT = 5065 + SYS_MSGGET = 5066 + SYS_MSGSND = 5067 + SYS_MSGRCV = 5068 + SYS_MSGCTL = 5069 + SYS_FCNTL = 5070 + SYS_FLOCK = 5071 + SYS_FSYNC = 5072 + SYS_FDATASYNC = 5073 + SYS_TRUNCATE = 5074 + SYS_FTRUNCATE = 5075 + SYS_GETDENTS = 5076 + SYS_GETCWD = 5077 + SYS_CHDIR = 5078 + SYS_FCHDIR = 5079 + SYS_RENAME = 5080 + SYS_MKDIR = 5081 + SYS_RMDIR = 5082 + SYS_CREAT = 5083 + SYS_LINK = 5084 + SYS_UNLINK = 5085 + SYS_SYMLINK = 5086 + SYS_READLINK = 5087 + SYS_CHMOD = 5088 + SYS_FCHMOD = 5089 + SYS_CHOWN = 5090 + SYS_FCHOWN = 5091 + SYS_LCHOWN = 5092 + SYS_UMASK = 5093 + SYS_GETTIMEOFDAY = 5094 + SYS_GETRLIMIT = 5095 + SYS_GETRUSAGE = 5096 + SYS_SYSINFO = 5097 + SYS_TIMES = 5098 + SYS_PTRACE = 5099 + SYS_GETUID = 5100 + SYS_SYSLOG = 5101 + SYS_GETGID = 5102 + SYS_SETUID = 5103 + SYS_SETGID = 5104 + SYS_GETEUID = 5105 + SYS_GETEGID = 5106 + SYS_SETPGID = 5107 + SYS_GETPPID = 5108 + SYS_GETPGRP = 5109 + SYS_SETSID = 5110 + SYS_SETREUID = 5111 + SYS_SETREGID = 5112 + SYS_GETGROUPS = 5113 + SYS_SETGROUPS = 5114 + SYS_SETRESUID = 5115 + SYS_GETRESUID = 5116 + SYS_SETRESGID = 5117 + SYS_GETRESGID = 5118 + SYS_GETPGID = 5119 + SYS_SETFSUID = 5120 + SYS_SETFSGID = 5121 + SYS_GETSID = 5122 + SYS_CAPGET = 5123 + SYS_CAPSET = 5124 + SYS_RT_SIGPENDING = 5125 + SYS_RT_SIGTIMEDWAIT = 5126 + SYS_RT_SIGQUEUEINFO = 5127 + SYS_RT_SIGSUSPEND = 5128 + SYS_SIGALTSTACK = 5129 + SYS_UTIME = 5130 + SYS_MKNOD = 5131 + SYS_PERSONALITY = 5132 + SYS_USTAT = 5133 + SYS_STATFS = 5134 + SYS_FSTATFS = 5135 + SYS_SYSFS = 5136 + SYS_GETPRIORITY = 5137 + SYS_SETPRIORITY = 5138 + SYS_SCHED_SETPARAM = 5139 + SYS_SCHED_GETPARAM = 5140 + SYS_SCHED_SETSCHEDULER = 5141 + SYS_SCHED_GETSCHEDULER = 5142 + SYS_SCHED_GET_PRIORITY_MAX = 5143 + SYS_SCHED_GET_PRIORITY_MIN = 5144 + SYS_SCHED_RR_GET_INTERVAL = 5145 + SYS_MLOCK = 5146 + SYS_MUNLOCK = 5147 + SYS_MLOCKALL = 5148 + SYS_MUNLOCKALL = 5149 + SYS_VHANGUP = 5150 + SYS_PIVOT_ROOT = 5151 + SYS__SYSCTL = 5152 + SYS_PRCTL = 5153 + SYS_ADJTIMEX = 5154 + SYS_SETRLIMIT = 5155 + SYS_CHROOT = 5156 + SYS_SYNC = 5157 + SYS_ACCT = 5158 + SYS_SETTIMEOFDAY = 5159 + SYS_MOUNT = 5160 + SYS_UMOUNT2 = 5161 + SYS_SWAPON = 5162 + SYS_SWAPOFF = 5163 + SYS_REBOOT = 5164 + SYS_SETHOSTNAME = 5165 + SYS_SETDOMAINNAME = 5166 + SYS_CREATE_MODULE = 5167 + SYS_INIT_MODULE = 5168 + SYS_DELETE_MODULE = 5169 + SYS_GET_KERNEL_SYMS = 5170 + SYS_QUERY_MODULE = 5171 + SYS_QUOTACTL = 5172 + SYS_NFSSERVCTL = 5173 + SYS_GETPMSG = 5174 + SYS_PUTPMSG = 5175 + SYS_AFS_SYSCALL = 5176 + SYS_RESERVED177 = 5177 + SYS_GETTID = 5178 + SYS_READAHEAD = 5179 + SYS_SETXATTR = 5180 + SYS_LSETXATTR = 5181 + SYS_FSETXATTR = 5182 + SYS_GETXATTR = 5183 + SYS_LGETXATTR = 5184 + SYS_FGETXATTR = 5185 + SYS_LISTXATTR = 5186 + SYS_LLISTXATTR = 5187 + SYS_FLISTXATTR = 5188 + SYS_REMOVEXATTR = 5189 + SYS_LREMOVEXATTR = 5190 + SYS_FREMOVEXATTR = 5191 + SYS_TKILL = 5192 + SYS_RESERVED193 = 5193 + SYS_FUTEX = 5194 + SYS_SCHED_SETAFFINITY = 5195 + SYS_SCHED_GETAFFINITY = 5196 + SYS_CACHEFLUSH = 5197 + SYS_CACHECTL = 5198 + SYS_SYSMIPS = 5199 + SYS_IO_SETUP = 5200 + SYS_IO_DESTROY = 5201 + SYS_IO_GETEVENTS = 5202 + SYS_IO_SUBMIT = 5203 + SYS_IO_CANCEL = 5204 + SYS_EXIT_GROUP = 5205 + SYS_LOOKUP_DCOOKIE = 5206 + SYS_EPOLL_CREATE = 5207 + SYS_EPOLL_CTL = 5208 + SYS_EPOLL_WAIT = 5209 + SYS_REMAP_FILE_PAGES = 5210 + SYS_RT_SIGRETURN = 5211 + SYS_SET_TID_ADDRESS = 5212 + SYS_RESTART_SYSCALL = 5213 + SYS_SEMTIMEDOP = 5214 + SYS_FADVISE64 = 5215 + SYS_TIMER_CREATE = 5216 + SYS_TIMER_SETTIME = 5217 + SYS_TIMER_GETTIME = 5218 + SYS_TIMER_GETOVERRUN = 5219 + SYS_TIMER_DELETE = 5220 + SYS_CLOCK_SETTIME = 5221 + SYS_CLOCK_GETTIME = 5222 + SYS_CLOCK_GETRES = 5223 + SYS_CLOCK_NANOSLEEP = 5224 + SYS_TGKILL = 5225 + SYS_UTIMES = 5226 + SYS_MBIND = 5227 + SYS_GET_MEMPOLICY = 5228 + SYS_SET_MEMPOLICY = 5229 + SYS_MQ_OPEN = 5230 + SYS_MQ_UNLINK = 5231 + SYS_MQ_TIMEDSEND = 5232 + SYS_MQ_TIMEDRECEIVE = 5233 + SYS_MQ_NOTIFY = 5234 + SYS_MQ_GETSETATTR = 5235 + SYS_VSERVER = 5236 + SYS_WAITID = 5237 + SYS_ADD_KEY = 5239 + SYS_REQUEST_KEY = 5240 + SYS_KEYCTL = 5241 + SYS_SET_THREAD_AREA = 5242 + SYS_INOTIFY_INIT = 5243 + SYS_INOTIFY_ADD_WATCH = 5244 + SYS_INOTIFY_RM_WATCH = 5245 + SYS_MIGRATE_PAGES = 5246 + SYS_OPENAT = 5247 + SYS_MKDIRAT = 5248 + SYS_MKNODAT = 5249 + SYS_FCHOWNAT = 5250 + SYS_FUTIMESAT = 5251 + SYS_NEWFSTATAT = 5252 + SYS_UNLINKAT = 5253 + SYS_RENAMEAT = 5254 + SYS_LINKAT = 5255 + SYS_SYMLINKAT = 5256 + SYS_READLINKAT = 5257 + SYS_FCHMODAT = 5258 + SYS_FACCESSAT = 5259 + SYS_PSELECT6 = 5260 + SYS_PPOLL = 5261 + SYS_UNSHARE = 5262 + SYS_SPLICE = 5263 + SYS_SYNC_FILE_RANGE = 5264 + SYS_TEE = 5265 + SYS_VMSPLICE = 5266 + SYS_MOVE_PAGES = 5267 + SYS_SET_ROBUST_LIST = 5268 + SYS_GET_ROBUST_LIST = 5269 + SYS_KEXEC_LOAD = 5270 + SYS_GETCPU = 5271 + SYS_EPOLL_PWAIT = 5272 + SYS_IOPRIO_SET = 5273 + SYS_IOPRIO_GET = 5274 + SYS_UTIMENSAT = 5275 + SYS_SIGNALFD = 5276 + SYS_TIMERFD = 5277 + SYS_EVENTFD = 5278 + SYS_FALLOCATE = 5279 + SYS_TIMERFD_CREATE = 5280 + SYS_TIMERFD_GETTIME = 5281 + SYS_TIMERFD_SETTIME = 5282 + SYS_SIGNALFD4 = 5283 + SYS_EVENTFD2 = 5284 + SYS_EPOLL_CREATE1 = 5285 + SYS_DUP3 = 5286 + SYS_PIPE2 = 5287 + SYS_INOTIFY_INIT1 = 5288 + SYS_PREADV = 5289 + SYS_PWRITEV = 5290 + SYS_RT_TGSIGQUEUEINFO = 5291 + SYS_PERF_EVENT_OPEN = 5292 + SYS_ACCEPT4 = 5293 + SYS_RECVMMSG = 5294 + SYS_FANOTIFY_INIT = 5295 + SYS_FANOTIFY_MARK = 5296 + SYS_PRLIMIT64 = 5297 + SYS_NAME_TO_HANDLE_AT = 5298 + SYS_OPEN_BY_HANDLE_AT = 5299 + SYS_CLOCK_ADJTIME = 5300 + SYS_SYNCFS = 5301 + SYS_SENDMMSG = 5302 + SYS_SETNS = 5303 + SYS_PROCESS_VM_READV = 5304 + SYS_PROCESS_VM_WRITEV = 5305 + SYS_KCMP = 5306 + SYS_FINIT_MODULE = 5307 + SYS_GETDENTS64 = 5308 + SYS_SCHED_SETATTR = 5309 + SYS_SCHED_GETATTR = 5310 + SYS_RENAMEAT2 = 5311 + SYS_SECCOMP = 5312 + SYS_GETRANDOM = 5313 + SYS_MEMFD_CREATE = 5314 + SYS_BPF = 5315 + SYS_EXECVEAT = 5316 + SYS_USERFAULTFD = 5317 + SYS_MEMBARRIER = 5318 + SYS_MLOCK2 = 5319 + SYS_COPY_FILE_RANGE = 5320 + SYS_PREADV2 = 5321 + SYS_PWRITEV2 = 5322 + SYS_PKEY_MPROTECT = 5323 + SYS_PKEY_ALLOC = 5324 + SYS_PKEY_FREE = 5325 + SYS_STATX = 5326 + SYS_RSEQ = 5327 + SYS_IO_PGETEVENTS = 5328 + SYS_PIDFD_SEND_SIGNAL = 5424 + SYS_IO_URING_SETUP = 5425 + SYS_IO_URING_ENTER = 5426 + SYS_IO_URING_REGISTER = 5427 + SYS_OPEN_TREE = 5428 + SYS_MOVE_MOUNT = 5429 + SYS_FSOPEN = 5430 + SYS_FSCONFIG = 5431 + SYS_FSMOUNT = 5432 + SYS_FSPICK = 5433 + SYS_PIDFD_OPEN = 5434 + SYS_CLONE3 = 5435 + SYS_CLOSE_RANGE = 5436 + SYS_OPENAT2 = 5437 + SYS_PIDFD_GETFD = 5438 + SYS_FACCESSAT2 = 5439 + SYS_PROCESS_MADVISE = 5440 + SYS_EPOLL_PWAIT2 = 5441 + SYS_MOUNT_SETATTR = 5442 + SYS_QUOTACTL_FD = 5443 + SYS_LANDLOCK_CREATE_RULESET = 5444 + SYS_LANDLOCK_ADD_RULE = 5445 + SYS_LANDLOCK_RESTRICT_SELF = 5446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index 46077689a..45082dd67 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -7,351 +7,355 @@ package unix const ( - SYS_READ = 5000 - SYS_WRITE = 5001 - SYS_OPEN = 5002 - SYS_CLOSE = 5003 - SYS_STAT = 5004 - SYS_FSTAT = 5005 - SYS_LSTAT = 5006 - SYS_POLL = 5007 - SYS_LSEEK = 5008 - SYS_MMAP = 5009 - SYS_MPROTECT = 5010 - SYS_MUNMAP = 5011 - SYS_BRK = 5012 - SYS_RT_SIGACTION = 5013 - SYS_RT_SIGPROCMASK = 5014 - SYS_IOCTL = 5015 - SYS_PREAD64 = 5016 - SYS_PWRITE64 = 5017 - SYS_READV = 5018 - SYS_WRITEV = 5019 - SYS_ACCESS = 5020 - SYS_PIPE = 5021 - SYS__NEWSELECT = 5022 - SYS_SCHED_YIELD = 5023 - SYS_MREMAP = 5024 - SYS_MSYNC = 5025 - SYS_MINCORE = 5026 - SYS_MADVISE = 5027 - SYS_SHMGET = 5028 - SYS_SHMAT = 5029 - SYS_SHMCTL = 5030 - SYS_DUP = 5031 - SYS_DUP2 = 5032 - SYS_PAUSE = 5033 - SYS_NANOSLEEP = 5034 - SYS_GETITIMER = 5035 - SYS_SETITIMER = 5036 - SYS_ALARM = 5037 - SYS_GETPID = 5038 - SYS_SENDFILE = 5039 - SYS_SOCKET = 5040 - SYS_CONNECT = 5041 - SYS_ACCEPT = 5042 - SYS_SENDTO = 5043 - SYS_RECVFROM = 5044 - SYS_SENDMSG = 5045 - SYS_RECVMSG = 5046 - SYS_SHUTDOWN = 5047 - SYS_BIND = 5048 - SYS_LISTEN = 5049 - SYS_GETSOCKNAME = 5050 - SYS_GETPEERNAME = 5051 - SYS_SOCKETPAIR = 5052 - SYS_SETSOCKOPT = 5053 - SYS_GETSOCKOPT = 5054 - SYS_CLONE = 5055 - SYS_FORK = 5056 - SYS_EXECVE = 5057 - SYS_EXIT = 5058 - SYS_WAIT4 = 5059 - SYS_KILL = 5060 - SYS_UNAME = 5061 - SYS_SEMGET = 5062 - SYS_SEMOP = 5063 - SYS_SEMCTL = 5064 - SYS_SHMDT = 5065 - SYS_MSGGET = 5066 - SYS_MSGSND = 5067 - SYS_MSGRCV = 5068 - SYS_MSGCTL = 5069 - SYS_FCNTL = 5070 - SYS_FLOCK = 5071 - SYS_FSYNC = 5072 - SYS_FDATASYNC = 5073 - SYS_TRUNCATE = 5074 - SYS_FTRUNCATE = 5075 - SYS_GETDENTS = 5076 - SYS_GETCWD = 5077 - SYS_CHDIR = 5078 - SYS_FCHDIR = 5079 - SYS_RENAME = 5080 - SYS_MKDIR = 5081 - SYS_RMDIR = 5082 - SYS_CREAT = 5083 - SYS_LINK = 5084 - SYS_UNLINK = 5085 - SYS_SYMLINK = 5086 - SYS_READLINK = 5087 - SYS_CHMOD = 5088 - SYS_FCHMOD = 5089 - SYS_CHOWN = 5090 - SYS_FCHOWN = 5091 - SYS_LCHOWN = 5092 - SYS_UMASK = 5093 - SYS_GETTIMEOFDAY = 5094 - SYS_GETRLIMIT = 5095 - SYS_GETRUSAGE = 5096 - SYS_SYSINFO = 5097 - SYS_TIMES = 5098 - SYS_PTRACE = 5099 - SYS_GETUID = 5100 - SYS_SYSLOG = 5101 - SYS_GETGID = 5102 - SYS_SETUID = 5103 - SYS_SETGID = 5104 - SYS_GETEUID = 5105 - SYS_GETEGID = 5106 - SYS_SETPGID = 5107 - SYS_GETPPID = 5108 - SYS_GETPGRP = 5109 - SYS_SETSID = 5110 - SYS_SETREUID = 5111 - SYS_SETREGID = 5112 - SYS_GETGROUPS = 5113 - SYS_SETGROUPS = 5114 - SYS_SETRESUID = 5115 - SYS_GETRESUID = 5116 - SYS_SETRESGID = 5117 - SYS_GETRESGID = 5118 - SYS_GETPGID = 5119 - SYS_SETFSUID = 5120 - SYS_SETFSGID = 5121 - SYS_GETSID = 5122 - SYS_CAPGET = 5123 - SYS_CAPSET = 5124 - SYS_RT_SIGPENDING = 5125 - SYS_RT_SIGTIMEDWAIT = 5126 - SYS_RT_SIGQUEUEINFO = 5127 - SYS_RT_SIGSUSPEND = 5128 - SYS_SIGALTSTACK = 5129 - SYS_UTIME = 5130 - SYS_MKNOD = 5131 - SYS_PERSONALITY = 5132 - SYS_USTAT = 5133 - SYS_STATFS = 5134 - SYS_FSTATFS = 5135 - SYS_SYSFS = 5136 - SYS_GETPRIORITY = 5137 - SYS_SETPRIORITY = 5138 - SYS_SCHED_SETPARAM = 5139 - SYS_SCHED_GETPARAM = 5140 - SYS_SCHED_SETSCHEDULER = 5141 - SYS_SCHED_GETSCHEDULER = 5142 - SYS_SCHED_GET_PRIORITY_MAX = 5143 - SYS_SCHED_GET_PRIORITY_MIN = 5144 - SYS_SCHED_RR_GET_INTERVAL = 5145 - SYS_MLOCK = 5146 - SYS_MUNLOCK = 5147 - SYS_MLOCKALL = 5148 - SYS_MUNLOCKALL = 5149 - SYS_VHANGUP = 5150 - SYS_PIVOT_ROOT = 5151 - SYS__SYSCTL = 5152 - SYS_PRCTL = 5153 - SYS_ADJTIMEX = 5154 - SYS_SETRLIMIT = 5155 - SYS_CHROOT = 5156 - SYS_SYNC = 5157 - SYS_ACCT = 5158 - SYS_SETTIMEOFDAY = 5159 - SYS_MOUNT = 5160 - SYS_UMOUNT2 = 5161 - SYS_SWAPON = 5162 - SYS_SWAPOFF = 5163 - SYS_REBOOT = 5164 - SYS_SETHOSTNAME = 5165 - SYS_SETDOMAINNAME = 5166 - SYS_CREATE_MODULE = 5167 - SYS_INIT_MODULE = 5168 - SYS_DELETE_MODULE = 5169 - SYS_GET_KERNEL_SYMS = 5170 - SYS_QUERY_MODULE = 5171 - SYS_QUOTACTL = 5172 - SYS_NFSSERVCTL = 5173 - SYS_GETPMSG = 5174 - SYS_PUTPMSG = 5175 - SYS_AFS_SYSCALL = 5176 - SYS_RESERVED177 = 5177 - SYS_GETTID = 5178 - SYS_READAHEAD = 5179 - SYS_SETXATTR = 5180 - SYS_LSETXATTR = 5181 - SYS_FSETXATTR = 5182 - SYS_GETXATTR = 5183 - SYS_LGETXATTR = 5184 - SYS_FGETXATTR = 5185 - SYS_LISTXATTR = 5186 - SYS_LLISTXATTR = 5187 - SYS_FLISTXATTR = 5188 - SYS_REMOVEXATTR = 5189 - SYS_LREMOVEXATTR = 5190 - SYS_FREMOVEXATTR = 5191 - SYS_TKILL = 5192 - SYS_RESERVED193 = 5193 - SYS_FUTEX = 5194 - SYS_SCHED_SETAFFINITY = 5195 - SYS_SCHED_GETAFFINITY = 5196 - SYS_CACHEFLUSH = 5197 - SYS_CACHECTL = 5198 - SYS_SYSMIPS = 5199 - SYS_IO_SETUP = 5200 - SYS_IO_DESTROY = 5201 - SYS_IO_GETEVENTS = 5202 - SYS_IO_SUBMIT = 5203 - SYS_IO_CANCEL = 5204 - SYS_EXIT_GROUP = 5205 - SYS_LOOKUP_DCOOKIE = 5206 - SYS_EPOLL_CREATE = 5207 - SYS_EPOLL_CTL = 5208 - SYS_EPOLL_WAIT = 5209 - SYS_REMAP_FILE_PAGES = 5210 - SYS_RT_SIGRETURN = 5211 - SYS_SET_TID_ADDRESS = 5212 - SYS_RESTART_SYSCALL = 5213 - SYS_SEMTIMEDOP = 5214 - SYS_FADVISE64 = 5215 - SYS_TIMER_CREATE = 5216 - SYS_TIMER_SETTIME = 5217 - SYS_TIMER_GETTIME = 5218 - SYS_TIMER_GETOVERRUN = 5219 - SYS_TIMER_DELETE = 5220 - SYS_CLOCK_SETTIME = 5221 - SYS_CLOCK_GETTIME = 5222 - SYS_CLOCK_GETRES = 5223 - SYS_CLOCK_NANOSLEEP = 5224 - SYS_TGKILL = 5225 - SYS_UTIMES = 5226 - SYS_MBIND = 5227 - SYS_GET_MEMPOLICY = 5228 - SYS_SET_MEMPOLICY = 5229 - SYS_MQ_OPEN = 5230 - SYS_MQ_UNLINK = 5231 - SYS_MQ_TIMEDSEND = 5232 - SYS_MQ_TIMEDRECEIVE = 5233 - SYS_MQ_NOTIFY = 5234 - SYS_MQ_GETSETATTR = 5235 - SYS_VSERVER = 5236 - SYS_WAITID = 5237 - SYS_ADD_KEY = 5239 - SYS_REQUEST_KEY = 5240 - SYS_KEYCTL = 5241 - SYS_SET_THREAD_AREA = 5242 - SYS_INOTIFY_INIT = 5243 - SYS_INOTIFY_ADD_WATCH = 5244 - SYS_INOTIFY_RM_WATCH = 5245 - SYS_MIGRATE_PAGES = 5246 - SYS_OPENAT = 5247 - SYS_MKDIRAT = 5248 - SYS_MKNODAT = 5249 - SYS_FCHOWNAT = 5250 - SYS_FUTIMESAT = 5251 - SYS_NEWFSTATAT = 5252 - SYS_UNLINKAT = 5253 - SYS_RENAMEAT = 5254 - SYS_LINKAT = 5255 - SYS_SYMLINKAT = 5256 - SYS_READLINKAT = 5257 - SYS_FCHMODAT = 5258 - SYS_FACCESSAT = 5259 - SYS_PSELECT6 = 5260 - SYS_PPOLL = 5261 - SYS_UNSHARE = 5262 - SYS_SPLICE = 5263 - SYS_SYNC_FILE_RANGE = 5264 - SYS_TEE = 5265 - SYS_VMSPLICE = 5266 - SYS_MOVE_PAGES = 5267 - SYS_SET_ROBUST_LIST = 5268 - SYS_GET_ROBUST_LIST = 5269 - SYS_KEXEC_LOAD = 5270 - SYS_GETCPU = 5271 - SYS_EPOLL_PWAIT = 5272 - SYS_IOPRIO_SET = 5273 - SYS_IOPRIO_GET = 5274 - SYS_UTIMENSAT = 5275 - SYS_SIGNALFD = 5276 - SYS_TIMERFD = 5277 - SYS_EVENTFD = 5278 - SYS_FALLOCATE = 5279 - SYS_TIMERFD_CREATE = 5280 - SYS_TIMERFD_GETTIME = 5281 - SYS_TIMERFD_SETTIME = 5282 - SYS_SIGNALFD4 = 5283 - SYS_EVENTFD2 = 5284 - SYS_EPOLL_CREATE1 = 5285 - SYS_DUP3 = 5286 - SYS_PIPE2 = 5287 - SYS_INOTIFY_INIT1 = 5288 - SYS_PREADV = 5289 - SYS_PWRITEV = 5290 - SYS_RT_TGSIGQUEUEINFO = 5291 - SYS_PERF_EVENT_OPEN = 5292 - SYS_ACCEPT4 = 5293 - SYS_RECVMMSG = 5294 - SYS_FANOTIFY_INIT = 5295 - SYS_FANOTIFY_MARK = 5296 - SYS_PRLIMIT64 = 5297 - SYS_NAME_TO_HANDLE_AT = 5298 - SYS_OPEN_BY_HANDLE_AT = 5299 - SYS_CLOCK_ADJTIME = 5300 - SYS_SYNCFS = 5301 - SYS_SENDMMSG = 5302 - SYS_SETNS = 5303 - SYS_PROCESS_VM_READV = 5304 - SYS_PROCESS_VM_WRITEV = 5305 - SYS_KCMP = 5306 - SYS_FINIT_MODULE = 5307 - SYS_GETDENTS64 = 5308 - SYS_SCHED_SETATTR = 5309 - SYS_SCHED_GETATTR = 5310 - SYS_RENAMEAT2 = 5311 - SYS_SECCOMP = 5312 - SYS_GETRANDOM = 5313 - SYS_MEMFD_CREATE = 5314 - SYS_BPF = 5315 - SYS_EXECVEAT = 5316 - SYS_USERFAULTFD = 5317 - SYS_MEMBARRIER = 5318 - SYS_MLOCK2 = 5319 - SYS_COPY_FILE_RANGE = 5320 - SYS_PREADV2 = 5321 - SYS_PWRITEV2 = 5322 - SYS_PKEY_MPROTECT = 5323 - SYS_PKEY_ALLOC = 5324 - SYS_PKEY_FREE = 5325 - SYS_STATX = 5326 - SYS_RSEQ = 5327 - SYS_IO_PGETEVENTS = 5328 - SYS_PIDFD_SEND_SIGNAL = 5424 - SYS_IO_URING_SETUP = 5425 - SYS_IO_URING_ENTER = 5426 - SYS_IO_URING_REGISTER = 5427 - SYS_OPEN_TREE = 5428 - SYS_MOVE_MOUNT = 5429 - SYS_FSOPEN = 5430 - SYS_FSCONFIG = 5431 - SYS_FSMOUNT = 5432 - SYS_FSPICK = 5433 - SYS_PIDFD_OPEN = 5434 - SYS_CLONE3 = 5435 - SYS_CLOSE_RANGE = 5436 - SYS_OPENAT2 = 5437 - SYS_PIDFD_GETFD = 5438 - SYS_FACCESSAT2 = 5439 - SYS_PROCESS_MADVISE = 5440 - SYS_EPOLL_PWAIT2 = 5441 - SYS_MOUNT_SETATTR = 5442 + SYS_READ = 5000 + SYS_WRITE = 5001 + SYS_OPEN = 5002 + SYS_CLOSE = 5003 + SYS_STAT = 5004 + SYS_FSTAT = 5005 + SYS_LSTAT = 5006 + SYS_POLL = 5007 + SYS_LSEEK = 5008 + SYS_MMAP = 5009 + SYS_MPROTECT = 5010 + SYS_MUNMAP = 5011 + SYS_BRK = 5012 + SYS_RT_SIGACTION = 5013 + SYS_RT_SIGPROCMASK = 5014 + SYS_IOCTL = 5015 + SYS_PREAD64 = 5016 + SYS_PWRITE64 = 5017 + SYS_READV = 5018 + SYS_WRITEV = 5019 + SYS_ACCESS = 5020 + SYS_PIPE = 5021 + SYS__NEWSELECT = 5022 + SYS_SCHED_YIELD = 5023 + SYS_MREMAP = 5024 + SYS_MSYNC = 5025 + SYS_MINCORE = 5026 + SYS_MADVISE = 5027 + SYS_SHMGET = 5028 + SYS_SHMAT = 5029 + SYS_SHMCTL = 5030 + SYS_DUP = 5031 + SYS_DUP2 = 5032 + SYS_PAUSE = 5033 + SYS_NANOSLEEP = 5034 + SYS_GETITIMER = 5035 + SYS_SETITIMER = 5036 + SYS_ALARM = 5037 + SYS_GETPID = 5038 + SYS_SENDFILE = 5039 + SYS_SOCKET = 5040 + SYS_CONNECT = 5041 + SYS_ACCEPT = 5042 + SYS_SENDTO = 5043 + SYS_RECVFROM = 5044 + SYS_SENDMSG = 5045 + SYS_RECVMSG = 5046 + SYS_SHUTDOWN = 5047 + SYS_BIND = 5048 + SYS_LISTEN = 5049 + SYS_GETSOCKNAME = 5050 + SYS_GETPEERNAME = 5051 + SYS_SOCKETPAIR = 5052 + SYS_SETSOCKOPT = 5053 + SYS_GETSOCKOPT = 5054 + SYS_CLONE = 5055 + SYS_FORK = 5056 + SYS_EXECVE = 5057 + SYS_EXIT = 5058 + SYS_WAIT4 = 5059 + SYS_KILL = 5060 + SYS_UNAME = 5061 + SYS_SEMGET = 5062 + SYS_SEMOP = 5063 + SYS_SEMCTL = 5064 + SYS_SHMDT = 5065 + SYS_MSGGET = 5066 + SYS_MSGSND = 5067 + SYS_MSGRCV = 5068 + SYS_MSGCTL = 5069 + SYS_FCNTL = 5070 + SYS_FLOCK = 5071 + SYS_FSYNC = 5072 + SYS_FDATASYNC = 5073 + SYS_TRUNCATE = 5074 + SYS_FTRUNCATE = 5075 + SYS_GETDENTS = 5076 + SYS_GETCWD = 5077 + SYS_CHDIR = 5078 + SYS_FCHDIR = 5079 + SYS_RENAME = 5080 + SYS_MKDIR = 5081 + SYS_RMDIR = 5082 + SYS_CREAT = 5083 + SYS_LINK = 5084 + SYS_UNLINK = 5085 + SYS_SYMLINK = 5086 + SYS_READLINK = 5087 + SYS_CHMOD = 5088 + SYS_FCHMOD = 5089 + SYS_CHOWN = 5090 + SYS_FCHOWN = 5091 + SYS_LCHOWN = 5092 + SYS_UMASK = 5093 + SYS_GETTIMEOFDAY = 5094 + SYS_GETRLIMIT = 5095 + SYS_GETRUSAGE = 5096 + SYS_SYSINFO = 5097 + SYS_TIMES = 5098 + SYS_PTRACE = 5099 + SYS_GETUID = 5100 + SYS_SYSLOG = 5101 + SYS_GETGID = 5102 + SYS_SETUID = 5103 + SYS_SETGID = 5104 + SYS_GETEUID = 5105 + SYS_GETEGID = 5106 + SYS_SETPGID = 5107 + SYS_GETPPID = 5108 + SYS_GETPGRP = 5109 + SYS_SETSID = 5110 + SYS_SETREUID = 5111 + SYS_SETREGID = 5112 + SYS_GETGROUPS = 5113 + SYS_SETGROUPS = 5114 + SYS_SETRESUID = 5115 + SYS_GETRESUID = 5116 + SYS_SETRESGID = 5117 + SYS_GETRESGID = 5118 + SYS_GETPGID = 5119 + SYS_SETFSUID = 5120 + SYS_SETFSGID = 5121 + SYS_GETSID = 5122 + SYS_CAPGET = 5123 + SYS_CAPSET = 5124 + SYS_RT_SIGPENDING = 5125 + SYS_RT_SIGTIMEDWAIT = 5126 + SYS_RT_SIGQUEUEINFO = 5127 + SYS_RT_SIGSUSPEND = 5128 + SYS_SIGALTSTACK = 5129 + SYS_UTIME = 5130 + SYS_MKNOD = 5131 + SYS_PERSONALITY = 5132 + SYS_USTAT = 5133 + SYS_STATFS = 5134 + SYS_FSTATFS = 5135 + SYS_SYSFS = 5136 + SYS_GETPRIORITY = 5137 + SYS_SETPRIORITY = 5138 + SYS_SCHED_SETPARAM = 5139 + SYS_SCHED_GETPARAM = 5140 + SYS_SCHED_SETSCHEDULER = 5141 + SYS_SCHED_GETSCHEDULER = 5142 + SYS_SCHED_GET_PRIORITY_MAX = 5143 + SYS_SCHED_GET_PRIORITY_MIN = 5144 + SYS_SCHED_RR_GET_INTERVAL = 5145 + SYS_MLOCK = 5146 + SYS_MUNLOCK = 5147 + SYS_MLOCKALL = 5148 + SYS_MUNLOCKALL = 5149 + SYS_VHANGUP = 5150 + SYS_PIVOT_ROOT = 5151 + SYS__SYSCTL = 5152 + SYS_PRCTL = 5153 + SYS_ADJTIMEX = 5154 + SYS_SETRLIMIT = 5155 + SYS_CHROOT = 5156 + SYS_SYNC = 5157 + SYS_ACCT = 5158 + SYS_SETTIMEOFDAY = 5159 + SYS_MOUNT = 5160 + SYS_UMOUNT2 = 5161 + SYS_SWAPON = 5162 + SYS_SWAPOFF = 5163 + SYS_REBOOT = 5164 + SYS_SETHOSTNAME = 5165 + SYS_SETDOMAINNAME = 5166 + SYS_CREATE_MODULE = 5167 + SYS_INIT_MODULE = 5168 + SYS_DELETE_MODULE = 5169 + SYS_GET_KERNEL_SYMS = 5170 + SYS_QUERY_MODULE = 5171 + SYS_QUOTACTL = 5172 + SYS_NFSSERVCTL = 5173 + SYS_GETPMSG = 5174 + SYS_PUTPMSG = 5175 + SYS_AFS_SYSCALL = 5176 + SYS_RESERVED177 = 5177 + SYS_GETTID = 5178 + SYS_READAHEAD = 5179 + SYS_SETXATTR = 5180 + SYS_LSETXATTR = 5181 + SYS_FSETXATTR = 5182 + SYS_GETXATTR = 5183 + SYS_LGETXATTR = 5184 + SYS_FGETXATTR = 5185 + SYS_LISTXATTR = 5186 + SYS_LLISTXATTR = 5187 + SYS_FLISTXATTR = 5188 + SYS_REMOVEXATTR = 5189 + SYS_LREMOVEXATTR = 5190 + SYS_FREMOVEXATTR = 5191 + SYS_TKILL = 5192 + SYS_RESERVED193 = 5193 + SYS_FUTEX = 5194 + SYS_SCHED_SETAFFINITY = 5195 + SYS_SCHED_GETAFFINITY = 5196 + SYS_CACHEFLUSH = 5197 + SYS_CACHECTL = 5198 + SYS_SYSMIPS = 5199 + SYS_IO_SETUP = 5200 + SYS_IO_DESTROY = 5201 + SYS_IO_GETEVENTS = 5202 + SYS_IO_SUBMIT = 5203 + SYS_IO_CANCEL = 5204 + SYS_EXIT_GROUP = 5205 + SYS_LOOKUP_DCOOKIE = 5206 + SYS_EPOLL_CREATE = 5207 + SYS_EPOLL_CTL = 5208 + SYS_EPOLL_WAIT = 5209 + SYS_REMAP_FILE_PAGES = 5210 + SYS_RT_SIGRETURN = 5211 + SYS_SET_TID_ADDRESS = 5212 + SYS_RESTART_SYSCALL = 5213 + SYS_SEMTIMEDOP = 5214 + SYS_FADVISE64 = 5215 + SYS_TIMER_CREATE = 5216 + SYS_TIMER_SETTIME = 5217 + SYS_TIMER_GETTIME = 5218 + SYS_TIMER_GETOVERRUN = 5219 + SYS_TIMER_DELETE = 5220 + SYS_CLOCK_SETTIME = 5221 + SYS_CLOCK_GETTIME = 5222 + SYS_CLOCK_GETRES = 5223 + SYS_CLOCK_NANOSLEEP = 5224 + SYS_TGKILL = 5225 + SYS_UTIMES = 5226 + SYS_MBIND = 5227 + SYS_GET_MEMPOLICY = 5228 + SYS_SET_MEMPOLICY = 5229 + SYS_MQ_OPEN = 5230 + SYS_MQ_UNLINK = 5231 + SYS_MQ_TIMEDSEND = 5232 + SYS_MQ_TIMEDRECEIVE = 5233 + SYS_MQ_NOTIFY = 5234 + SYS_MQ_GETSETATTR = 5235 + SYS_VSERVER = 5236 + SYS_WAITID = 5237 + SYS_ADD_KEY = 5239 + SYS_REQUEST_KEY = 5240 + SYS_KEYCTL = 5241 + SYS_SET_THREAD_AREA = 5242 + SYS_INOTIFY_INIT = 5243 + SYS_INOTIFY_ADD_WATCH = 5244 + SYS_INOTIFY_RM_WATCH = 5245 + SYS_MIGRATE_PAGES = 5246 + SYS_OPENAT = 5247 + SYS_MKDIRAT = 5248 + SYS_MKNODAT = 5249 + SYS_FCHOWNAT = 5250 + SYS_FUTIMESAT = 5251 + SYS_NEWFSTATAT = 5252 + SYS_UNLINKAT = 5253 + SYS_RENAMEAT = 5254 + SYS_LINKAT = 5255 + SYS_SYMLINKAT = 5256 + SYS_READLINKAT = 5257 + SYS_FCHMODAT = 5258 + SYS_FACCESSAT = 5259 + SYS_PSELECT6 = 5260 + SYS_PPOLL = 5261 + SYS_UNSHARE = 5262 + SYS_SPLICE = 5263 + SYS_SYNC_FILE_RANGE = 5264 + SYS_TEE = 5265 + SYS_VMSPLICE = 5266 + SYS_MOVE_PAGES = 5267 + SYS_SET_ROBUST_LIST = 5268 + SYS_GET_ROBUST_LIST = 5269 + SYS_KEXEC_LOAD = 5270 + SYS_GETCPU = 5271 + SYS_EPOLL_PWAIT = 5272 + SYS_IOPRIO_SET = 5273 + SYS_IOPRIO_GET = 5274 + SYS_UTIMENSAT = 5275 + SYS_SIGNALFD = 5276 + SYS_TIMERFD = 5277 + SYS_EVENTFD = 5278 + SYS_FALLOCATE = 5279 + SYS_TIMERFD_CREATE = 5280 + SYS_TIMERFD_GETTIME = 5281 + SYS_TIMERFD_SETTIME = 5282 + SYS_SIGNALFD4 = 5283 + SYS_EVENTFD2 = 5284 + SYS_EPOLL_CREATE1 = 5285 + SYS_DUP3 = 5286 + SYS_PIPE2 = 5287 + SYS_INOTIFY_INIT1 = 5288 + SYS_PREADV = 5289 + SYS_PWRITEV = 5290 + SYS_RT_TGSIGQUEUEINFO = 5291 + SYS_PERF_EVENT_OPEN = 5292 + SYS_ACCEPT4 = 5293 + SYS_RECVMMSG = 5294 + SYS_FANOTIFY_INIT = 5295 + SYS_FANOTIFY_MARK = 5296 + SYS_PRLIMIT64 = 5297 + SYS_NAME_TO_HANDLE_AT = 5298 + SYS_OPEN_BY_HANDLE_AT = 5299 + SYS_CLOCK_ADJTIME = 5300 + SYS_SYNCFS = 5301 + SYS_SENDMMSG = 5302 + SYS_SETNS = 5303 + SYS_PROCESS_VM_READV = 5304 + SYS_PROCESS_VM_WRITEV = 5305 + SYS_KCMP = 5306 + SYS_FINIT_MODULE = 5307 + SYS_GETDENTS64 = 5308 + SYS_SCHED_SETATTR = 5309 + SYS_SCHED_GETATTR = 5310 + SYS_RENAMEAT2 = 5311 + SYS_SECCOMP = 5312 + SYS_GETRANDOM = 5313 + SYS_MEMFD_CREATE = 5314 + SYS_BPF = 5315 + SYS_EXECVEAT = 5316 + SYS_USERFAULTFD = 5317 + SYS_MEMBARRIER = 5318 + SYS_MLOCK2 = 5319 + SYS_COPY_FILE_RANGE = 5320 + SYS_PREADV2 = 5321 + SYS_PWRITEV2 = 5322 + SYS_PKEY_MPROTECT = 5323 + SYS_PKEY_ALLOC = 5324 + SYS_PKEY_FREE = 5325 + SYS_STATX = 5326 + SYS_RSEQ = 5327 + SYS_IO_PGETEVENTS = 5328 + SYS_PIDFD_SEND_SIGNAL = 5424 + SYS_IO_URING_SETUP = 5425 + SYS_IO_URING_ENTER = 5426 + SYS_IO_URING_REGISTER = 5427 + SYS_OPEN_TREE = 5428 + SYS_MOVE_MOUNT = 5429 + SYS_FSOPEN = 5430 + SYS_FSCONFIG = 5431 + SYS_FSMOUNT = 5432 + SYS_FSPICK = 5433 + SYS_PIDFD_OPEN = 5434 + SYS_CLONE3 = 5435 + SYS_CLOSE_RANGE = 5436 + SYS_OPENAT2 = 5437 + SYS_PIDFD_GETFD = 5438 + SYS_FACCESSAT2 = 5439 + SYS_PROCESS_MADVISE = 5440 + SYS_EPOLL_PWAIT2 = 5441 + SYS_MOUNT_SETATTR = 5442 + SYS_QUOTACTL_FD = 5443 + SYS_LANDLOCK_CREATE_RULESET = 5444 + SYS_LANDLOCK_ADD_RULE = 5445 + SYS_LANDLOCK_RESTRICT_SELF = 5446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index 80e6696b3..570a857a5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -424,4 +424,8 @@ const ( SYS_PROCESS_MADVISE = 4440 SYS_EPOLL_PWAIT2 = 4441 SYS_MOUNT_SETATTR = 4442 + SYS_QUOTACTL_FD = 4443 + SYS_LANDLOCK_CREATE_RULESET = 4444 + SYS_LANDLOCK_ADD_RULE = 4445 + SYS_LANDLOCK_RESTRICT_SELF = 4446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go index b9d697ffb..638498d62 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -431,4 +431,8 @@ const ( SYS_PROCESS_MADVISE = 440 SYS_EPOLL_PWAIT2 = 441 SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index 08edc54d3..702beebfe 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -7,400 +7,404 @@ package unix const ( - SYS_RESTART_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAITPID = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECVE = 11 - SYS_CHDIR = 12 - SYS_TIME = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LCHOWN = 16 - SYS_BREAK = 17 - SYS_OLDSTAT = 18 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_MOUNT = 21 - SYS_UMOUNT = 22 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_STIME = 25 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_OLDFSTAT = 28 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_STTY = 31 - SYS_GTTY = 32 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_FTIME = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_RENAME = 38 - SYS_MKDIR = 39 - SYS_RMDIR = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_PROF = 44 - SYS_BRK = 45 - SYS_SETGID = 46 - SYS_GETGID = 47 - SYS_SIGNAL = 48 - SYS_GETEUID = 49 - SYS_GETEGID = 50 - SYS_ACCT = 51 - SYS_UMOUNT2 = 52 - SYS_LOCK = 53 - SYS_IOCTL = 54 - SYS_FCNTL = 55 - SYS_MPX = 56 - SYS_SETPGID = 57 - SYS_ULIMIT = 58 - SYS_OLDOLDUNAME = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_USTAT = 62 - SYS_DUP2 = 63 - SYS_GETPPID = 64 - SYS_GETPGRP = 65 - SYS_SETSID = 66 - SYS_SIGACTION = 67 - SYS_SGETMASK = 68 - SYS_SSETMASK = 69 - SYS_SETREUID = 70 - SYS_SETREGID = 71 - SYS_SIGSUSPEND = 72 - SYS_SIGPENDING = 73 - SYS_SETHOSTNAME = 74 - SYS_SETRLIMIT = 75 - SYS_GETRLIMIT = 76 - SYS_GETRUSAGE = 77 - SYS_GETTIMEOFDAY = 78 - SYS_SETTIMEOFDAY = 79 - SYS_GETGROUPS = 80 - SYS_SETGROUPS = 81 - SYS_SELECT = 82 - SYS_SYMLINK = 83 - SYS_OLDLSTAT = 84 - SYS_READLINK = 85 - SYS_USELIB = 86 - SYS_SWAPON = 87 - SYS_REBOOT = 88 - SYS_READDIR = 89 - SYS_MMAP = 90 - SYS_MUNMAP = 91 - SYS_TRUNCATE = 92 - SYS_FTRUNCATE = 93 - SYS_FCHMOD = 94 - SYS_FCHOWN = 95 - SYS_GETPRIORITY = 96 - SYS_SETPRIORITY = 97 - SYS_PROFIL = 98 - SYS_STATFS = 99 - SYS_FSTATFS = 100 - SYS_IOPERM = 101 - SYS_SOCKETCALL = 102 - SYS_SYSLOG = 103 - SYS_SETITIMER = 104 - SYS_GETITIMER = 105 - SYS_STAT = 106 - SYS_LSTAT = 107 - SYS_FSTAT = 108 - SYS_OLDUNAME = 109 - SYS_IOPL = 110 - SYS_VHANGUP = 111 - SYS_IDLE = 112 - SYS_VM86 = 113 - SYS_WAIT4 = 114 - SYS_SWAPOFF = 115 - SYS_SYSINFO = 116 - SYS_IPC = 117 - SYS_FSYNC = 118 - SYS_SIGRETURN = 119 - SYS_CLONE = 120 - SYS_SETDOMAINNAME = 121 - SYS_UNAME = 122 - SYS_MODIFY_LDT = 123 - SYS_ADJTIMEX = 124 - SYS_MPROTECT = 125 - SYS_SIGPROCMASK = 126 - SYS_CREATE_MODULE = 127 - SYS_INIT_MODULE = 128 - SYS_DELETE_MODULE = 129 - SYS_GET_KERNEL_SYMS = 130 - SYS_QUOTACTL = 131 - SYS_GETPGID = 132 - SYS_FCHDIR = 133 - SYS_BDFLUSH = 134 - SYS_SYSFS = 135 - SYS_PERSONALITY = 136 - SYS_AFS_SYSCALL = 137 - SYS_SETFSUID = 138 - SYS_SETFSGID = 139 - SYS__LLSEEK = 140 - SYS_GETDENTS = 141 - SYS__NEWSELECT = 142 - SYS_FLOCK = 143 - SYS_MSYNC = 144 - SYS_READV = 145 - SYS_WRITEV = 146 - SYS_GETSID = 147 - SYS_FDATASYNC = 148 - SYS__SYSCTL = 149 - SYS_MLOCK = 150 - SYS_MUNLOCK = 151 - SYS_MLOCKALL = 152 - SYS_MUNLOCKALL = 153 - SYS_SCHED_SETPARAM = 154 - SYS_SCHED_GETPARAM = 155 - SYS_SCHED_SETSCHEDULER = 156 - SYS_SCHED_GETSCHEDULER = 157 - SYS_SCHED_YIELD = 158 - SYS_SCHED_GET_PRIORITY_MAX = 159 - SYS_SCHED_GET_PRIORITY_MIN = 160 - SYS_SCHED_RR_GET_INTERVAL = 161 - SYS_NANOSLEEP = 162 - SYS_MREMAP = 163 - SYS_SETRESUID = 164 - SYS_GETRESUID = 165 - SYS_QUERY_MODULE = 166 - SYS_POLL = 167 - SYS_NFSSERVCTL = 168 - SYS_SETRESGID = 169 - SYS_GETRESGID = 170 - SYS_PRCTL = 171 - SYS_RT_SIGRETURN = 172 - SYS_RT_SIGACTION = 173 - SYS_RT_SIGPROCMASK = 174 - SYS_RT_SIGPENDING = 175 - SYS_RT_SIGTIMEDWAIT = 176 - SYS_RT_SIGQUEUEINFO = 177 - SYS_RT_SIGSUSPEND = 178 - SYS_PREAD64 = 179 - SYS_PWRITE64 = 180 - SYS_CHOWN = 181 - SYS_GETCWD = 182 - SYS_CAPGET = 183 - SYS_CAPSET = 184 - SYS_SIGALTSTACK = 185 - SYS_SENDFILE = 186 - SYS_GETPMSG = 187 - SYS_PUTPMSG = 188 - SYS_VFORK = 189 - SYS_UGETRLIMIT = 190 - SYS_READAHEAD = 191 - SYS_PCICONFIG_READ = 198 - SYS_PCICONFIG_WRITE = 199 - SYS_PCICONFIG_IOBASE = 200 - SYS_MULTIPLEXER = 201 - SYS_GETDENTS64 = 202 - SYS_PIVOT_ROOT = 203 - SYS_MADVISE = 205 - SYS_MINCORE = 206 - SYS_GETTID = 207 - SYS_TKILL = 208 - SYS_SETXATTR = 209 - SYS_LSETXATTR = 210 - SYS_FSETXATTR = 211 - SYS_GETXATTR = 212 - SYS_LGETXATTR = 213 - SYS_FGETXATTR = 214 - SYS_LISTXATTR = 215 - SYS_LLISTXATTR = 216 - SYS_FLISTXATTR = 217 - SYS_REMOVEXATTR = 218 - SYS_LREMOVEXATTR = 219 - SYS_FREMOVEXATTR = 220 - SYS_FUTEX = 221 - SYS_SCHED_SETAFFINITY = 222 - SYS_SCHED_GETAFFINITY = 223 - SYS_TUXCALL = 225 - SYS_IO_SETUP = 227 - SYS_IO_DESTROY = 228 - SYS_IO_GETEVENTS = 229 - SYS_IO_SUBMIT = 230 - SYS_IO_CANCEL = 231 - SYS_SET_TID_ADDRESS = 232 - SYS_FADVISE64 = 233 - SYS_EXIT_GROUP = 234 - SYS_LOOKUP_DCOOKIE = 235 - SYS_EPOLL_CREATE = 236 - SYS_EPOLL_CTL = 237 - SYS_EPOLL_WAIT = 238 - SYS_REMAP_FILE_PAGES = 239 - SYS_TIMER_CREATE = 240 - SYS_TIMER_SETTIME = 241 - SYS_TIMER_GETTIME = 242 - SYS_TIMER_GETOVERRUN = 243 - SYS_TIMER_DELETE = 244 - SYS_CLOCK_SETTIME = 245 - SYS_CLOCK_GETTIME = 246 - SYS_CLOCK_GETRES = 247 - SYS_CLOCK_NANOSLEEP = 248 - SYS_SWAPCONTEXT = 249 - SYS_TGKILL = 250 - SYS_UTIMES = 251 - SYS_STATFS64 = 252 - SYS_FSTATFS64 = 253 - SYS_RTAS = 255 - SYS_SYS_DEBUG_SETCONTEXT = 256 - SYS_MIGRATE_PAGES = 258 - SYS_MBIND = 259 - SYS_GET_MEMPOLICY = 260 - SYS_SET_MEMPOLICY = 261 - SYS_MQ_OPEN = 262 - SYS_MQ_UNLINK = 263 - SYS_MQ_TIMEDSEND = 264 - SYS_MQ_TIMEDRECEIVE = 265 - SYS_MQ_NOTIFY = 266 - SYS_MQ_GETSETATTR = 267 - SYS_KEXEC_LOAD = 268 - SYS_ADD_KEY = 269 - SYS_REQUEST_KEY = 270 - SYS_KEYCTL = 271 - SYS_WAITID = 272 - SYS_IOPRIO_SET = 273 - SYS_IOPRIO_GET = 274 - SYS_INOTIFY_INIT = 275 - SYS_INOTIFY_ADD_WATCH = 276 - SYS_INOTIFY_RM_WATCH = 277 - SYS_SPU_RUN = 278 - SYS_SPU_CREATE = 279 - SYS_PSELECT6 = 280 - SYS_PPOLL = 281 - SYS_UNSHARE = 282 - SYS_SPLICE = 283 - SYS_TEE = 284 - SYS_VMSPLICE = 285 - SYS_OPENAT = 286 - SYS_MKDIRAT = 287 - SYS_MKNODAT = 288 - SYS_FCHOWNAT = 289 - SYS_FUTIMESAT = 290 - SYS_NEWFSTATAT = 291 - SYS_UNLINKAT = 292 - SYS_RENAMEAT = 293 - SYS_LINKAT = 294 - SYS_SYMLINKAT = 295 - SYS_READLINKAT = 296 - SYS_FCHMODAT = 297 - SYS_FACCESSAT = 298 - SYS_GET_ROBUST_LIST = 299 - SYS_SET_ROBUST_LIST = 300 - SYS_MOVE_PAGES = 301 - SYS_GETCPU = 302 - SYS_EPOLL_PWAIT = 303 - SYS_UTIMENSAT = 304 - SYS_SIGNALFD = 305 - SYS_TIMERFD_CREATE = 306 - SYS_EVENTFD = 307 - SYS_SYNC_FILE_RANGE2 = 308 - SYS_FALLOCATE = 309 - SYS_SUBPAGE_PROT = 310 - SYS_TIMERFD_SETTIME = 311 - SYS_TIMERFD_GETTIME = 312 - SYS_SIGNALFD4 = 313 - SYS_EVENTFD2 = 314 - SYS_EPOLL_CREATE1 = 315 - SYS_DUP3 = 316 - SYS_PIPE2 = 317 - SYS_INOTIFY_INIT1 = 318 - SYS_PERF_EVENT_OPEN = 319 - SYS_PREADV = 320 - SYS_PWRITEV = 321 - SYS_RT_TGSIGQUEUEINFO = 322 - SYS_FANOTIFY_INIT = 323 - SYS_FANOTIFY_MARK = 324 - SYS_PRLIMIT64 = 325 - SYS_SOCKET = 326 - SYS_BIND = 327 - SYS_CONNECT = 328 - SYS_LISTEN = 329 - SYS_ACCEPT = 330 - SYS_GETSOCKNAME = 331 - SYS_GETPEERNAME = 332 - SYS_SOCKETPAIR = 333 - SYS_SEND = 334 - SYS_SENDTO = 335 - SYS_RECV = 336 - SYS_RECVFROM = 337 - SYS_SHUTDOWN = 338 - SYS_SETSOCKOPT = 339 - SYS_GETSOCKOPT = 340 - SYS_SENDMSG = 341 - SYS_RECVMSG = 342 - SYS_RECVMMSG = 343 - SYS_ACCEPT4 = 344 - SYS_NAME_TO_HANDLE_AT = 345 - SYS_OPEN_BY_HANDLE_AT = 346 - SYS_CLOCK_ADJTIME = 347 - SYS_SYNCFS = 348 - SYS_SENDMMSG = 349 - SYS_SETNS = 350 - SYS_PROCESS_VM_READV = 351 - SYS_PROCESS_VM_WRITEV = 352 - SYS_FINIT_MODULE = 353 - SYS_KCMP = 354 - SYS_SCHED_SETATTR = 355 - SYS_SCHED_GETATTR = 356 - SYS_RENAMEAT2 = 357 - SYS_SECCOMP = 358 - SYS_GETRANDOM = 359 - SYS_MEMFD_CREATE = 360 - SYS_BPF = 361 - SYS_EXECVEAT = 362 - SYS_SWITCH_ENDIAN = 363 - SYS_USERFAULTFD = 364 - SYS_MEMBARRIER = 365 - SYS_MLOCK2 = 378 - SYS_COPY_FILE_RANGE = 379 - SYS_PREADV2 = 380 - SYS_PWRITEV2 = 381 - SYS_KEXEC_FILE_LOAD = 382 - SYS_STATX = 383 - SYS_PKEY_ALLOC = 384 - SYS_PKEY_FREE = 385 - SYS_PKEY_MPROTECT = 386 - SYS_RSEQ = 387 - SYS_IO_PGETEVENTS = 388 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_CLOSE_RANGE = 436 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 - SYS_FACCESSAT2 = 439 - SYS_PROCESS_MADVISE = 440 - SYS_EPOLL_PWAIT2 = 441 - SYS_MOUNT_SETATTR = 442 + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAITPID = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECVE = 11 + SYS_CHDIR = 12 + SYS_TIME = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_BREAK = 17 + SYS_OLDSTAT = 18 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_MOUNT = 21 + SYS_UMOUNT = 22 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_STIME = 25 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_OLDFSTAT = 28 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_STTY = 31 + SYS_GTTY = 32 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_FTIME = 35 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_RENAME = 38 + SYS_MKDIR = 39 + SYS_RMDIR = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_PROF = 44 + SYS_BRK = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_SIGNAL = 48 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_UMOUNT2 = 52 + SYS_LOCK = 53 + SYS_IOCTL = 54 + SYS_FCNTL = 55 + SYS_MPX = 56 + SYS_SETPGID = 57 + SYS_ULIMIT = 58 + SYS_OLDOLDUNAME = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_USTAT = 62 + SYS_DUP2 = 63 + SYS_GETPPID = 64 + SYS_GETPGRP = 65 + SYS_SETSID = 66 + SYS_SIGACTION = 67 + SYS_SGETMASK = 68 + SYS_SSETMASK = 69 + SYS_SETREUID = 70 + SYS_SETREGID = 71 + SYS_SIGSUSPEND = 72 + SYS_SIGPENDING = 73 + SYS_SETHOSTNAME = 74 + SYS_SETRLIMIT = 75 + SYS_GETRLIMIT = 76 + SYS_GETRUSAGE = 77 + SYS_GETTIMEOFDAY = 78 + SYS_SETTIMEOFDAY = 79 + SYS_GETGROUPS = 80 + SYS_SETGROUPS = 81 + SYS_SELECT = 82 + SYS_SYMLINK = 83 + SYS_OLDLSTAT = 84 + SYS_READLINK = 85 + SYS_USELIB = 86 + SYS_SWAPON = 87 + SYS_REBOOT = 88 + SYS_READDIR = 89 + SYS_MMAP = 90 + SYS_MUNMAP = 91 + SYS_TRUNCATE = 92 + SYS_FTRUNCATE = 93 + SYS_FCHMOD = 94 + SYS_FCHOWN = 95 + SYS_GETPRIORITY = 96 + SYS_SETPRIORITY = 97 + SYS_PROFIL = 98 + SYS_STATFS = 99 + SYS_FSTATFS = 100 + SYS_IOPERM = 101 + SYS_SOCKETCALL = 102 + SYS_SYSLOG = 103 + SYS_SETITIMER = 104 + SYS_GETITIMER = 105 + SYS_STAT = 106 + SYS_LSTAT = 107 + SYS_FSTAT = 108 + SYS_OLDUNAME = 109 + SYS_IOPL = 110 + SYS_VHANGUP = 111 + SYS_IDLE = 112 + SYS_VM86 = 113 + SYS_WAIT4 = 114 + SYS_SWAPOFF = 115 + SYS_SYSINFO = 116 + SYS_IPC = 117 + SYS_FSYNC = 118 + SYS_SIGRETURN = 119 + SYS_CLONE = 120 + SYS_SETDOMAINNAME = 121 + SYS_UNAME = 122 + SYS_MODIFY_LDT = 123 + SYS_ADJTIMEX = 124 + SYS_MPROTECT = 125 + SYS_SIGPROCMASK = 126 + SYS_CREATE_MODULE = 127 + SYS_INIT_MODULE = 128 + SYS_DELETE_MODULE = 129 + SYS_GET_KERNEL_SYMS = 130 + SYS_QUOTACTL = 131 + SYS_GETPGID = 132 + SYS_FCHDIR = 133 + SYS_BDFLUSH = 134 + SYS_SYSFS = 135 + SYS_PERSONALITY = 136 + SYS_AFS_SYSCALL = 137 + SYS_SETFSUID = 138 + SYS_SETFSGID = 139 + SYS__LLSEEK = 140 + SYS_GETDENTS = 141 + SYS__NEWSELECT = 142 + SYS_FLOCK = 143 + SYS_MSYNC = 144 + SYS_READV = 145 + SYS_WRITEV = 146 + SYS_GETSID = 147 + SYS_FDATASYNC = 148 + SYS__SYSCTL = 149 + SYS_MLOCK = 150 + SYS_MUNLOCK = 151 + SYS_MLOCKALL = 152 + SYS_MUNLOCKALL = 153 + SYS_SCHED_SETPARAM = 154 + SYS_SCHED_GETPARAM = 155 + SYS_SCHED_SETSCHEDULER = 156 + SYS_SCHED_GETSCHEDULER = 157 + SYS_SCHED_YIELD = 158 + SYS_SCHED_GET_PRIORITY_MAX = 159 + SYS_SCHED_GET_PRIORITY_MIN = 160 + SYS_SCHED_RR_GET_INTERVAL = 161 + SYS_NANOSLEEP = 162 + SYS_MREMAP = 163 + SYS_SETRESUID = 164 + SYS_GETRESUID = 165 + SYS_QUERY_MODULE = 166 + SYS_POLL = 167 + SYS_NFSSERVCTL = 168 + SYS_SETRESGID = 169 + SYS_GETRESGID = 170 + SYS_PRCTL = 171 + SYS_RT_SIGRETURN = 172 + SYS_RT_SIGACTION = 173 + SYS_RT_SIGPROCMASK = 174 + SYS_RT_SIGPENDING = 175 + SYS_RT_SIGTIMEDWAIT = 176 + SYS_RT_SIGQUEUEINFO = 177 + SYS_RT_SIGSUSPEND = 178 + SYS_PREAD64 = 179 + SYS_PWRITE64 = 180 + SYS_CHOWN = 181 + SYS_GETCWD = 182 + SYS_CAPGET = 183 + SYS_CAPSET = 184 + SYS_SIGALTSTACK = 185 + SYS_SENDFILE = 186 + SYS_GETPMSG = 187 + SYS_PUTPMSG = 188 + SYS_VFORK = 189 + SYS_UGETRLIMIT = 190 + SYS_READAHEAD = 191 + SYS_PCICONFIG_READ = 198 + SYS_PCICONFIG_WRITE = 199 + SYS_PCICONFIG_IOBASE = 200 + SYS_MULTIPLEXER = 201 + SYS_GETDENTS64 = 202 + SYS_PIVOT_ROOT = 203 + SYS_MADVISE = 205 + SYS_MINCORE = 206 + SYS_GETTID = 207 + SYS_TKILL = 208 + SYS_SETXATTR = 209 + SYS_LSETXATTR = 210 + SYS_FSETXATTR = 211 + SYS_GETXATTR = 212 + SYS_LGETXATTR = 213 + SYS_FGETXATTR = 214 + SYS_LISTXATTR = 215 + SYS_LLISTXATTR = 216 + SYS_FLISTXATTR = 217 + SYS_REMOVEXATTR = 218 + SYS_LREMOVEXATTR = 219 + SYS_FREMOVEXATTR = 220 + SYS_FUTEX = 221 + SYS_SCHED_SETAFFINITY = 222 + SYS_SCHED_GETAFFINITY = 223 + SYS_TUXCALL = 225 + SYS_IO_SETUP = 227 + SYS_IO_DESTROY = 228 + SYS_IO_GETEVENTS = 229 + SYS_IO_SUBMIT = 230 + SYS_IO_CANCEL = 231 + SYS_SET_TID_ADDRESS = 232 + SYS_FADVISE64 = 233 + SYS_EXIT_GROUP = 234 + SYS_LOOKUP_DCOOKIE = 235 + SYS_EPOLL_CREATE = 236 + SYS_EPOLL_CTL = 237 + SYS_EPOLL_WAIT = 238 + SYS_REMAP_FILE_PAGES = 239 + SYS_TIMER_CREATE = 240 + SYS_TIMER_SETTIME = 241 + SYS_TIMER_GETTIME = 242 + SYS_TIMER_GETOVERRUN = 243 + SYS_TIMER_DELETE = 244 + SYS_CLOCK_SETTIME = 245 + SYS_CLOCK_GETTIME = 246 + SYS_CLOCK_GETRES = 247 + SYS_CLOCK_NANOSLEEP = 248 + SYS_SWAPCONTEXT = 249 + SYS_TGKILL = 250 + SYS_UTIMES = 251 + SYS_STATFS64 = 252 + SYS_FSTATFS64 = 253 + SYS_RTAS = 255 + SYS_SYS_DEBUG_SETCONTEXT = 256 + SYS_MIGRATE_PAGES = 258 + SYS_MBIND = 259 + SYS_GET_MEMPOLICY = 260 + SYS_SET_MEMPOLICY = 261 + SYS_MQ_OPEN = 262 + SYS_MQ_UNLINK = 263 + SYS_MQ_TIMEDSEND = 264 + SYS_MQ_TIMEDRECEIVE = 265 + SYS_MQ_NOTIFY = 266 + SYS_MQ_GETSETATTR = 267 + SYS_KEXEC_LOAD = 268 + SYS_ADD_KEY = 269 + SYS_REQUEST_KEY = 270 + SYS_KEYCTL = 271 + SYS_WAITID = 272 + SYS_IOPRIO_SET = 273 + SYS_IOPRIO_GET = 274 + SYS_INOTIFY_INIT = 275 + SYS_INOTIFY_ADD_WATCH = 276 + SYS_INOTIFY_RM_WATCH = 277 + SYS_SPU_RUN = 278 + SYS_SPU_CREATE = 279 + SYS_PSELECT6 = 280 + SYS_PPOLL = 281 + SYS_UNSHARE = 282 + SYS_SPLICE = 283 + SYS_TEE = 284 + SYS_VMSPLICE = 285 + SYS_OPENAT = 286 + SYS_MKDIRAT = 287 + SYS_MKNODAT = 288 + SYS_FCHOWNAT = 289 + SYS_FUTIMESAT = 290 + SYS_NEWFSTATAT = 291 + SYS_UNLINKAT = 292 + SYS_RENAMEAT = 293 + SYS_LINKAT = 294 + SYS_SYMLINKAT = 295 + SYS_READLINKAT = 296 + SYS_FCHMODAT = 297 + SYS_FACCESSAT = 298 + SYS_GET_ROBUST_LIST = 299 + SYS_SET_ROBUST_LIST = 300 + SYS_MOVE_PAGES = 301 + SYS_GETCPU = 302 + SYS_EPOLL_PWAIT = 303 + SYS_UTIMENSAT = 304 + SYS_SIGNALFD = 305 + SYS_TIMERFD_CREATE = 306 + SYS_EVENTFD = 307 + SYS_SYNC_FILE_RANGE2 = 308 + SYS_FALLOCATE = 309 + SYS_SUBPAGE_PROT = 310 + SYS_TIMERFD_SETTIME = 311 + SYS_TIMERFD_GETTIME = 312 + SYS_SIGNALFD4 = 313 + SYS_EVENTFD2 = 314 + SYS_EPOLL_CREATE1 = 315 + SYS_DUP3 = 316 + SYS_PIPE2 = 317 + SYS_INOTIFY_INIT1 = 318 + SYS_PERF_EVENT_OPEN = 319 + SYS_PREADV = 320 + SYS_PWRITEV = 321 + SYS_RT_TGSIGQUEUEINFO = 322 + SYS_FANOTIFY_INIT = 323 + SYS_FANOTIFY_MARK = 324 + SYS_PRLIMIT64 = 325 + SYS_SOCKET = 326 + SYS_BIND = 327 + SYS_CONNECT = 328 + SYS_LISTEN = 329 + SYS_ACCEPT = 330 + SYS_GETSOCKNAME = 331 + SYS_GETPEERNAME = 332 + SYS_SOCKETPAIR = 333 + SYS_SEND = 334 + SYS_SENDTO = 335 + SYS_RECV = 336 + SYS_RECVFROM = 337 + SYS_SHUTDOWN = 338 + SYS_SETSOCKOPT = 339 + SYS_GETSOCKOPT = 340 + SYS_SENDMSG = 341 + SYS_RECVMSG = 342 + SYS_RECVMMSG = 343 + SYS_ACCEPT4 = 344 + SYS_NAME_TO_HANDLE_AT = 345 + SYS_OPEN_BY_HANDLE_AT = 346 + SYS_CLOCK_ADJTIME = 347 + SYS_SYNCFS = 348 + SYS_SENDMMSG = 349 + SYS_SETNS = 350 + SYS_PROCESS_VM_READV = 351 + SYS_PROCESS_VM_WRITEV = 352 + SYS_FINIT_MODULE = 353 + SYS_KCMP = 354 + SYS_SCHED_SETATTR = 355 + SYS_SCHED_GETATTR = 356 + SYS_RENAMEAT2 = 357 + SYS_SECCOMP = 358 + SYS_GETRANDOM = 359 + SYS_MEMFD_CREATE = 360 + SYS_BPF = 361 + SYS_EXECVEAT = 362 + SYS_SWITCH_ENDIAN = 363 + SYS_USERFAULTFD = 364 + SYS_MEMBARRIER = 365 + SYS_MLOCK2 = 378 + SYS_COPY_FILE_RANGE = 379 + SYS_PREADV2 = 380 + SYS_PWRITEV2 = 381 + SYS_KEXEC_FILE_LOAD = 382 + SYS_STATX = 383 + SYS_PKEY_ALLOC = 384 + SYS_PKEY_FREE = 385 + SYS_PKEY_MPROTECT = 386 + SYS_RSEQ = 387 + SYS_IO_PGETEVENTS = 388 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index 33b33b083..bfc87ea44 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -7,400 +7,404 @@ package unix const ( - SYS_RESTART_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAITPID = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECVE = 11 - SYS_CHDIR = 12 - SYS_TIME = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LCHOWN = 16 - SYS_BREAK = 17 - SYS_OLDSTAT = 18 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_MOUNT = 21 - SYS_UMOUNT = 22 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_STIME = 25 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_OLDFSTAT = 28 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_STTY = 31 - SYS_GTTY = 32 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_FTIME = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_RENAME = 38 - SYS_MKDIR = 39 - SYS_RMDIR = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_PROF = 44 - SYS_BRK = 45 - SYS_SETGID = 46 - SYS_GETGID = 47 - SYS_SIGNAL = 48 - SYS_GETEUID = 49 - SYS_GETEGID = 50 - SYS_ACCT = 51 - SYS_UMOUNT2 = 52 - SYS_LOCK = 53 - SYS_IOCTL = 54 - SYS_FCNTL = 55 - SYS_MPX = 56 - SYS_SETPGID = 57 - SYS_ULIMIT = 58 - SYS_OLDOLDUNAME = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_USTAT = 62 - SYS_DUP2 = 63 - SYS_GETPPID = 64 - SYS_GETPGRP = 65 - SYS_SETSID = 66 - SYS_SIGACTION = 67 - SYS_SGETMASK = 68 - SYS_SSETMASK = 69 - SYS_SETREUID = 70 - SYS_SETREGID = 71 - SYS_SIGSUSPEND = 72 - SYS_SIGPENDING = 73 - SYS_SETHOSTNAME = 74 - SYS_SETRLIMIT = 75 - SYS_GETRLIMIT = 76 - SYS_GETRUSAGE = 77 - SYS_GETTIMEOFDAY = 78 - SYS_SETTIMEOFDAY = 79 - SYS_GETGROUPS = 80 - SYS_SETGROUPS = 81 - SYS_SELECT = 82 - SYS_SYMLINK = 83 - SYS_OLDLSTAT = 84 - SYS_READLINK = 85 - SYS_USELIB = 86 - SYS_SWAPON = 87 - SYS_REBOOT = 88 - SYS_READDIR = 89 - SYS_MMAP = 90 - SYS_MUNMAP = 91 - SYS_TRUNCATE = 92 - SYS_FTRUNCATE = 93 - SYS_FCHMOD = 94 - SYS_FCHOWN = 95 - SYS_GETPRIORITY = 96 - SYS_SETPRIORITY = 97 - SYS_PROFIL = 98 - SYS_STATFS = 99 - SYS_FSTATFS = 100 - SYS_IOPERM = 101 - SYS_SOCKETCALL = 102 - SYS_SYSLOG = 103 - SYS_SETITIMER = 104 - SYS_GETITIMER = 105 - SYS_STAT = 106 - SYS_LSTAT = 107 - SYS_FSTAT = 108 - SYS_OLDUNAME = 109 - SYS_IOPL = 110 - SYS_VHANGUP = 111 - SYS_IDLE = 112 - SYS_VM86 = 113 - SYS_WAIT4 = 114 - SYS_SWAPOFF = 115 - SYS_SYSINFO = 116 - SYS_IPC = 117 - SYS_FSYNC = 118 - SYS_SIGRETURN = 119 - SYS_CLONE = 120 - SYS_SETDOMAINNAME = 121 - SYS_UNAME = 122 - SYS_MODIFY_LDT = 123 - SYS_ADJTIMEX = 124 - SYS_MPROTECT = 125 - SYS_SIGPROCMASK = 126 - SYS_CREATE_MODULE = 127 - SYS_INIT_MODULE = 128 - SYS_DELETE_MODULE = 129 - SYS_GET_KERNEL_SYMS = 130 - SYS_QUOTACTL = 131 - SYS_GETPGID = 132 - SYS_FCHDIR = 133 - SYS_BDFLUSH = 134 - SYS_SYSFS = 135 - SYS_PERSONALITY = 136 - SYS_AFS_SYSCALL = 137 - SYS_SETFSUID = 138 - SYS_SETFSGID = 139 - SYS__LLSEEK = 140 - SYS_GETDENTS = 141 - SYS__NEWSELECT = 142 - SYS_FLOCK = 143 - SYS_MSYNC = 144 - SYS_READV = 145 - SYS_WRITEV = 146 - SYS_GETSID = 147 - SYS_FDATASYNC = 148 - SYS__SYSCTL = 149 - SYS_MLOCK = 150 - SYS_MUNLOCK = 151 - SYS_MLOCKALL = 152 - SYS_MUNLOCKALL = 153 - SYS_SCHED_SETPARAM = 154 - SYS_SCHED_GETPARAM = 155 - SYS_SCHED_SETSCHEDULER = 156 - SYS_SCHED_GETSCHEDULER = 157 - SYS_SCHED_YIELD = 158 - SYS_SCHED_GET_PRIORITY_MAX = 159 - SYS_SCHED_GET_PRIORITY_MIN = 160 - SYS_SCHED_RR_GET_INTERVAL = 161 - SYS_NANOSLEEP = 162 - SYS_MREMAP = 163 - SYS_SETRESUID = 164 - SYS_GETRESUID = 165 - SYS_QUERY_MODULE = 166 - SYS_POLL = 167 - SYS_NFSSERVCTL = 168 - SYS_SETRESGID = 169 - SYS_GETRESGID = 170 - SYS_PRCTL = 171 - SYS_RT_SIGRETURN = 172 - SYS_RT_SIGACTION = 173 - SYS_RT_SIGPROCMASK = 174 - SYS_RT_SIGPENDING = 175 - SYS_RT_SIGTIMEDWAIT = 176 - SYS_RT_SIGQUEUEINFO = 177 - SYS_RT_SIGSUSPEND = 178 - SYS_PREAD64 = 179 - SYS_PWRITE64 = 180 - SYS_CHOWN = 181 - SYS_GETCWD = 182 - SYS_CAPGET = 183 - SYS_CAPSET = 184 - SYS_SIGALTSTACK = 185 - SYS_SENDFILE = 186 - SYS_GETPMSG = 187 - SYS_PUTPMSG = 188 - SYS_VFORK = 189 - SYS_UGETRLIMIT = 190 - SYS_READAHEAD = 191 - SYS_PCICONFIG_READ = 198 - SYS_PCICONFIG_WRITE = 199 - SYS_PCICONFIG_IOBASE = 200 - SYS_MULTIPLEXER = 201 - SYS_GETDENTS64 = 202 - SYS_PIVOT_ROOT = 203 - SYS_MADVISE = 205 - SYS_MINCORE = 206 - SYS_GETTID = 207 - SYS_TKILL = 208 - SYS_SETXATTR = 209 - SYS_LSETXATTR = 210 - SYS_FSETXATTR = 211 - SYS_GETXATTR = 212 - SYS_LGETXATTR = 213 - SYS_FGETXATTR = 214 - SYS_LISTXATTR = 215 - SYS_LLISTXATTR = 216 - SYS_FLISTXATTR = 217 - SYS_REMOVEXATTR = 218 - SYS_LREMOVEXATTR = 219 - SYS_FREMOVEXATTR = 220 - SYS_FUTEX = 221 - SYS_SCHED_SETAFFINITY = 222 - SYS_SCHED_GETAFFINITY = 223 - SYS_TUXCALL = 225 - SYS_IO_SETUP = 227 - SYS_IO_DESTROY = 228 - SYS_IO_GETEVENTS = 229 - SYS_IO_SUBMIT = 230 - SYS_IO_CANCEL = 231 - SYS_SET_TID_ADDRESS = 232 - SYS_FADVISE64 = 233 - SYS_EXIT_GROUP = 234 - SYS_LOOKUP_DCOOKIE = 235 - SYS_EPOLL_CREATE = 236 - SYS_EPOLL_CTL = 237 - SYS_EPOLL_WAIT = 238 - SYS_REMAP_FILE_PAGES = 239 - SYS_TIMER_CREATE = 240 - SYS_TIMER_SETTIME = 241 - SYS_TIMER_GETTIME = 242 - SYS_TIMER_GETOVERRUN = 243 - SYS_TIMER_DELETE = 244 - SYS_CLOCK_SETTIME = 245 - SYS_CLOCK_GETTIME = 246 - SYS_CLOCK_GETRES = 247 - SYS_CLOCK_NANOSLEEP = 248 - SYS_SWAPCONTEXT = 249 - SYS_TGKILL = 250 - SYS_UTIMES = 251 - SYS_STATFS64 = 252 - SYS_FSTATFS64 = 253 - SYS_RTAS = 255 - SYS_SYS_DEBUG_SETCONTEXT = 256 - SYS_MIGRATE_PAGES = 258 - SYS_MBIND = 259 - SYS_GET_MEMPOLICY = 260 - SYS_SET_MEMPOLICY = 261 - SYS_MQ_OPEN = 262 - SYS_MQ_UNLINK = 263 - SYS_MQ_TIMEDSEND = 264 - SYS_MQ_TIMEDRECEIVE = 265 - SYS_MQ_NOTIFY = 266 - SYS_MQ_GETSETATTR = 267 - SYS_KEXEC_LOAD = 268 - SYS_ADD_KEY = 269 - SYS_REQUEST_KEY = 270 - SYS_KEYCTL = 271 - SYS_WAITID = 272 - SYS_IOPRIO_SET = 273 - SYS_IOPRIO_GET = 274 - SYS_INOTIFY_INIT = 275 - SYS_INOTIFY_ADD_WATCH = 276 - SYS_INOTIFY_RM_WATCH = 277 - SYS_SPU_RUN = 278 - SYS_SPU_CREATE = 279 - SYS_PSELECT6 = 280 - SYS_PPOLL = 281 - SYS_UNSHARE = 282 - SYS_SPLICE = 283 - SYS_TEE = 284 - SYS_VMSPLICE = 285 - SYS_OPENAT = 286 - SYS_MKDIRAT = 287 - SYS_MKNODAT = 288 - SYS_FCHOWNAT = 289 - SYS_FUTIMESAT = 290 - SYS_NEWFSTATAT = 291 - SYS_UNLINKAT = 292 - SYS_RENAMEAT = 293 - SYS_LINKAT = 294 - SYS_SYMLINKAT = 295 - SYS_READLINKAT = 296 - SYS_FCHMODAT = 297 - SYS_FACCESSAT = 298 - SYS_GET_ROBUST_LIST = 299 - SYS_SET_ROBUST_LIST = 300 - SYS_MOVE_PAGES = 301 - SYS_GETCPU = 302 - SYS_EPOLL_PWAIT = 303 - SYS_UTIMENSAT = 304 - SYS_SIGNALFD = 305 - SYS_TIMERFD_CREATE = 306 - SYS_EVENTFD = 307 - SYS_SYNC_FILE_RANGE2 = 308 - SYS_FALLOCATE = 309 - SYS_SUBPAGE_PROT = 310 - SYS_TIMERFD_SETTIME = 311 - SYS_TIMERFD_GETTIME = 312 - SYS_SIGNALFD4 = 313 - SYS_EVENTFD2 = 314 - SYS_EPOLL_CREATE1 = 315 - SYS_DUP3 = 316 - SYS_PIPE2 = 317 - SYS_INOTIFY_INIT1 = 318 - SYS_PERF_EVENT_OPEN = 319 - SYS_PREADV = 320 - SYS_PWRITEV = 321 - SYS_RT_TGSIGQUEUEINFO = 322 - SYS_FANOTIFY_INIT = 323 - SYS_FANOTIFY_MARK = 324 - SYS_PRLIMIT64 = 325 - SYS_SOCKET = 326 - SYS_BIND = 327 - SYS_CONNECT = 328 - SYS_LISTEN = 329 - SYS_ACCEPT = 330 - SYS_GETSOCKNAME = 331 - SYS_GETPEERNAME = 332 - SYS_SOCKETPAIR = 333 - SYS_SEND = 334 - SYS_SENDTO = 335 - SYS_RECV = 336 - SYS_RECVFROM = 337 - SYS_SHUTDOWN = 338 - SYS_SETSOCKOPT = 339 - SYS_GETSOCKOPT = 340 - SYS_SENDMSG = 341 - SYS_RECVMSG = 342 - SYS_RECVMMSG = 343 - SYS_ACCEPT4 = 344 - SYS_NAME_TO_HANDLE_AT = 345 - SYS_OPEN_BY_HANDLE_AT = 346 - SYS_CLOCK_ADJTIME = 347 - SYS_SYNCFS = 348 - SYS_SENDMMSG = 349 - SYS_SETNS = 350 - SYS_PROCESS_VM_READV = 351 - SYS_PROCESS_VM_WRITEV = 352 - SYS_FINIT_MODULE = 353 - SYS_KCMP = 354 - SYS_SCHED_SETATTR = 355 - SYS_SCHED_GETATTR = 356 - SYS_RENAMEAT2 = 357 - SYS_SECCOMP = 358 - SYS_GETRANDOM = 359 - SYS_MEMFD_CREATE = 360 - SYS_BPF = 361 - SYS_EXECVEAT = 362 - SYS_SWITCH_ENDIAN = 363 - SYS_USERFAULTFD = 364 - SYS_MEMBARRIER = 365 - SYS_MLOCK2 = 378 - SYS_COPY_FILE_RANGE = 379 - SYS_PREADV2 = 380 - SYS_PWRITEV2 = 381 - SYS_KEXEC_FILE_LOAD = 382 - SYS_STATX = 383 - SYS_PKEY_ALLOC = 384 - SYS_PKEY_FREE = 385 - SYS_PKEY_MPROTECT = 386 - SYS_RSEQ = 387 - SYS_IO_PGETEVENTS = 388 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_CLOSE_RANGE = 436 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 - SYS_FACCESSAT2 = 439 - SYS_PROCESS_MADVISE = 440 - SYS_EPOLL_PWAIT2 = 441 - SYS_MOUNT_SETATTR = 442 + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAITPID = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECVE = 11 + SYS_CHDIR = 12 + SYS_TIME = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_BREAK = 17 + SYS_OLDSTAT = 18 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_MOUNT = 21 + SYS_UMOUNT = 22 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_STIME = 25 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_OLDFSTAT = 28 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_STTY = 31 + SYS_GTTY = 32 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_FTIME = 35 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_RENAME = 38 + SYS_MKDIR = 39 + SYS_RMDIR = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_PROF = 44 + SYS_BRK = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_SIGNAL = 48 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_UMOUNT2 = 52 + SYS_LOCK = 53 + SYS_IOCTL = 54 + SYS_FCNTL = 55 + SYS_MPX = 56 + SYS_SETPGID = 57 + SYS_ULIMIT = 58 + SYS_OLDOLDUNAME = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_USTAT = 62 + SYS_DUP2 = 63 + SYS_GETPPID = 64 + SYS_GETPGRP = 65 + SYS_SETSID = 66 + SYS_SIGACTION = 67 + SYS_SGETMASK = 68 + SYS_SSETMASK = 69 + SYS_SETREUID = 70 + SYS_SETREGID = 71 + SYS_SIGSUSPEND = 72 + SYS_SIGPENDING = 73 + SYS_SETHOSTNAME = 74 + SYS_SETRLIMIT = 75 + SYS_GETRLIMIT = 76 + SYS_GETRUSAGE = 77 + SYS_GETTIMEOFDAY = 78 + SYS_SETTIMEOFDAY = 79 + SYS_GETGROUPS = 80 + SYS_SETGROUPS = 81 + SYS_SELECT = 82 + SYS_SYMLINK = 83 + SYS_OLDLSTAT = 84 + SYS_READLINK = 85 + SYS_USELIB = 86 + SYS_SWAPON = 87 + SYS_REBOOT = 88 + SYS_READDIR = 89 + SYS_MMAP = 90 + SYS_MUNMAP = 91 + SYS_TRUNCATE = 92 + SYS_FTRUNCATE = 93 + SYS_FCHMOD = 94 + SYS_FCHOWN = 95 + SYS_GETPRIORITY = 96 + SYS_SETPRIORITY = 97 + SYS_PROFIL = 98 + SYS_STATFS = 99 + SYS_FSTATFS = 100 + SYS_IOPERM = 101 + SYS_SOCKETCALL = 102 + SYS_SYSLOG = 103 + SYS_SETITIMER = 104 + SYS_GETITIMER = 105 + SYS_STAT = 106 + SYS_LSTAT = 107 + SYS_FSTAT = 108 + SYS_OLDUNAME = 109 + SYS_IOPL = 110 + SYS_VHANGUP = 111 + SYS_IDLE = 112 + SYS_VM86 = 113 + SYS_WAIT4 = 114 + SYS_SWAPOFF = 115 + SYS_SYSINFO = 116 + SYS_IPC = 117 + SYS_FSYNC = 118 + SYS_SIGRETURN = 119 + SYS_CLONE = 120 + SYS_SETDOMAINNAME = 121 + SYS_UNAME = 122 + SYS_MODIFY_LDT = 123 + SYS_ADJTIMEX = 124 + SYS_MPROTECT = 125 + SYS_SIGPROCMASK = 126 + SYS_CREATE_MODULE = 127 + SYS_INIT_MODULE = 128 + SYS_DELETE_MODULE = 129 + SYS_GET_KERNEL_SYMS = 130 + SYS_QUOTACTL = 131 + SYS_GETPGID = 132 + SYS_FCHDIR = 133 + SYS_BDFLUSH = 134 + SYS_SYSFS = 135 + SYS_PERSONALITY = 136 + SYS_AFS_SYSCALL = 137 + SYS_SETFSUID = 138 + SYS_SETFSGID = 139 + SYS__LLSEEK = 140 + SYS_GETDENTS = 141 + SYS__NEWSELECT = 142 + SYS_FLOCK = 143 + SYS_MSYNC = 144 + SYS_READV = 145 + SYS_WRITEV = 146 + SYS_GETSID = 147 + SYS_FDATASYNC = 148 + SYS__SYSCTL = 149 + SYS_MLOCK = 150 + SYS_MUNLOCK = 151 + SYS_MLOCKALL = 152 + SYS_MUNLOCKALL = 153 + SYS_SCHED_SETPARAM = 154 + SYS_SCHED_GETPARAM = 155 + SYS_SCHED_SETSCHEDULER = 156 + SYS_SCHED_GETSCHEDULER = 157 + SYS_SCHED_YIELD = 158 + SYS_SCHED_GET_PRIORITY_MAX = 159 + SYS_SCHED_GET_PRIORITY_MIN = 160 + SYS_SCHED_RR_GET_INTERVAL = 161 + SYS_NANOSLEEP = 162 + SYS_MREMAP = 163 + SYS_SETRESUID = 164 + SYS_GETRESUID = 165 + SYS_QUERY_MODULE = 166 + SYS_POLL = 167 + SYS_NFSSERVCTL = 168 + SYS_SETRESGID = 169 + SYS_GETRESGID = 170 + SYS_PRCTL = 171 + SYS_RT_SIGRETURN = 172 + SYS_RT_SIGACTION = 173 + SYS_RT_SIGPROCMASK = 174 + SYS_RT_SIGPENDING = 175 + SYS_RT_SIGTIMEDWAIT = 176 + SYS_RT_SIGQUEUEINFO = 177 + SYS_RT_SIGSUSPEND = 178 + SYS_PREAD64 = 179 + SYS_PWRITE64 = 180 + SYS_CHOWN = 181 + SYS_GETCWD = 182 + SYS_CAPGET = 183 + SYS_CAPSET = 184 + SYS_SIGALTSTACK = 185 + SYS_SENDFILE = 186 + SYS_GETPMSG = 187 + SYS_PUTPMSG = 188 + SYS_VFORK = 189 + SYS_UGETRLIMIT = 190 + SYS_READAHEAD = 191 + SYS_PCICONFIG_READ = 198 + SYS_PCICONFIG_WRITE = 199 + SYS_PCICONFIG_IOBASE = 200 + SYS_MULTIPLEXER = 201 + SYS_GETDENTS64 = 202 + SYS_PIVOT_ROOT = 203 + SYS_MADVISE = 205 + SYS_MINCORE = 206 + SYS_GETTID = 207 + SYS_TKILL = 208 + SYS_SETXATTR = 209 + SYS_LSETXATTR = 210 + SYS_FSETXATTR = 211 + SYS_GETXATTR = 212 + SYS_LGETXATTR = 213 + SYS_FGETXATTR = 214 + SYS_LISTXATTR = 215 + SYS_LLISTXATTR = 216 + SYS_FLISTXATTR = 217 + SYS_REMOVEXATTR = 218 + SYS_LREMOVEXATTR = 219 + SYS_FREMOVEXATTR = 220 + SYS_FUTEX = 221 + SYS_SCHED_SETAFFINITY = 222 + SYS_SCHED_GETAFFINITY = 223 + SYS_TUXCALL = 225 + SYS_IO_SETUP = 227 + SYS_IO_DESTROY = 228 + SYS_IO_GETEVENTS = 229 + SYS_IO_SUBMIT = 230 + SYS_IO_CANCEL = 231 + SYS_SET_TID_ADDRESS = 232 + SYS_FADVISE64 = 233 + SYS_EXIT_GROUP = 234 + SYS_LOOKUP_DCOOKIE = 235 + SYS_EPOLL_CREATE = 236 + SYS_EPOLL_CTL = 237 + SYS_EPOLL_WAIT = 238 + SYS_REMAP_FILE_PAGES = 239 + SYS_TIMER_CREATE = 240 + SYS_TIMER_SETTIME = 241 + SYS_TIMER_GETTIME = 242 + SYS_TIMER_GETOVERRUN = 243 + SYS_TIMER_DELETE = 244 + SYS_CLOCK_SETTIME = 245 + SYS_CLOCK_GETTIME = 246 + SYS_CLOCK_GETRES = 247 + SYS_CLOCK_NANOSLEEP = 248 + SYS_SWAPCONTEXT = 249 + SYS_TGKILL = 250 + SYS_UTIMES = 251 + SYS_STATFS64 = 252 + SYS_FSTATFS64 = 253 + SYS_RTAS = 255 + SYS_SYS_DEBUG_SETCONTEXT = 256 + SYS_MIGRATE_PAGES = 258 + SYS_MBIND = 259 + SYS_GET_MEMPOLICY = 260 + SYS_SET_MEMPOLICY = 261 + SYS_MQ_OPEN = 262 + SYS_MQ_UNLINK = 263 + SYS_MQ_TIMEDSEND = 264 + SYS_MQ_TIMEDRECEIVE = 265 + SYS_MQ_NOTIFY = 266 + SYS_MQ_GETSETATTR = 267 + SYS_KEXEC_LOAD = 268 + SYS_ADD_KEY = 269 + SYS_REQUEST_KEY = 270 + SYS_KEYCTL = 271 + SYS_WAITID = 272 + SYS_IOPRIO_SET = 273 + SYS_IOPRIO_GET = 274 + SYS_INOTIFY_INIT = 275 + SYS_INOTIFY_ADD_WATCH = 276 + SYS_INOTIFY_RM_WATCH = 277 + SYS_SPU_RUN = 278 + SYS_SPU_CREATE = 279 + SYS_PSELECT6 = 280 + SYS_PPOLL = 281 + SYS_UNSHARE = 282 + SYS_SPLICE = 283 + SYS_TEE = 284 + SYS_VMSPLICE = 285 + SYS_OPENAT = 286 + SYS_MKDIRAT = 287 + SYS_MKNODAT = 288 + SYS_FCHOWNAT = 289 + SYS_FUTIMESAT = 290 + SYS_NEWFSTATAT = 291 + SYS_UNLINKAT = 292 + SYS_RENAMEAT = 293 + SYS_LINKAT = 294 + SYS_SYMLINKAT = 295 + SYS_READLINKAT = 296 + SYS_FCHMODAT = 297 + SYS_FACCESSAT = 298 + SYS_GET_ROBUST_LIST = 299 + SYS_SET_ROBUST_LIST = 300 + SYS_MOVE_PAGES = 301 + SYS_GETCPU = 302 + SYS_EPOLL_PWAIT = 303 + SYS_UTIMENSAT = 304 + SYS_SIGNALFD = 305 + SYS_TIMERFD_CREATE = 306 + SYS_EVENTFD = 307 + SYS_SYNC_FILE_RANGE2 = 308 + SYS_FALLOCATE = 309 + SYS_SUBPAGE_PROT = 310 + SYS_TIMERFD_SETTIME = 311 + SYS_TIMERFD_GETTIME = 312 + SYS_SIGNALFD4 = 313 + SYS_EVENTFD2 = 314 + SYS_EPOLL_CREATE1 = 315 + SYS_DUP3 = 316 + SYS_PIPE2 = 317 + SYS_INOTIFY_INIT1 = 318 + SYS_PERF_EVENT_OPEN = 319 + SYS_PREADV = 320 + SYS_PWRITEV = 321 + SYS_RT_TGSIGQUEUEINFO = 322 + SYS_FANOTIFY_INIT = 323 + SYS_FANOTIFY_MARK = 324 + SYS_PRLIMIT64 = 325 + SYS_SOCKET = 326 + SYS_BIND = 327 + SYS_CONNECT = 328 + SYS_LISTEN = 329 + SYS_ACCEPT = 330 + SYS_GETSOCKNAME = 331 + SYS_GETPEERNAME = 332 + SYS_SOCKETPAIR = 333 + SYS_SEND = 334 + SYS_SENDTO = 335 + SYS_RECV = 336 + SYS_RECVFROM = 337 + SYS_SHUTDOWN = 338 + SYS_SETSOCKOPT = 339 + SYS_GETSOCKOPT = 340 + SYS_SENDMSG = 341 + SYS_RECVMSG = 342 + SYS_RECVMMSG = 343 + SYS_ACCEPT4 = 344 + SYS_NAME_TO_HANDLE_AT = 345 + SYS_OPEN_BY_HANDLE_AT = 346 + SYS_CLOCK_ADJTIME = 347 + SYS_SYNCFS = 348 + SYS_SENDMMSG = 349 + SYS_SETNS = 350 + SYS_PROCESS_VM_READV = 351 + SYS_PROCESS_VM_WRITEV = 352 + SYS_FINIT_MODULE = 353 + SYS_KCMP = 354 + SYS_SCHED_SETATTR = 355 + SYS_SCHED_GETATTR = 356 + SYS_RENAMEAT2 = 357 + SYS_SECCOMP = 358 + SYS_GETRANDOM = 359 + SYS_MEMFD_CREATE = 360 + SYS_BPF = 361 + SYS_EXECVEAT = 362 + SYS_SWITCH_ENDIAN = 363 + SYS_USERFAULTFD = 364 + SYS_MEMBARRIER = 365 + SYS_MLOCK2 = 378 + SYS_COPY_FILE_RANGE = 379 + SYS_PREADV2 = 380 + SYS_PWRITEV2 = 381 + SYS_KEXEC_FILE_LOAD = 382 + SYS_STATX = 383 + SYS_PKEY_ALLOC = 384 + SYS_PKEY_FREE = 385 + SYS_PKEY_MPROTECT = 386 + SYS_RSEQ = 387 + SYS_IO_PGETEVENTS = 388 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 66c8a8e09..a390e147d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -7,302 +7,306 @@ package unix const ( - SYS_IO_SETUP = 0 - SYS_IO_DESTROY = 1 - SYS_IO_SUBMIT = 2 - SYS_IO_CANCEL = 3 - SYS_IO_GETEVENTS = 4 - SYS_SETXATTR = 5 - SYS_LSETXATTR = 6 - SYS_FSETXATTR = 7 - SYS_GETXATTR = 8 - SYS_LGETXATTR = 9 - SYS_FGETXATTR = 10 - SYS_LISTXATTR = 11 - SYS_LLISTXATTR = 12 - SYS_FLISTXATTR = 13 - SYS_REMOVEXATTR = 14 - SYS_LREMOVEXATTR = 15 - SYS_FREMOVEXATTR = 16 - SYS_GETCWD = 17 - SYS_LOOKUP_DCOOKIE = 18 - SYS_EVENTFD2 = 19 - SYS_EPOLL_CREATE1 = 20 - SYS_EPOLL_CTL = 21 - SYS_EPOLL_PWAIT = 22 - SYS_DUP = 23 - SYS_DUP3 = 24 - SYS_FCNTL = 25 - SYS_INOTIFY_INIT1 = 26 - SYS_INOTIFY_ADD_WATCH = 27 - SYS_INOTIFY_RM_WATCH = 28 - SYS_IOCTL = 29 - SYS_IOPRIO_SET = 30 - SYS_IOPRIO_GET = 31 - SYS_FLOCK = 32 - SYS_MKNODAT = 33 - SYS_MKDIRAT = 34 - SYS_UNLINKAT = 35 - SYS_SYMLINKAT = 36 - SYS_LINKAT = 37 - SYS_UMOUNT2 = 39 - SYS_MOUNT = 40 - SYS_PIVOT_ROOT = 41 - SYS_NFSSERVCTL = 42 - SYS_STATFS = 43 - SYS_FSTATFS = 44 - SYS_TRUNCATE = 45 - SYS_FTRUNCATE = 46 - SYS_FALLOCATE = 47 - SYS_FACCESSAT = 48 - SYS_CHDIR = 49 - SYS_FCHDIR = 50 - SYS_CHROOT = 51 - SYS_FCHMOD = 52 - SYS_FCHMODAT = 53 - SYS_FCHOWNAT = 54 - SYS_FCHOWN = 55 - SYS_OPENAT = 56 - SYS_CLOSE = 57 - SYS_VHANGUP = 58 - SYS_PIPE2 = 59 - SYS_QUOTACTL = 60 - SYS_GETDENTS64 = 61 - SYS_LSEEK = 62 - SYS_READ = 63 - SYS_WRITE = 64 - SYS_READV = 65 - SYS_WRITEV = 66 - SYS_PREAD64 = 67 - SYS_PWRITE64 = 68 - SYS_PREADV = 69 - SYS_PWRITEV = 70 - SYS_SENDFILE = 71 - SYS_PSELECT6 = 72 - SYS_PPOLL = 73 - SYS_SIGNALFD4 = 74 - SYS_VMSPLICE = 75 - SYS_SPLICE = 76 - SYS_TEE = 77 - SYS_READLINKAT = 78 - SYS_FSTATAT = 79 - SYS_FSTAT = 80 - SYS_SYNC = 81 - SYS_FSYNC = 82 - SYS_FDATASYNC = 83 - SYS_SYNC_FILE_RANGE = 84 - SYS_TIMERFD_CREATE = 85 - SYS_TIMERFD_SETTIME = 86 - SYS_TIMERFD_GETTIME = 87 - SYS_UTIMENSAT = 88 - SYS_ACCT = 89 - SYS_CAPGET = 90 - SYS_CAPSET = 91 - SYS_PERSONALITY = 92 - SYS_EXIT = 93 - SYS_EXIT_GROUP = 94 - SYS_WAITID = 95 - SYS_SET_TID_ADDRESS = 96 - SYS_UNSHARE = 97 - SYS_FUTEX = 98 - SYS_SET_ROBUST_LIST = 99 - SYS_GET_ROBUST_LIST = 100 - SYS_NANOSLEEP = 101 - SYS_GETITIMER = 102 - SYS_SETITIMER = 103 - SYS_KEXEC_LOAD = 104 - SYS_INIT_MODULE = 105 - SYS_DELETE_MODULE = 106 - SYS_TIMER_CREATE = 107 - SYS_TIMER_GETTIME = 108 - SYS_TIMER_GETOVERRUN = 109 - SYS_TIMER_SETTIME = 110 - SYS_TIMER_DELETE = 111 - SYS_CLOCK_SETTIME = 112 - SYS_CLOCK_GETTIME = 113 - SYS_CLOCK_GETRES = 114 - SYS_CLOCK_NANOSLEEP = 115 - SYS_SYSLOG = 116 - SYS_PTRACE = 117 - SYS_SCHED_SETPARAM = 118 - SYS_SCHED_SETSCHEDULER = 119 - SYS_SCHED_GETSCHEDULER = 120 - SYS_SCHED_GETPARAM = 121 - SYS_SCHED_SETAFFINITY = 122 - SYS_SCHED_GETAFFINITY = 123 - SYS_SCHED_YIELD = 124 - SYS_SCHED_GET_PRIORITY_MAX = 125 - SYS_SCHED_GET_PRIORITY_MIN = 126 - SYS_SCHED_RR_GET_INTERVAL = 127 - SYS_RESTART_SYSCALL = 128 - SYS_KILL = 129 - SYS_TKILL = 130 - SYS_TGKILL = 131 - SYS_SIGALTSTACK = 132 - SYS_RT_SIGSUSPEND = 133 - SYS_RT_SIGACTION = 134 - SYS_RT_SIGPROCMASK = 135 - SYS_RT_SIGPENDING = 136 - SYS_RT_SIGTIMEDWAIT = 137 - SYS_RT_SIGQUEUEINFO = 138 - SYS_RT_SIGRETURN = 139 - SYS_SETPRIORITY = 140 - SYS_GETPRIORITY = 141 - SYS_REBOOT = 142 - SYS_SETREGID = 143 - SYS_SETGID = 144 - SYS_SETREUID = 145 - SYS_SETUID = 146 - SYS_SETRESUID = 147 - SYS_GETRESUID = 148 - SYS_SETRESGID = 149 - SYS_GETRESGID = 150 - SYS_SETFSUID = 151 - SYS_SETFSGID = 152 - SYS_TIMES = 153 - SYS_SETPGID = 154 - SYS_GETPGID = 155 - SYS_GETSID = 156 - SYS_SETSID = 157 - SYS_GETGROUPS = 158 - SYS_SETGROUPS = 159 - SYS_UNAME = 160 - SYS_SETHOSTNAME = 161 - SYS_SETDOMAINNAME = 162 - SYS_GETRLIMIT = 163 - SYS_SETRLIMIT = 164 - SYS_GETRUSAGE = 165 - SYS_UMASK = 166 - SYS_PRCTL = 167 - SYS_GETCPU = 168 - SYS_GETTIMEOFDAY = 169 - SYS_SETTIMEOFDAY = 170 - SYS_ADJTIMEX = 171 - SYS_GETPID = 172 - SYS_GETPPID = 173 - SYS_GETUID = 174 - SYS_GETEUID = 175 - SYS_GETGID = 176 - SYS_GETEGID = 177 - SYS_GETTID = 178 - SYS_SYSINFO = 179 - SYS_MQ_OPEN = 180 - SYS_MQ_UNLINK = 181 - SYS_MQ_TIMEDSEND = 182 - SYS_MQ_TIMEDRECEIVE = 183 - SYS_MQ_NOTIFY = 184 - SYS_MQ_GETSETATTR = 185 - SYS_MSGGET = 186 - SYS_MSGCTL = 187 - SYS_MSGRCV = 188 - SYS_MSGSND = 189 - SYS_SEMGET = 190 - SYS_SEMCTL = 191 - SYS_SEMTIMEDOP = 192 - SYS_SEMOP = 193 - SYS_SHMGET = 194 - SYS_SHMCTL = 195 - SYS_SHMAT = 196 - SYS_SHMDT = 197 - SYS_SOCKET = 198 - SYS_SOCKETPAIR = 199 - SYS_BIND = 200 - SYS_LISTEN = 201 - SYS_ACCEPT = 202 - SYS_CONNECT = 203 - SYS_GETSOCKNAME = 204 - SYS_GETPEERNAME = 205 - SYS_SENDTO = 206 - SYS_RECVFROM = 207 - SYS_SETSOCKOPT = 208 - SYS_GETSOCKOPT = 209 - SYS_SHUTDOWN = 210 - SYS_SENDMSG = 211 - SYS_RECVMSG = 212 - SYS_READAHEAD = 213 - SYS_BRK = 214 - SYS_MUNMAP = 215 - SYS_MREMAP = 216 - SYS_ADD_KEY = 217 - SYS_REQUEST_KEY = 218 - SYS_KEYCTL = 219 - SYS_CLONE = 220 - SYS_EXECVE = 221 - SYS_MMAP = 222 - SYS_FADVISE64 = 223 - SYS_SWAPON = 224 - SYS_SWAPOFF = 225 - SYS_MPROTECT = 226 - SYS_MSYNC = 227 - SYS_MLOCK = 228 - SYS_MUNLOCK = 229 - SYS_MLOCKALL = 230 - SYS_MUNLOCKALL = 231 - SYS_MINCORE = 232 - SYS_MADVISE = 233 - SYS_REMAP_FILE_PAGES = 234 - SYS_MBIND = 235 - SYS_GET_MEMPOLICY = 236 - SYS_SET_MEMPOLICY = 237 - SYS_MIGRATE_PAGES = 238 - SYS_MOVE_PAGES = 239 - SYS_RT_TGSIGQUEUEINFO = 240 - SYS_PERF_EVENT_OPEN = 241 - SYS_ACCEPT4 = 242 - SYS_RECVMMSG = 243 - SYS_ARCH_SPECIFIC_SYSCALL = 244 - SYS_WAIT4 = 260 - SYS_PRLIMIT64 = 261 - SYS_FANOTIFY_INIT = 262 - SYS_FANOTIFY_MARK = 263 - SYS_NAME_TO_HANDLE_AT = 264 - SYS_OPEN_BY_HANDLE_AT = 265 - SYS_CLOCK_ADJTIME = 266 - SYS_SYNCFS = 267 - SYS_SETNS = 268 - SYS_SENDMMSG = 269 - SYS_PROCESS_VM_READV = 270 - SYS_PROCESS_VM_WRITEV = 271 - SYS_KCMP = 272 - SYS_FINIT_MODULE = 273 - SYS_SCHED_SETATTR = 274 - SYS_SCHED_GETATTR = 275 - SYS_RENAMEAT2 = 276 - SYS_SECCOMP = 277 - SYS_GETRANDOM = 278 - SYS_MEMFD_CREATE = 279 - SYS_BPF = 280 - SYS_EXECVEAT = 281 - SYS_USERFAULTFD = 282 - SYS_MEMBARRIER = 283 - SYS_MLOCK2 = 284 - SYS_COPY_FILE_RANGE = 285 - SYS_PREADV2 = 286 - SYS_PWRITEV2 = 287 - SYS_PKEY_MPROTECT = 288 - SYS_PKEY_ALLOC = 289 - SYS_PKEY_FREE = 290 - SYS_STATX = 291 - SYS_IO_PGETEVENTS = 292 - SYS_RSEQ = 293 - SYS_KEXEC_FILE_LOAD = 294 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_CLOSE_RANGE = 436 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 - SYS_FACCESSAT2 = 439 - SYS_PROCESS_MADVISE = 440 - SYS_EPOLL_PWAIT2 = 441 - SYS_MOUNT_SETATTR = 442 + SYS_IO_SETUP = 0 + SYS_IO_DESTROY = 1 + SYS_IO_SUBMIT = 2 + SYS_IO_CANCEL = 3 + SYS_IO_GETEVENTS = 4 + SYS_SETXATTR = 5 + SYS_LSETXATTR = 6 + SYS_FSETXATTR = 7 + SYS_GETXATTR = 8 + SYS_LGETXATTR = 9 + SYS_FGETXATTR = 10 + SYS_LISTXATTR = 11 + SYS_LLISTXATTR = 12 + SYS_FLISTXATTR = 13 + SYS_REMOVEXATTR = 14 + SYS_LREMOVEXATTR = 15 + SYS_FREMOVEXATTR = 16 + SYS_GETCWD = 17 + SYS_LOOKUP_DCOOKIE = 18 + SYS_EVENTFD2 = 19 + SYS_EPOLL_CREATE1 = 20 + SYS_EPOLL_CTL = 21 + SYS_EPOLL_PWAIT = 22 + SYS_DUP = 23 + SYS_DUP3 = 24 + SYS_FCNTL = 25 + SYS_INOTIFY_INIT1 = 26 + SYS_INOTIFY_ADD_WATCH = 27 + SYS_INOTIFY_RM_WATCH = 28 + SYS_IOCTL = 29 + SYS_IOPRIO_SET = 30 + SYS_IOPRIO_GET = 31 + SYS_FLOCK = 32 + SYS_MKNODAT = 33 + SYS_MKDIRAT = 34 + SYS_UNLINKAT = 35 + SYS_SYMLINKAT = 36 + SYS_LINKAT = 37 + SYS_UMOUNT2 = 39 + SYS_MOUNT = 40 + SYS_PIVOT_ROOT = 41 + SYS_NFSSERVCTL = 42 + SYS_STATFS = 43 + SYS_FSTATFS = 44 + SYS_TRUNCATE = 45 + SYS_FTRUNCATE = 46 + SYS_FALLOCATE = 47 + SYS_FACCESSAT = 48 + SYS_CHDIR = 49 + SYS_FCHDIR = 50 + SYS_CHROOT = 51 + SYS_FCHMOD = 52 + SYS_FCHMODAT = 53 + SYS_FCHOWNAT = 54 + SYS_FCHOWN = 55 + SYS_OPENAT = 56 + SYS_CLOSE = 57 + SYS_VHANGUP = 58 + SYS_PIPE2 = 59 + SYS_QUOTACTL = 60 + SYS_GETDENTS64 = 61 + SYS_LSEEK = 62 + SYS_READ = 63 + SYS_WRITE = 64 + SYS_READV = 65 + SYS_WRITEV = 66 + SYS_PREAD64 = 67 + SYS_PWRITE64 = 68 + SYS_PREADV = 69 + SYS_PWRITEV = 70 + SYS_SENDFILE = 71 + SYS_PSELECT6 = 72 + SYS_PPOLL = 73 + SYS_SIGNALFD4 = 74 + SYS_VMSPLICE = 75 + SYS_SPLICE = 76 + SYS_TEE = 77 + SYS_READLINKAT = 78 + SYS_FSTATAT = 79 + SYS_FSTAT = 80 + SYS_SYNC = 81 + SYS_FSYNC = 82 + SYS_FDATASYNC = 83 + SYS_SYNC_FILE_RANGE = 84 + SYS_TIMERFD_CREATE = 85 + SYS_TIMERFD_SETTIME = 86 + SYS_TIMERFD_GETTIME = 87 + SYS_UTIMENSAT = 88 + SYS_ACCT = 89 + SYS_CAPGET = 90 + SYS_CAPSET = 91 + SYS_PERSONALITY = 92 + SYS_EXIT = 93 + SYS_EXIT_GROUP = 94 + SYS_WAITID = 95 + SYS_SET_TID_ADDRESS = 96 + SYS_UNSHARE = 97 + SYS_FUTEX = 98 + SYS_SET_ROBUST_LIST = 99 + SYS_GET_ROBUST_LIST = 100 + SYS_NANOSLEEP = 101 + SYS_GETITIMER = 102 + SYS_SETITIMER = 103 + SYS_KEXEC_LOAD = 104 + SYS_INIT_MODULE = 105 + SYS_DELETE_MODULE = 106 + SYS_TIMER_CREATE = 107 + SYS_TIMER_GETTIME = 108 + SYS_TIMER_GETOVERRUN = 109 + SYS_TIMER_SETTIME = 110 + SYS_TIMER_DELETE = 111 + SYS_CLOCK_SETTIME = 112 + SYS_CLOCK_GETTIME = 113 + SYS_CLOCK_GETRES = 114 + SYS_CLOCK_NANOSLEEP = 115 + SYS_SYSLOG = 116 + SYS_PTRACE = 117 + SYS_SCHED_SETPARAM = 118 + SYS_SCHED_SETSCHEDULER = 119 + SYS_SCHED_GETSCHEDULER = 120 + SYS_SCHED_GETPARAM = 121 + SYS_SCHED_SETAFFINITY = 122 + SYS_SCHED_GETAFFINITY = 123 + SYS_SCHED_YIELD = 124 + SYS_SCHED_GET_PRIORITY_MAX = 125 + SYS_SCHED_GET_PRIORITY_MIN = 126 + SYS_SCHED_RR_GET_INTERVAL = 127 + SYS_RESTART_SYSCALL = 128 + SYS_KILL = 129 + SYS_TKILL = 130 + SYS_TGKILL = 131 + SYS_SIGALTSTACK = 132 + SYS_RT_SIGSUSPEND = 133 + SYS_RT_SIGACTION = 134 + SYS_RT_SIGPROCMASK = 135 + SYS_RT_SIGPENDING = 136 + SYS_RT_SIGTIMEDWAIT = 137 + SYS_RT_SIGQUEUEINFO = 138 + SYS_RT_SIGRETURN = 139 + SYS_SETPRIORITY = 140 + SYS_GETPRIORITY = 141 + SYS_REBOOT = 142 + SYS_SETREGID = 143 + SYS_SETGID = 144 + SYS_SETREUID = 145 + SYS_SETUID = 146 + SYS_SETRESUID = 147 + SYS_GETRESUID = 148 + SYS_SETRESGID = 149 + SYS_GETRESGID = 150 + SYS_SETFSUID = 151 + SYS_SETFSGID = 152 + SYS_TIMES = 153 + SYS_SETPGID = 154 + SYS_GETPGID = 155 + SYS_GETSID = 156 + SYS_SETSID = 157 + SYS_GETGROUPS = 158 + SYS_SETGROUPS = 159 + SYS_UNAME = 160 + SYS_SETHOSTNAME = 161 + SYS_SETDOMAINNAME = 162 + SYS_GETRLIMIT = 163 + SYS_SETRLIMIT = 164 + SYS_GETRUSAGE = 165 + SYS_UMASK = 166 + SYS_PRCTL = 167 + SYS_GETCPU = 168 + SYS_GETTIMEOFDAY = 169 + SYS_SETTIMEOFDAY = 170 + SYS_ADJTIMEX = 171 + SYS_GETPID = 172 + SYS_GETPPID = 173 + SYS_GETUID = 174 + SYS_GETEUID = 175 + SYS_GETGID = 176 + SYS_GETEGID = 177 + SYS_GETTID = 178 + SYS_SYSINFO = 179 + SYS_MQ_OPEN = 180 + SYS_MQ_UNLINK = 181 + SYS_MQ_TIMEDSEND = 182 + SYS_MQ_TIMEDRECEIVE = 183 + SYS_MQ_NOTIFY = 184 + SYS_MQ_GETSETATTR = 185 + SYS_MSGGET = 186 + SYS_MSGCTL = 187 + SYS_MSGRCV = 188 + SYS_MSGSND = 189 + SYS_SEMGET = 190 + SYS_SEMCTL = 191 + SYS_SEMTIMEDOP = 192 + SYS_SEMOP = 193 + SYS_SHMGET = 194 + SYS_SHMCTL = 195 + SYS_SHMAT = 196 + SYS_SHMDT = 197 + SYS_SOCKET = 198 + SYS_SOCKETPAIR = 199 + SYS_BIND = 200 + SYS_LISTEN = 201 + SYS_ACCEPT = 202 + SYS_CONNECT = 203 + SYS_GETSOCKNAME = 204 + SYS_GETPEERNAME = 205 + SYS_SENDTO = 206 + SYS_RECVFROM = 207 + SYS_SETSOCKOPT = 208 + SYS_GETSOCKOPT = 209 + SYS_SHUTDOWN = 210 + SYS_SENDMSG = 211 + SYS_RECVMSG = 212 + SYS_READAHEAD = 213 + SYS_BRK = 214 + SYS_MUNMAP = 215 + SYS_MREMAP = 216 + SYS_ADD_KEY = 217 + SYS_REQUEST_KEY = 218 + SYS_KEYCTL = 219 + SYS_CLONE = 220 + SYS_EXECVE = 221 + SYS_MMAP = 222 + SYS_FADVISE64 = 223 + SYS_SWAPON = 224 + SYS_SWAPOFF = 225 + SYS_MPROTECT = 226 + SYS_MSYNC = 227 + SYS_MLOCK = 228 + SYS_MUNLOCK = 229 + SYS_MLOCKALL = 230 + SYS_MUNLOCKALL = 231 + SYS_MINCORE = 232 + SYS_MADVISE = 233 + SYS_REMAP_FILE_PAGES = 234 + SYS_MBIND = 235 + SYS_GET_MEMPOLICY = 236 + SYS_SET_MEMPOLICY = 237 + SYS_MIGRATE_PAGES = 238 + SYS_MOVE_PAGES = 239 + SYS_RT_TGSIGQUEUEINFO = 240 + SYS_PERF_EVENT_OPEN = 241 + SYS_ACCEPT4 = 242 + SYS_RECVMMSG = 243 + SYS_ARCH_SPECIFIC_SYSCALL = 244 + SYS_WAIT4 = 260 + SYS_PRLIMIT64 = 261 + SYS_FANOTIFY_INIT = 262 + SYS_FANOTIFY_MARK = 263 + SYS_NAME_TO_HANDLE_AT = 264 + SYS_OPEN_BY_HANDLE_AT = 265 + SYS_CLOCK_ADJTIME = 266 + SYS_SYNCFS = 267 + SYS_SETNS = 268 + SYS_SENDMMSG = 269 + SYS_PROCESS_VM_READV = 270 + SYS_PROCESS_VM_WRITEV = 271 + SYS_KCMP = 272 + SYS_FINIT_MODULE = 273 + SYS_SCHED_SETATTR = 274 + SYS_SCHED_GETATTR = 275 + SYS_RENAMEAT2 = 276 + SYS_SECCOMP = 277 + SYS_GETRANDOM = 278 + SYS_MEMFD_CREATE = 279 + SYS_BPF = 280 + SYS_EXECVEAT = 281 + SYS_USERFAULTFD = 282 + SYS_MEMBARRIER = 283 + SYS_MLOCK2 = 284 + SYS_COPY_FILE_RANGE = 285 + SYS_PREADV2 = 286 + SYS_PWRITEV2 = 287 + SYS_PKEY_MPROTECT = 288 + SYS_PKEY_ALLOC = 289 + SYS_PKEY_FREE = 290 + SYS_STATX = 291 + SYS_IO_PGETEVENTS = 292 + SYS_RSEQ = 293 + SYS_KEXEC_FILE_LOAD = 294 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index aea5760ce..3e791e6cd 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -7,365 +7,369 @@ package unix const ( - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_RESTART_SYSCALL = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECVE = 11 - SYS_CHDIR = 12 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_MOUNT = 21 - SYS_UMOUNT = 22 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_RENAME = 38 - SYS_MKDIR = 39 - SYS_RMDIR = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_BRK = 45 - SYS_SIGNAL = 48 - SYS_ACCT = 51 - SYS_UMOUNT2 = 52 - SYS_IOCTL = 54 - SYS_FCNTL = 55 - SYS_SETPGID = 57 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_USTAT = 62 - SYS_DUP2 = 63 - SYS_GETPPID = 64 - SYS_GETPGRP = 65 - SYS_SETSID = 66 - SYS_SIGACTION = 67 - SYS_SIGSUSPEND = 72 - SYS_SIGPENDING = 73 - SYS_SETHOSTNAME = 74 - SYS_SETRLIMIT = 75 - SYS_GETRUSAGE = 77 - SYS_GETTIMEOFDAY = 78 - SYS_SETTIMEOFDAY = 79 - SYS_SYMLINK = 83 - SYS_READLINK = 85 - SYS_USELIB = 86 - SYS_SWAPON = 87 - SYS_REBOOT = 88 - SYS_READDIR = 89 - SYS_MMAP = 90 - SYS_MUNMAP = 91 - SYS_TRUNCATE = 92 - SYS_FTRUNCATE = 93 - SYS_FCHMOD = 94 - SYS_GETPRIORITY = 96 - SYS_SETPRIORITY = 97 - SYS_STATFS = 99 - SYS_FSTATFS = 100 - SYS_SOCKETCALL = 102 - SYS_SYSLOG = 103 - SYS_SETITIMER = 104 - SYS_GETITIMER = 105 - SYS_STAT = 106 - SYS_LSTAT = 107 - SYS_FSTAT = 108 - SYS_LOOKUP_DCOOKIE = 110 - SYS_VHANGUP = 111 - SYS_IDLE = 112 - SYS_WAIT4 = 114 - SYS_SWAPOFF = 115 - SYS_SYSINFO = 116 - SYS_IPC = 117 - SYS_FSYNC = 118 - SYS_SIGRETURN = 119 - SYS_CLONE = 120 - SYS_SETDOMAINNAME = 121 - SYS_UNAME = 122 - SYS_ADJTIMEX = 124 - SYS_MPROTECT = 125 - SYS_SIGPROCMASK = 126 - SYS_CREATE_MODULE = 127 - SYS_INIT_MODULE = 128 - SYS_DELETE_MODULE = 129 - SYS_GET_KERNEL_SYMS = 130 - SYS_QUOTACTL = 131 - SYS_GETPGID = 132 - SYS_FCHDIR = 133 - SYS_BDFLUSH = 134 - SYS_SYSFS = 135 - SYS_PERSONALITY = 136 - SYS_AFS_SYSCALL = 137 - SYS_GETDENTS = 141 - SYS_SELECT = 142 - SYS_FLOCK = 143 - SYS_MSYNC = 144 - SYS_READV = 145 - SYS_WRITEV = 146 - SYS_GETSID = 147 - SYS_FDATASYNC = 148 - SYS__SYSCTL = 149 - SYS_MLOCK = 150 - SYS_MUNLOCK = 151 - SYS_MLOCKALL = 152 - SYS_MUNLOCKALL = 153 - SYS_SCHED_SETPARAM = 154 - SYS_SCHED_GETPARAM = 155 - SYS_SCHED_SETSCHEDULER = 156 - SYS_SCHED_GETSCHEDULER = 157 - SYS_SCHED_YIELD = 158 - SYS_SCHED_GET_PRIORITY_MAX = 159 - SYS_SCHED_GET_PRIORITY_MIN = 160 - SYS_SCHED_RR_GET_INTERVAL = 161 - SYS_NANOSLEEP = 162 - SYS_MREMAP = 163 - SYS_QUERY_MODULE = 167 - SYS_POLL = 168 - SYS_NFSSERVCTL = 169 - SYS_PRCTL = 172 - SYS_RT_SIGRETURN = 173 - SYS_RT_SIGACTION = 174 - SYS_RT_SIGPROCMASK = 175 - SYS_RT_SIGPENDING = 176 - SYS_RT_SIGTIMEDWAIT = 177 - SYS_RT_SIGQUEUEINFO = 178 - SYS_RT_SIGSUSPEND = 179 - SYS_PREAD64 = 180 - SYS_PWRITE64 = 181 - SYS_GETCWD = 183 - SYS_CAPGET = 184 - SYS_CAPSET = 185 - SYS_SIGALTSTACK = 186 - SYS_SENDFILE = 187 - SYS_GETPMSG = 188 - SYS_PUTPMSG = 189 - SYS_VFORK = 190 - SYS_GETRLIMIT = 191 - SYS_LCHOWN = 198 - SYS_GETUID = 199 - SYS_GETGID = 200 - SYS_GETEUID = 201 - SYS_GETEGID = 202 - SYS_SETREUID = 203 - SYS_SETREGID = 204 - SYS_GETGROUPS = 205 - SYS_SETGROUPS = 206 - SYS_FCHOWN = 207 - SYS_SETRESUID = 208 - SYS_GETRESUID = 209 - SYS_SETRESGID = 210 - SYS_GETRESGID = 211 - SYS_CHOWN = 212 - SYS_SETUID = 213 - SYS_SETGID = 214 - SYS_SETFSUID = 215 - SYS_SETFSGID = 216 - SYS_PIVOT_ROOT = 217 - SYS_MINCORE = 218 - SYS_MADVISE = 219 - SYS_GETDENTS64 = 220 - SYS_READAHEAD = 222 - SYS_SETXATTR = 224 - SYS_LSETXATTR = 225 - SYS_FSETXATTR = 226 - SYS_GETXATTR = 227 - SYS_LGETXATTR = 228 - SYS_FGETXATTR = 229 - SYS_LISTXATTR = 230 - SYS_LLISTXATTR = 231 - SYS_FLISTXATTR = 232 - SYS_REMOVEXATTR = 233 - SYS_LREMOVEXATTR = 234 - SYS_FREMOVEXATTR = 235 - SYS_GETTID = 236 - SYS_TKILL = 237 - SYS_FUTEX = 238 - SYS_SCHED_SETAFFINITY = 239 - SYS_SCHED_GETAFFINITY = 240 - SYS_TGKILL = 241 - SYS_IO_SETUP = 243 - SYS_IO_DESTROY = 244 - SYS_IO_GETEVENTS = 245 - SYS_IO_SUBMIT = 246 - SYS_IO_CANCEL = 247 - SYS_EXIT_GROUP = 248 - SYS_EPOLL_CREATE = 249 - SYS_EPOLL_CTL = 250 - SYS_EPOLL_WAIT = 251 - SYS_SET_TID_ADDRESS = 252 - SYS_FADVISE64 = 253 - SYS_TIMER_CREATE = 254 - SYS_TIMER_SETTIME = 255 - SYS_TIMER_GETTIME = 256 - SYS_TIMER_GETOVERRUN = 257 - SYS_TIMER_DELETE = 258 - SYS_CLOCK_SETTIME = 259 - SYS_CLOCK_GETTIME = 260 - SYS_CLOCK_GETRES = 261 - SYS_CLOCK_NANOSLEEP = 262 - SYS_STATFS64 = 265 - SYS_FSTATFS64 = 266 - SYS_REMAP_FILE_PAGES = 267 - SYS_MBIND = 268 - SYS_GET_MEMPOLICY = 269 - SYS_SET_MEMPOLICY = 270 - SYS_MQ_OPEN = 271 - SYS_MQ_UNLINK = 272 - SYS_MQ_TIMEDSEND = 273 - SYS_MQ_TIMEDRECEIVE = 274 - SYS_MQ_NOTIFY = 275 - SYS_MQ_GETSETATTR = 276 - SYS_KEXEC_LOAD = 277 - SYS_ADD_KEY = 278 - SYS_REQUEST_KEY = 279 - SYS_KEYCTL = 280 - SYS_WAITID = 281 - SYS_IOPRIO_SET = 282 - SYS_IOPRIO_GET = 283 - SYS_INOTIFY_INIT = 284 - SYS_INOTIFY_ADD_WATCH = 285 - SYS_INOTIFY_RM_WATCH = 286 - SYS_MIGRATE_PAGES = 287 - SYS_OPENAT = 288 - SYS_MKDIRAT = 289 - SYS_MKNODAT = 290 - SYS_FCHOWNAT = 291 - SYS_FUTIMESAT = 292 - SYS_NEWFSTATAT = 293 - SYS_UNLINKAT = 294 - SYS_RENAMEAT = 295 - SYS_LINKAT = 296 - SYS_SYMLINKAT = 297 - SYS_READLINKAT = 298 - SYS_FCHMODAT = 299 - SYS_FACCESSAT = 300 - SYS_PSELECT6 = 301 - SYS_PPOLL = 302 - SYS_UNSHARE = 303 - SYS_SET_ROBUST_LIST = 304 - SYS_GET_ROBUST_LIST = 305 - SYS_SPLICE = 306 - SYS_SYNC_FILE_RANGE = 307 - SYS_TEE = 308 - SYS_VMSPLICE = 309 - SYS_MOVE_PAGES = 310 - SYS_GETCPU = 311 - SYS_EPOLL_PWAIT = 312 - SYS_UTIMES = 313 - SYS_FALLOCATE = 314 - SYS_UTIMENSAT = 315 - SYS_SIGNALFD = 316 - SYS_TIMERFD = 317 - SYS_EVENTFD = 318 - SYS_TIMERFD_CREATE = 319 - SYS_TIMERFD_SETTIME = 320 - SYS_TIMERFD_GETTIME = 321 - SYS_SIGNALFD4 = 322 - SYS_EVENTFD2 = 323 - SYS_INOTIFY_INIT1 = 324 - SYS_PIPE2 = 325 - SYS_DUP3 = 326 - SYS_EPOLL_CREATE1 = 327 - SYS_PREADV = 328 - SYS_PWRITEV = 329 - SYS_RT_TGSIGQUEUEINFO = 330 - SYS_PERF_EVENT_OPEN = 331 - SYS_FANOTIFY_INIT = 332 - SYS_FANOTIFY_MARK = 333 - SYS_PRLIMIT64 = 334 - SYS_NAME_TO_HANDLE_AT = 335 - SYS_OPEN_BY_HANDLE_AT = 336 - SYS_CLOCK_ADJTIME = 337 - SYS_SYNCFS = 338 - SYS_SETNS = 339 - SYS_PROCESS_VM_READV = 340 - SYS_PROCESS_VM_WRITEV = 341 - SYS_S390_RUNTIME_INSTR = 342 - SYS_KCMP = 343 - SYS_FINIT_MODULE = 344 - SYS_SCHED_SETATTR = 345 - SYS_SCHED_GETATTR = 346 - SYS_RENAMEAT2 = 347 - SYS_SECCOMP = 348 - SYS_GETRANDOM = 349 - SYS_MEMFD_CREATE = 350 - SYS_BPF = 351 - SYS_S390_PCI_MMIO_WRITE = 352 - SYS_S390_PCI_MMIO_READ = 353 - SYS_EXECVEAT = 354 - SYS_USERFAULTFD = 355 - SYS_MEMBARRIER = 356 - SYS_RECVMMSG = 357 - SYS_SENDMMSG = 358 - SYS_SOCKET = 359 - SYS_SOCKETPAIR = 360 - SYS_BIND = 361 - SYS_CONNECT = 362 - SYS_LISTEN = 363 - SYS_ACCEPT4 = 364 - SYS_GETSOCKOPT = 365 - SYS_SETSOCKOPT = 366 - SYS_GETSOCKNAME = 367 - SYS_GETPEERNAME = 368 - SYS_SENDTO = 369 - SYS_SENDMSG = 370 - SYS_RECVFROM = 371 - SYS_RECVMSG = 372 - SYS_SHUTDOWN = 373 - SYS_MLOCK2 = 374 - SYS_COPY_FILE_RANGE = 375 - SYS_PREADV2 = 376 - SYS_PWRITEV2 = 377 - SYS_S390_GUARDED_STORAGE = 378 - SYS_STATX = 379 - SYS_S390_STHYI = 380 - SYS_KEXEC_FILE_LOAD = 381 - SYS_IO_PGETEVENTS = 382 - SYS_RSEQ = 383 - SYS_PKEY_MPROTECT = 384 - SYS_PKEY_ALLOC = 385 - SYS_PKEY_FREE = 386 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_CLOSE_RANGE = 436 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 - SYS_FACCESSAT2 = 439 - SYS_PROCESS_MADVISE = 440 - SYS_EPOLL_PWAIT2 = 441 - SYS_MOUNT_SETATTR = 442 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_RESTART_SYSCALL = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECVE = 11 + SYS_CHDIR = 12 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_MOUNT = 21 + SYS_UMOUNT = 22 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_RENAME = 38 + SYS_MKDIR = 39 + SYS_RMDIR = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_BRK = 45 + SYS_SIGNAL = 48 + SYS_ACCT = 51 + SYS_UMOUNT2 = 52 + SYS_IOCTL = 54 + SYS_FCNTL = 55 + SYS_SETPGID = 57 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_USTAT = 62 + SYS_DUP2 = 63 + SYS_GETPPID = 64 + SYS_GETPGRP = 65 + SYS_SETSID = 66 + SYS_SIGACTION = 67 + SYS_SIGSUSPEND = 72 + SYS_SIGPENDING = 73 + SYS_SETHOSTNAME = 74 + SYS_SETRLIMIT = 75 + SYS_GETRUSAGE = 77 + SYS_GETTIMEOFDAY = 78 + SYS_SETTIMEOFDAY = 79 + SYS_SYMLINK = 83 + SYS_READLINK = 85 + SYS_USELIB = 86 + SYS_SWAPON = 87 + SYS_REBOOT = 88 + SYS_READDIR = 89 + SYS_MMAP = 90 + SYS_MUNMAP = 91 + SYS_TRUNCATE = 92 + SYS_FTRUNCATE = 93 + SYS_FCHMOD = 94 + SYS_GETPRIORITY = 96 + SYS_SETPRIORITY = 97 + SYS_STATFS = 99 + SYS_FSTATFS = 100 + SYS_SOCKETCALL = 102 + SYS_SYSLOG = 103 + SYS_SETITIMER = 104 + SYS_GETITIMER = 105 + SYS_STAT = 106 + SYS_LSTAT = 107 + SYS_FSTAT = 108 + SYS_LOOKUP_DCOOKIE = 110 + SYS_VHANGUP = 111 + SYS_IDLE = 112 + SYS_WAIT4 = 114 + SYS_SWAPOFF = 115 + SYS_SYSINFO = 116 + SYS_IPC = 117 + SYS_FSYNC = 118 + SYS_SIGRETURN = 119 + SYS_CLONE = 120 + SYS_SETDOMAINNAME = 121 + SYS_UNAME = 122 + SYS_ADJTIMEX = 124 + SYS_MPROTECT = 125 + SYS_SIGPROCMASK = 126 + SYS_CREATE_MODULE = 127 + SYS_INIT_MODULE = 128 + SYS_DELETE_MODULE = 129 + SYS_GET_KERNEL_SYMS = 130 + SYS_QUOTACTL = 131 + SYS_GETPGID = 132 + SYS_FCHDIR = 133 + SYS_BDFLUSH = 134 + SYS_SYSFS = 135 + SYS_PERSONALITY = 136 + SYS_AFS_SYSCALL = 137 + SYS_GETDENTS = 141 + SYS_SELECT = 142 + SYS_FLOCK = 143 + SYS_MSYNC = 144 + SYS_READV = 145 + SYS_WRITEV = 146 + SYS_GETSID = 147 + SYS_FDATASYNC = 148 + SYS__SYSCTL = 149 + SYS_MLOCK = 150 + SYS_MUNLOCK = 151 + SYS_MLOCKALL = 152 + SYS_MUNLOCKALL = 153 + SYS_SCHED_SETPARAM = 154 + SYS_SCHED_GETPARAM = 155 + SYS_SCHED_SETSCHEDULER = 156 + SYS_SCHED_GETSCHEDULER = 157 + SYS_SCHED_YIELD = 158 + SYS_SCHED_GET_PRIORITY_MAX = 159 + SYS_SCHED_GET_PRIORITY_MIN = 160 + SYS_SCHED_RR_GET_INTERVAL = 161 + SYS_NANOSLEEP = 162 + SYS_MREMAP = 163 + SYS_QUERY_MODULE = 167 + SYS_POLL = 168 + SYS_NFSSERVCTL = 169 + SYS_PRCTL = 172 + SYS_RT_SIGRETURN = 173 + SYS_RT_SIGACTION = 174 + SYS_RT_SIGPROCMASK = 175 + SYS_RT_SIGPENDING = 176 + SYS_RT_SIGTIMEDWAIT = 177 + SYS_RT_SIGQUEUEINFO = 178 + SYS_RT_SIGSUSPEND = 179 + SYS_PREAD64 = 180 + SYS_PWRITE64 = 181 + SYS_GETCWD = 183 + SYS_CAPGET = 184 + SYS_CAPSET = 185 + SYS_SIGALTSTACK = 186 + SYS_SENDFILE = 187 + SYS_GETPMSG = 188 + SYS_PUTPMSG = 189 + SYS_VFORK = 190 + SYS_GETRLIMIT = 191 + SYS_LCHOWN = 198 + SYS_GETUID = 199 + SYS_GETGID = 200 + SYS_GETEUID = 201 + SYS_GETEGID = 202 + SYS_SETREUID = 203 + SYS_SETREGID = 204 + SYS_GETGROUPS = 205 + SYS_SETGROUPS = 206 + SYS_FCHOWN = 207 + SYS_SETRESUID = 208 + SYS_GETRESUID = 209 + SYS_SETRESGID = 210 + SYS_GETRESGID = 211 + SYS_CHOWN = 212 + SYS_SETUID = 213 + SYS_SETGID = 214 + SYS_SETFSUID = 215 + SYS_SETFSGID = 216 + SYS_PIVOT_ROOT = 217 + SYS_MINCORE = 218 + SYS_MADVISE = 219 + SYS_GETDENTS64 = 220 + SYS_READAHEAD = 222 + SYS_SETXATTR = 224 + SYS_LSETXATTR = 225 + SYS_FSETXATTR = 226 + SYS_GETXATTR = 227 + SYS_LGETXATTR = 228 + SYS_FGETXATTR = 229 + SYS_LISTXATTR = 230 + SYS_LLISTXATTR = 231 + SYS_FLISTXATTR = 232 + SYS_REMOVEXATTR = 233 + SYS_LREMOVEXATTR = 234 + SYS_FREMOVEXATTR = 235 + SYS_GETTID = 236 + SYS_TKILL = 237 + SYS_FUTEX = 238 + SYS_SCHED_SETAFFINITY = 239 + SYS_SCHED_GETAFFINITY = 240 + SYS_TGKILL = 241 + SYS_IO_SETUP = 243 + SYS_IO_DESTROY = 244 + SYS_IO_GETEVENTS = 245 + SYS_IO_SUBMIT = 246 + SYS_IO_CANCEL = 247 + SYS_EXIT_GROUP = 248 + SYS_EPOLL_CREATE = 249 + SYS_EPOLL_CTL = 250 + SYS_EPOLL_WAIT = 251 + SYS_SET_TID_ADDRESS = 252 + SYS_FADVISE64 = 253 + SYS_TIMER_CREATE = 254 + SYS_TIMER_SETTIME = 255 + SYS_TIMER_GETTIME = 256 + SYS_TIMER_GETOVERRUN = 257 + SYS_TIMER_DELETE = 258 + SYS_CLOCK_SETTIME = 259 + SYS_CLOCK_GETTIME = 260 + SYS_CLOCK_GETRES = 261 + SYS_CLOCK_NANOSLEEP = 262 + SYS_STATFS64 = 265 + SYS_FSTATFS64 = 266 + SYS_REMAP_FILE_PAGES = 267 + SYS_MBIND = 268 + SYS_GET_MEMPOLICY = 269 + SYS_SET_MEMPOLICY = 270 + SYS_MQ_OPEN = 271 + SYS_MQ_UNLINK = 272 + SYS_MQ_TIMEDSEND = 273 + SYS_MQ_TIMEDRECEIVE = 274 + SYS_MQ_NOTIFY = 275 + SYS_MQ_GETSETATTR = 276 + SYS_KEXEC_LOAD = 277 + SYS_ADD_KEY = 278 + SYS_REQUEST_KEY = 279 + SYS_KEYCTL = 280 + SYS_WAITID = 281 + SYS_IOPRIO_SET = 282 + SYS_IOPRIO_GET = 283 + SYS_INOTIFY_INIT = 284 + SYS_INOTIFY_ADD_WATCH = 285 + SYS_INOTIFY_RM_WATCH = 286 + SYS_MIGRATE_PAGES = 287 + SYS_OPENAT = 288 + SYS_MKDIRAT = 289 + SYS_MKNODAT = 290 + SYS_FCHOWNAT = 291 + SYS_FUTIMESAT = 292 + SYS_NEWFSTATAT = 293 + SYS_UNLINKAT = 294 + SYS_RENAMEAT = 295 + SYS_LINKAT = 296 + SYS_SYMLINKAT = 297 + SYS_READLINKAT = 298 + SYS_FCHMODAT = 299 + SYS_FACCESSAT = 300 + SYS_PSELECT6 = 301 + SYS_PPOLL = 302 + SYS_UNSHARE = 303 + SYS_SET_ROBUST_LIST = 304 + SYS_GET_ROBUST_LIST = 305 + SYS_SPLICE = 306 + SYS_SYNC_FILE_RANGE = 307 + SYS_TEE = 308 + SYS_VMSPLICE = 309 + SYS_MOVE_PAGES = 310 + SYS_GETCPU = 311 + SYS_EPOLL_PWAIT = 312 + SYS_UTIMES = 313 + SYS_FALLOCATE = 314 + SYS_UTIMENSAT = 315 + SYS_SIGNALFD = 316 + SYS_TIMERFD = 317 + SYS_EVENTFD = 318 + SYS_TIMERFD_CREATE = 319 + SYS_TIMERFD_SETTIME = 320 + SYS_TIMERFD_GETTIME = 321 + SYS_SIGNALFD4 = 322 + SYS_EVENTFD2 = 323 + SYS_INOTIFY_INIT1 = 324 + SYS_PIPE2 = 325 + SYS_DUP3 = 326 + SYS_EPOLL_CREATE1 = 327 + SYS_PREADV = 328 + SYS_PWRITEV = 329 + SYS_RT_TGSIGQUEUEINFO = 330 + SYS_PERF_EVENT_OPEN = 331 + SYS_FANOTIFY_INIT = 332 + SYS_FANOTIFY_MARK = 333 + SYS_PRLIMIT64 = 334 + SYS_NAME_TO_HANDLE_AT = 335 + SYS_OPEN_BY_HANDLE_AT = 336 + SYS_CLOCK_ADJTIME = 337 + SYS_SYNCFS = 338 + SYS_SETNS = 339 + SYS_PROCESS_VM_READV = 340 + SYS_PROCESS_VM_WRITEV = 341 + SYS_S390_RUNTIME_INSTR = 342 + SYS_KCMP = 343 + SYS_FINIT_MODULE = 344 + SYS_SCHED_SETATTR = 345 + SYS_SCHED_GETATTR = 346 + SYS_RENAMEAT2 = 347 + SYS_SECCOMP = 348 + SYS_GETRANDOM = 349 + SYS_MEMFD_CREATE = 350 + SYS_BPF = 351 + SYS_S390_PCI_MMIO_WRITE = 352 + SYS_S390_PCI_MMIO_READ = 353 + SYS_EXECVEAT = 354 + SYS_USERFAULTFD = 355 + SYS_MEMBARRIER = 356 + SYS_RECVMMSG = 357 + SYS_SENDMMSG = 358 + SYS_SOCKET = 359 + SYS_SOCKETPAIR = 360 + SYS_BIND = 361 + SYS_CONNECT = 362 + SYS_LISTEN = 363 + SYS_ACCEPT4 = 364 + SYS_GETSOCKOPT = 365 + SYS_SETSOCKOPT = 366 + SYS_GETSOCKNAME = 367 + SYS_GETPEERNAME = 368 + SYS_SENDTO = 369 + SYS_SENDMSG = 370 + SYS_RECVFROM = 371 + SYS_RECVMSG = 372 + SYS_SHUTDOWN = 373 + SYS_MLOCK2 = 374 + SYS_COPY_FILE_RANGE = 375 + SYS_PREADV2 = 376 + SYS_PWRITEV2 = 377 + SYS_S390_GUARDED_STORAGE = 378 + SYS_STATX = 379 + SYS_S390_STHYI = 380 + SYS_KEXEC_FILE_LOAD = 381 + SYS_IO_PGETEVENTS = 382 + SYS_RSEQ = 383 + SYS_PKEY_MPROTECT = 384 + SYS_PKEY_ALLOC = 385 + SYS_PKEY_FREE = 386 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 488ca848d..78802a5cf 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -7,379 +7,383 @@ package unix const ( - SYS_RESTART_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAIT4 = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECV = 11 - SYS_CHDIR = 12 - SYS_CHOWN = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LCHOWN = 16 - SYS_BRK = 17 - SYS_PERFCTR = 18 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_CAPGET = 21 - SYS_CAPSET = 22 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_VMSPLICE = 25 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_SIGALTSTACK = 28 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_STAT = 38 - SYS_SENDFILE = 39 - SYS_LSTAT = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_UMOUNT2 = 45 - SYS_SETGID = 46 - SYS_GETGID = 47 - SYS_SIGNAL = 48 - SYS_GETEUID = 49 - SYS_GETEGID = 50 - SYS_ACCT = 51 - SYS_MEMORY_ORDERING = 52 - SYS_IOCTL = 54 - SYS_REBOOT = 55 - SYS_SYMLINK = 57 - SYS_READLINK = 58 - SYS_EXECVE = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_FSTAT = 62 - SYS_FSTAT64 = 63 - SYS_GETPAGESIZE = 64 - SYS_MSYNC = 65 - SYS_VFORK = 66 - SYS_PREAD64 = 67 - SYS_PWRITE64 = 68 - SYS_MMAP = 71 - SYS_MUNMAP = 73 - SYS_MPROTECT = 74 - SYS_MADVISE = 75 - SYS_VHANGUP = 76 - SYS_MINCORE = 78 - SYS_GETGROUPS = 79 - SYS_SETGROUPS = 80 - SYS_GETPGRP = 81 - SYS_SETITIMER = 83 - SYS_SWAPON = 85 - SYS_GETITIMER = 86 - SYS_SETHOSTNAME = 88 - SYS_DUP2 = 90 - SYS_FCNTL = 92 - SYS_SELECT = 93 - SYS_FSYNC = 95 - SYS_SETPRIORITY = 96 - SYS_SOCKET = 97 - SYS_CONNECT = 98 - SYS_ACCEPT = 99 - SYS_GETPRIORITY = 100 - SYS_RT_SIGRETURN = 101 - SYS_RT_SIGACTION = 102 - SYS_RT_SIGPROCMASK = 103 - SYS_RT_SIGPENDING = 104 - SYS_RT_SIGTIMEDWAIT = 105 - SYS_RT_SIGQUEUEINFO = 106 - SYS_RT_SIGSUSPEND = 107 - SYS_SETRESUID = 108 - SYS_GETRESUID = 109 - SYS_SETRESGID = 110 - SYS_GETRESGID = 111 - SYS_RECVMSG = 113 - SYS_SENDMSG = 114 - SYS_GETTIMEOFDAY = 116 - SYS_GETRUSAGE = 117 - SYS_GETSOCKOPT = 118 - SYS_GETCWD = 119 - SYS_READV = 120 - SYS_WRITEV = 121 - SYS_SETTIMEOFDAY = 122 - SYS_FCHOWN = 123 - SYS_FCHMOD = 124 - SYS_RECVFROM = 125 - SYS_SETREUID = 126 - SYS_SETREGID = 127 - SYS_RENAME = 128 - SYS_TRUNCATE = 129 - SYS_FTRUNCATE = 130 - SYS_FLOCK = 131 - SYS_LSTAT64 = 132 - SYS_SENDTO = 133 - SYS_SHUTDOWN = 134 - SYS_SOCKETPAIR = 135 - SYS_MKDIR = 136 - SYS_RMDIR = 137 - SYS_UTIMES = 138 - SYS_STAT64 = 139 - SYS_SENDFILE64 = 140 - SYS_GETPEERNAME = 141 - SYS_FUTEX = 142 - SYS_GETTID = 143 - SYS_GETRLIMIT = 144 - SYS_SETRLIMIT = 145 - SYS_PIVOT_ROOT = 146 - SYS_PRCTL = 147 - SYS_PCICONFIG_READ = 148 - SYS_PCICONFIG_WRITE = 149 - SYS_GETSOCKNAME = 150 - SYS_INOTIFY_INIT = 151 - SYS_INOTIFY_ADD_WATCH = 152 - SYS_POLL = 153 - SYS_GETDENTS64 = 154 - SYS_INOTIFY_RM_WATCH = 156 - SYS_STATFS = 157 - SYS_FSTATFS = 158 - SYS_UMOUNT = 159 - SYS_SCHED_SET_AFFINITY = 160 - SYS_SCHED_GET_AFFINITY = 161 - SYS_GETDOMAINNAME = 162 - SYS_SETDOMAINNAME = 163 - SYS_UTRAP_INSTALL = 164 - SYS_QUOTACTL = 165 - SYS_SET_TID_ADDRESS = 166 - SYS_MOUNT = 167 - SYS_USTAT = 168 - SYS_SETXATTR = 169 - SYS_LSETXATTR = 170 - SYS_FSETXATTR = 171 - SYS_GETXATTR = 172 - SYS_LGETXATTR = 173 - SYS_GETDENTS = 174 - SYS_SETSID = 175 - SYS_FCHDIR = 176 - SYS_FGETXATTR = 177 - SYS_LISTXATTR = 178 - SYS_LLISTXATTR = 179 - SYS_FLISTXATTR = 180 - SYS_REMOVEXATTR = 181 - SYS_LREMOVEXATTR = 182 - SYS_SIGPENDING = 183 - SYS_QUERY_MODULE = 184 - SYS_SETPGID = 185 - SYS_FREMOVEXATTR = 186 - SYS_TKILL = 187 - SYS_EXIT_GROUP = 188 - SYS_UNAME = 189 - SYS_INIT_MODULE = 190 - SYS_PERSONALITY = 191 - SYS_REMAP_FILE_PAGES = 192 - SYS_EPOLL_CREATE = 193 - SYS_EPOLL_CTL = 194 - SYS_EPOLL_WAIT = 195 - SYS_IOPRIO_SET = 196 - SYS_GETPPID = 197 - SYS_SIGACTION = 198 - SYS_SGETMASK = 199 - SYS_SSETMASK = 200 - SYS_SIGSUSPEND = 201 - SYS_OLDLSTAT = 202 - SYS_USELIB = 203 - SYS_READDIR = 204 - SYS_READAHEAD = 205 - SYS_SOCKETCALL = 206 - SYS_SYSLOG = 207 - SYS_LOOKUP_DCOOKIE = 208 - SYS_FADVISE64 = 209 - SYS_FADVISE64_64 = 210 - SYS_TGKILL = 211 - SYS_WAITPID = 212 - SYS_SWAPOFF = 213 - SYS_SYSINFO = 214 - SYS_IPC = 215 - SYS_SIGRETURN = 216 - SYS_CLONE = 217 - SYS_IOPRIO_GET = 218 - SYS_ADJTIMEX = 219 - SYS_SIGPROCMASK = 220 - SYS_CREATE_MODULE = 221 - SYS_DELETE_MODULE = 222 - SYS_GET_KERNEL_SYMS = 223 - SYS_GETPGID = 224 - SYS_BDFLUSH = 225 - SYS_SYSFS = 226 - SYS_AFS_SYSCALL = 227 - SYS_SETFSUID = 228 - SYS_SETFSGID = 229 - SYS__NEWSELECT = 230 - SYS_SPLICE = 232 - SYS_STIME = 233 - SYS_STATFS64 = 234 - SYS_FSTATFS64 = 235 - SYS__LLSEEK = 236 - SYS_MLOCK = 237 - SYS_MUNLOCK = 238 - SYS_MLOCKALL = 239 - SYS_MUNLOCKALL = 240 - SYS_SCHED_SETPARAM = 241 - SYS_SCHED_GETPARAM = 242 - SYS_SCHED_SETSCHEDULER = 243 - SYS_SCHED_GETSCHEDULER = 244 - SYS_SCHED_YIELD = 245 - SYS_SCHED_GET_PRIORITY_MAX = 246 - SYS_SCHED_GET_PRIORITY_MIN = 247 - SYS_SCHED_RR_GET_INTERVAL = 248 - SYS_NANOSLEEP = 249 - SYS_MREMAP = 250 - SYS__SYSCTL = 251 - SYS_GETSID = 252 - SYS_FDATASYNC = 253 - SYS_NFSSERVCTL = 254 - SYS_SYNC_FILE_RANGE = 255 - SYS_CLOCK_SETTIME = 256 - SYS_CLOCK_GETTIME = 257 - SYS_CLOCK_GETRES = 258 - SYS_CLOCK_NANOSLEEP = 259 - SYS_SCHED_GETAFFINITY = 260 - SYS_SCHED_SETAFFINITY = 261 - SYS_TIMER_SETTIME = 262 - SYS_TIMER_GETTIME = 263 - SYS_TIMER_GETOVERRUN = 264 - SYS_TIMER_DELETE = 265 - SYS_TIMER_CREATE = 266 - SYS_VSERVER = 267 - SYS_IO_SETUP = 268 - SYS_IO_DESTROY = 269 - SYS_IO_SUBMIT = 270 - SYS_IO_CANCEL = 271 - SYS_IO_GETEVENTS = 272 - SYS_MQ_OPEN = 273 - SYS_MQ_UNLINK = 274 - SYS_MQ_TIMEDSEND = 275 - SYS_MQ_TIMEDRECEIVE = 276 - SYS_MQ_NOTIFY = 277 - SYS_MQ_GETSETATTR = 278 - SYS_WAITID = 279 - SYS_TEE = 280 - SYS_ADD_KEY = 281 - SYS_REQUEST_KEY = 282 - SYS_KEYCTL = 283 - SYS_OPENAT = 284 - SYS_MKDIRAT = 285 - SYS_MKNODAT = 286 - SYS_FCHOWNAT = 287 - SYS_FUTIMESAT = 288 - SYS_FSTATAT64 = 289 - SYS_UNLINKAT = 290 - SYS_RENAMEAT = 291 - SYS_LINKAT = 292 - SYS_SYMLINKAT = 293 - SYS_READLINKAT = 294 - SYS_FCHMODAT = 295 - SYS_FACCESSAT = 296 - SYS_PSELECT6 = 297 - SYS_PPOLL = 298 - SYS_UNSHARE = 299 - SYS_SET_ROBUST_LIST = 300 - SYS_GET_ROBUST_LIST = 301 - SYS_MIGRATE_PAGES = 302 - SYS_MBIND = 303 - SYS_GET_MEMPOLICY = 304 - SYS_SET_MEMPOLICY = 305 - SYS_KEXEC_LOAD = 306 - SYS_MOVE_PAGES = 307 - SYS_GETCPU = 308 - SYS_EPOLL_PWAIT = 309 - SYS_UTIMENSAT = 310 - SYS_SIGNALFD = 311 - SYS_TIMERFD_CREATE = 312 - SYS_EVENTFD = 313 - SYS_FALLOCATE = 314 - SYS_TIMERFD_SETTIME = 315 - SYS_TIMERFD_GETTIME = 316 - SYS_SIGNALFD4 = 317 - SYS_EVENTFD2 = 318 - SYS_EPOLL_CREATE1 = 319 - SYS_DUP3 = 320 - SYS_PIPE2 = 321 - SYS_INOTIFY_INIT1 = 322 - SYS_ACCEPT4 = 323 - SYS_PREADV = 324 - SYS_PWRITEV = 325 - SYS_RT_TGSIGQUEUEINFO = 326 - SYS_PERF_EVENT_OPEN = 327 - SYS_RECVMMSG = 328 - SYS_FANOTIFY_INIT = 329 - SYS_FANOTIFY_MARK = 330 - SYS_PRLIMIT64 = 331 - SYS_NAME_TO_HANDLE_AT = 332 - SYS_OPEN_BY_HANDLE_AT = 333 - SYS_CLOCK_ADJTIME = 334 - SYS_SYNCFS = 335 - SYS_SENDMMSG = 336 - SYS_SETNS = 337 - SYS_PROCESS_VM_READV = 338 - SYS_PROCESS_VM_WRITEV = 339 - SYS_KERN_FEATURES = 340 - SYS_KCMP = 341 - SYS_FINIT_MODULE = 342 - SYS_SCHED_SETATTR = 343 - SYS_SCHED_GETATTR = 344 - SYS_RENAMEAT2 = 345 - SYS_SECCOMP = 346 - SYS_GETRANDOM = 347 - SYS_MEMFD_CREATE = 348 - SYS_BPF = 349 - SYS_EXECVEAT = 350 - SYS_MEMBARRIER = 351 - SYS_USERFAULTFD = 352 - SYS_BIND = 353 - SYS_LISTEN = 354 - SYS_SETSOCKOPT = 355 - SYS_MLOCK2 = 356 - SYS_COPY_FILE_RANGE = 357 - SYS_PREADV2 = 358 - SYS_PWRITEV2 = 359 - SYS_STATX = 360 - SYS_IO_PGETEVENTS = 361 - SYS_PKEY_MPROTECT = 362 - SYS_PKEY_ALLOC = 363 - SYS_PKEY_FREE = 364 - SYS_RSEQ = 365 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLOSE_RANGE = 436 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 - SYS_FACCESSAT2 = 439 - SYS_PROCESS_MADVISE = 440 - SYS_EPOLL_PWAIT2 = 441 - SYS_MOUNT_SETATTR = 442 + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAIT4 = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECV = 11 + SYS_CHDIR = 12 + SYS_CHOWN = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_BRK = 17 + SYS_PERFCTR = 18 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_CAPGET = 21 + SYS_CAPSET = 22 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_VMSPLICE = 25 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_SIGALTSTACK = 28 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_STAT = 38 + SYS_SENDFILE = 39 + SYS_LSTAT = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_UMOUNT2 = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_SIGNAL = 48 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_MEMORY_ORDERING = 52 + SYS_IOCTL = 54 + SYS_REBOOT = 55 + SYS_SYMLINK = 57 + SYS_READLINK = 58 + SYS_EXECVE = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_FSTAT = 62 + SYS_FSTAT64 = 63 + SYS_GETPAGESIZE = 64 + SYS_MSYNC = 65 + SYS_VFORK = 66 + SYS_PREAD64 = 67 + SYS_PWRITE64 = 68 + SYS_MMAP = 71 + SYS_MUNMAP = 73 + SYS_MPROTECT = 74 + SYS_MADVISE = 75 + SYS_VHANGUP = 76 + SYS_MINCORE = 78 + SYS_GETGROUPS = 79 + SYS_SETGROUPS = 80 + SYS_GETPGRP = 81 + SYS_SETITIMER = 83 + SYS_SWAPON = 85 + SYS_GETITIMER = 86 + SYS_SETHOSTNAME = 88 + SYS_DUP2 = 90 + SYS_FCNTL = 92 + SYS_SELECT = 93 + SYS_FSYNC = 95 + SYS_SETPRIORITY = 96 + SYS_SOCKET = 97 + SYS_CONNECT = 98 + SYS_ACCEPT = 99 + SYS_GETPRIORITY = 100 + SYS_RT_SIGRETURN = 101 + SYS_RT_SIGACTION = 102 + SYS_RT_SIGPROCMASK = 103 + SYS_RT_SIGPENDING = 104 + SYS_RT_SIGTIMEDWAIT = 105 + SYS_RT_SIGQUEUEINFO = 106 + SYS_RT_SIGSUSPEND = 107 + SYS_SETRESUID = 108 + SYS_GETRESUID = 109 + SYS_SETRESGID = 110 + SYS_GETRESGID = 111 + SYS_RECVMSG = 113 + SYS_SENDMSG = 114 + SYS_GETTIMEOFDAY = 116 + SYS_GETRUSAGE = 117 + SYS_GETSOCKOPT = 118 + SYS_GETCWD = 119 + SYS_READV = 120 + SYS_WRITEV = 121 + SYS_SETTIMEOFDAY = 122 + SYS_FCHOWN = 123 + SYS_FCHMOD = 124 + SYS_RECVFROM = 125 + SYS_SETREUID = 126 + SYS_SETREGID = 127 + SYS_RENAME = 128 + SYS_TRUNCATE = 129 + SYS_FTRUNCATE = 130 + SYS_FLOCK = 131 + SYS_LSTAT64 = 132 + SYS_SENDTO = 133 + SYS_SHUTDOWN = 134 + SYS_SOCKETPAIR = 135 + SYS_MKDIR = 136 + SYS_RMDIR = 137 + SYS_UTIMES = 138 + SYS_STAT64 = 139 + SYS_SENDFILE64 = 140 + SYS_GETPEERNAME = 141 + SYS_FUTEX = 142 + SYS_GETTID = 143 + SYS_GETRLIMIT = 144 + SYS_SETRLIMIT = 145 + SYS_PIVOT_ROOT = 146 + SYS_PRCTL = 147 + SYS_PCICONFIG_READ = 148 + SYS_PCICONFIG_WRITE = 149 + SYS_GETSOCKNAME = 150 + SYS_INOTIFY_INIT = 151 + SYS_INOTIFY_ADD_WATCH = 152 + SYS_POLL = 153 + SYS_GETDENTS64 = 154 + SYS_INOTIFY_RM_WATCH = 156 + SYS_STATFS = 157 + SYS_FSTATFS = 158 + SYS_UMOUNT = 159 + SYS_SCHED_SET_AFFINITY = 160 + SYS_SCHED_GET_AFFINITY = 161 + SYS_GETDOMAINNAME = 162 + SYS_SETDOMAINNAME = 163 + SYS_UTRAP_INSTALL = 164 + SYS_QUOTACTL = 165 + SYS_SET_TID_ADDRESS = 166 + SYS_MOUNT = 167 + SYS_USTAT = 168 + SYS_SETXATTR = 169 + SYS_LSETXATTR = 170 + SYS_FSETXATTR = 171 + SYS_GETXATTR = 172 + SYS_LGETXATTR = 173 + SYS_GETDENTS = 174 + SYS_SETSID = 175 + SYS_FCHDIR = 176 + SYS_FGETXATTR = 177 + SYS_LISTXATTR = 178 + SYS_LLISTXATTR = 179 + SYS_FLISTXATTR = 180 + SYS_REMOVEXATTR = 181 + SYS_LREMOVEXATTR = 182 + SYS_SIGPENDING = 183 + SYS_QUERY_MODULE = 184 + SYS_SETPGID = 185 + SYS_FREMOVEXATTR = 186 + SYS_TKILL = 187 + SYS_EXIT_GROUP = 188 + SYS_UNAME = 189 + SYS_INIT_MODULE = 190 + SYS_PERSONALITY = 191 + SYS_REMAP_FILE_PAGES = 192 + SYS_EPOLL_CREATE = 193 + SYS_EPOLL_CTL = 194 + SYS_EPOLL_WAIT = 195 + SYS_IOPRIO_SET = 196 + SYS_GETPPID = 197 + SYS_SIGACTION = 198 + SYS_SGETMASK = 199 + SYS_SSETMASK = 200 + SYS_SIGSUSPEND = 201 + SYS_OLDLSTAT = 202 + SYS_USELIB = 203 + SYS_READDIR = 204 + SYS_READAHEAD = 205 + SYS_SOCKETCALL = 206 + SYS_SYSLOG = 207 + SYS_LOOKUP_DCOOKIE = 208 + SYS_FADVISE64 = 209 + SYS_FADVISE64_64 = 210 + SYS_TGKILL = 211 + SYS_WAITPID = 212 + SYS_SWAPOFF = 213 + SYS_SYSINFO = 214 + SYS_IPC = 215 + SYS_SIGRETURN = 216 + SYS_CLONE = 217 + SYS_IOPRIO_GET = 218 + SYS_ADJTIMEX = 219 + SYS_SIGPROCMASK = 220 + SYS_CREATE_MODULE = 221 + SYS_DELETE_MODULE = 222 + SYS_GET_KERNEL_SYMS = 223 + SYS_GETPGID = 224 + SYS_BDFLUSH = 225 + SYS_SYSFS = 226 + SYS_AFS_SYSCALL = 227 + SYS_SETFSUID = 228 + SYS_SETFSGID = 229 + SYS__NEWSELECT = 230 + SYS_SPLICE = 232 + SYS_STIME = 233 + SYS_STATFS64 = 234 + SYS_FSTATFS64 = 235 + SYS__LLSEEK = 236 + SYS_MLOCK = 237 + SYS_MUNLOCK = 238 + SYS_MLOCKALL = 239 + SYS_MUNLOCKALL = 240 + SYS_SCHED_SETPARAM = 241 + SYS_SCHED_GETPARAM = 242 + SYS_SCHED_SETSCHEDULER = 243 + SYS_SCHED_GETSCHEDULER = 244 + SYS_SCHED_YIELD = 245 + SYS_SCHED_GET_PRIORITY_MAX = 246 + SYS_SCHED_GET_PRIORITY_MIN = 247 + SYS_SCHED_RR_GET_INTERVAL = 248 + SYS_NANOSLEEP = 249 + SYS_MREMAP = 250 + SYS__SYSCTL = 251 + SYS_GETSID = 252 + SYS_FDATASYNC = 253 + SYS_NFSSERVCTL = 254 + SYS_SYNC_FILE_RANGE = 255 + SYS_CLOCK_SETTIME = 256 + SYS_CLOCK_GETTIME = 257 + SYS_CLOCK_GETRES = 258 + SYS_CLOCK_NANOSLEEP = 259 + SYS_SCHED_GETAFFINITY = 260 + SYS_SCHED_SETAFFINITY = 261 + SYS_TIMER_SETTIME = 262 + SYS_TIMER_GETTIME = 263 + SYS_TIMER_GETOVERRUN = 264 + SYS_TIMER_DELETE = 265 + SYS_TIMER_CREATE = 266 + SYS_VSERVER = 267 + SYS_IO_SETUP = 268 + SYS_IO_DESTROY = 269 + SYS_IO_SUBMIT = 270 + SYS_IO_CANCEL = 271 + SYS_IO_GETEVENTS = 272 + SYS_MQ_OPEN = 273 + SYS_MQ_UNLINK = 274 + SYS_MQ_TIMEDSEND = 275 + SYS_MQ_TIMEDRECEIVE = 276 + SYS_MQ_NOTIFY = 277 + SYS_MQ_GETSETATTR = 278 + SYS_WAITID = 279 + SYS_TEE = 280 + SYS_ADD_KEY = 281 + SYS_REQUEST_KEY = 282 + SYS_KEYCTL = 283 + SYS_OPENAT = 284 + SYS_MKDIRAT = 285 + SYS_MKNODAT = 286 + SYS_FCHOWNAT = 287 + SYS_FUTIMESAT = 288 + SYS_FSTATAT64 = 289 + SYS_UNLINKAT = 290 + SYS_RENAMEAT = 291 + SYS_LINKAT = 292 + SYS_SYMLINKAT = 293 + SYS_READLINKAT = 294 + SYS_FCHMODAT = 295 + SYS_FACCESSAT = 296 + SYS_PSELECT6 = 297 + SYS_PPOLL = 298 + SYS_UNSHARE = 299 + SYS_SET_ROBUST_LIST = 300 + SYS_GET_ROBUST_LIST = 301 + SYS_MIGRATE_PAGES = 302 + SYS_MBIND = 303 + SYS_GET_MEMPOLICY = 304 + SYS_SET_MEMPOLICY = 305 + SYS_KEXEC_LOAD = 306 + SYS_MOVE_PAGES = 307 + SYS_GETCPU = 308 + SYS_EPOLL_PWAIT = 309 + SYS_UTIMENSAT = 310 + SYS_SIGNALFD = 311 + SYS_TIMERFD_CREATE = 312 + SYS_EVENTFD = 313 + SYS_FALLOCATE = 314 + SYS_TIMERFD_SETTIME = 315 + SYS_TIMERFD_GETTIME = 316 + SYS_SIGNALFD4 = 317 + SYS_EVENTFD2 = 318 + SYS_EPOLL_CREATE1 = 319 + SYS_DUP3 = 320 + SYS_PIPE2 = 321 + SYS_INOTIFY_INIT1 = 322 + SYS_ACCEPT4 = 323 + SYS_PREADV = 324 + SYS_PWRITEV = 325 + SYS_RT_TGSIGQUEUEINFO = 326 + SYS_PERF_EVENT_OPEN = 327 + SYS_RECVMMSG = 328 + SYS_FANOTIFY_INIT = 329 + SYS_FANOTIFY_MARK = 330 + SYS_PRLIMIT64 = 331 + SYS_NAME_TO_HANDLE_AT = 332 + SYS_OPEN_BY_HANDLE_AT = 333 + SYS_CLOCK_ADJTIME = 334 + SYS_SYNCFS = 335 + SYS_SENDMMSG = 336 + SYS_SETNS = 337 + SYS_PROCESS_VM_READV = 338 + SYS_PROCESS_VM_WRITEV = 339 + SYS_KERN_FEATURES = 340 + SYS_KCMP = 341 + SYS_FINIT_MODULE = 342 + SYS_SCHED_SETATTR = 343 + SYS_SCHED_GETATTR = 344 + SYS_RENAMEAT2 = 345 + SYS_SECCOMP = 346 + SYS_GETRANDOM = 347 + SYS_MEMFD_CREATE = 348 + SYS_BPF = 349 + SYS_EXECVEAT = 350 + SYS_MEMBARRIER = 351 + SYS_USERFAULTFD = 352 + SYS_BIND = 353 + SYS_LISTEN = 354 + SYS_SETSOCKOPT = 355 + SYS_MLOCK2 = 356 + SYS_COPY_FILE_RANGE = 357 + SYS_PREADV2 = 358 + SYS_PWRITEV2 = 359 + SYS_STATX = 360 + SYS_IO_PGETEVENTS = 361 + SYS_PKEY_MPROTECT = 362 + SYS_PKEY_ALLOC = 363 + SYS_PKEY_FREE = 364 + SYS_RSEQ = 365 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 2673e6c59..7efe5ccba 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -209,6 +209,92 @@ type RawSockaddrCtl struct { Sc_reserved [5]uint32 } +type RawSockaddrVM struct { + Len uint8 + Family uint8 + Reserved1 uint16 + Port uint32 + Cid uint32 +} + +type XVSockPCB struct { + Xv_len uint32 + Xv_vsockpp uint64 + Xvp_local_cid uint32 + Xvp_local_port uint32 + Xvp_remote_cid uint32 + Xvp_remote_port uint32 + Xvp_rxcnt uint32 + Xvp_txcnt uint32 + Xvp_peer_rxhiwat uint32 + Xvp_peer_rxcnt uint32 + Xvp_last_pid int32 + Xvp_gencnt uint64 + Xv_socket XSocket + _ [4]byte +} + +type XSocket struct { + Xso_len uint32 + Xso_so uint32 + So_type int16 + So_options int16 + So_linger int16 + So_state int16 + So_pcb uint32 + Xso_protocol int32 + Xso_family int32 + So_qlen int16 + So_incqlen int16 + So_qlimit int16 + So_timeo int16 + So_error uint16 + So_pgid int32 + So_oobmark uint32 + So_rcv XSockbuf + So_snd XSockbuf + So_uid uint32 +} + +type XSocket64 struct { + Xso_len uint32 + _ [8]byte + So_type int16 + So_options int16 + So_linger int16 + So_state int16 + _ [8]byte + Xso_protocol int32 + Xso_family int32 + So_qlen int16 + So_incqlen int16 + So_qlimit int16 + So_timeo int16 + So_error uint16 + So_pgid int32 + So_oobmark uint32 + So_rcv XSockbuf + So_snd XSockbuf + So_uid uint32 +} + +type XSockbuf struct { + Cc uint32 + Hiwat uint32 + Mbcnt uint32 + Mbmax uint32 + Lowat int32 + Flags int16 + Timeo int16 +} + +type XVSockPgen struct { + Len uint32 + Count uint64 + Gen uint64 + Sogen uint64 +} + type _Socklen uint32 type Xucred struct { @@ -287,6 +373,11 @@ const ( SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x14 SizeofSockaddrCtl = 0x20 + SizeofSockaddrVM = 0xc + SizeofXvsockpcb = 0xa8 + SizeofXSocket = 0x64 + SizeofXSockbuf = 0x18 + SizeofXVSockPgen = 0x20 SizeofXucred = 0x4c SizeofLinger = 0x8 SizeofIovec = 0x10 @@ -535,3 +626,143 @@ type CtlInfo struct { Id uint32 Name [96]byte } + +const SizeofKinfoProc = 0x288 + +type Eproc struct { + Paddr uintptr + Sess uintptr + Pcred Pcred + Ucred Ucred + Vm Vmspace + Ppid int32 + Pgid int32 + Jobc int16 + Tdev int32 + Tpgid int32 + Tsess uintptr + Wmesg [8]int8 + Xsize int32 + Xrssize int16 + Xccount int16 + Xswrss int16 + Flag int32 + Login [12]int8 + Spare [4]int32 + _ [4]byte +} + +type ExternProc struct { + P_starttime Timeval + P_vmspace *Vmspace + P_sigacts uintptr + P_flag int32 + P_stat int8 + P_pid int32 + P_oppid int32 + P_dupfd int32 + User_stack *int8 + Exit_thread *byte + P_debugger int32 + Sigwait int32 + P_estcpu uint32 + P_cpticks int32 + P_pctcpu uint32 + P_wchan *byte + P_wmesg *int8 + P_swtime uint32 + P_slptime uint32 + P_realtimer Itimerval + P_rtime Timeval + P_uticks uint64 + P_sticks uint64 + P_iticks uint64 + P_traceflag int32 + P_tracep uintptr + P_siglist int32 + P_textvp uintptr + P_holdcnt int32 + P_sigmask uint32 + P_sigignore uint32 + P_sigcatch uint32 + P_priority uint8 + P_usrpri uint8 + P_nice int8 + P_comm [17]int8 + P_pgrp uintptr + P_addr uintptr + P_xstat uint16 + P_acflag uint16 + P_ru *Rusage +} + +type Itimerval struct { + Interval Timeval + Value Timeval +} + +type KinfoProc struct { + Proc ExternProc + Eproc Eproc +} + +type Vmspace struct { + Dummy int32 + Dummy2 *int8 + Dummy3 [5]int32 + Dummy4 [3]*int8 +} + +type Pcred struct { + Pc_lock [72]int8 + Pc_ucred uintptr + P_ruid uint32 + P_svuid uint32 + P_rgid uint32 + P_svgid uint32 + P_refcnt int32 + _ [4]byte +} + +type Ucred struct { + Ref int32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 +} + +type SysvIpcPerm struct { + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint16 + _ uint16 + _ int32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Lpid int32 + Cpid int32 + Nattch uint16 + _ [34]byte +} + +const ( + IPC_CREAT = 0x200 + IPC_EXCL = 0x400 + IPC_NOWAIT = 0x800 + IPC_PRIVATE = 0x0 +) + +const ( + IPC_RMID = 0x0 + IPC_SET = 0x1 + IPC_STAT = 0x2 +) + +const ( + SHM_RDONLY = 0x1000 + SHM_RND = 0x2000 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index 1465cbcff..b23a2efe8 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -209,6 +209,92 @@ type RawSockaddrCtl struct { Sc_reserved [5]uint32 } +type RawSockaddrVM struct { + Len uint8 + Family uint8 + Reserved1 uint16 + Port uint32 + Cid uint32 +} + +type XVSockPCB struct { + Xv_len uint32 + Xv_vsockpp uint64 + Xvp_local_cid uint32 + Xvp_local_port uint32 + Xvp_remote_cid uint32 + Xvp_remote_port uint32 + Xvp_rxcnt uint32 + Xvp_txcnt uint32 + Xvp_peer_rxhiwat uint32 + Xvp_peer_rxcnt uint32 + Xvp_last_pid int32 + Xvp_gencnt uint64 + Xv_socket XSocket + _ [4]byte +} + +type XSocket struct { + Xso_len uint32 + Xso_so uint32 + So_type int16 + So_options int16 + So_linger int16 + So_state int16 + So_pcb uint32 + Xso_protocol int32 + Xso_family int32 + So_qlen int16 + So_incqlen int16 + So_qlimit int16 + So_timeo int16 + So_error uint16 + So_pgid int32 + So_oobmark uint32 + So_rcv XSockbuf + So_snd XSockbuf + So_uid uint32 +} + +type XSocket64 struct { + Xso_len uint32 + _ [8]byte + So_type int16 + So_options int16 + So_linger int16 + So_state int16 + _ [8]byte + Xso_protocol int32 + Xso_family int32 + So_qlen int16 + So_incqlen int16 + So_qlimit int16 + So_timeo int16 + So_error uint16 + So_pgid int32 + So_oobmark uint32 + So_rcv XSockbuf + So_snd XSockbuf + So_uid uint32 +} + +type XSockbuf struct { + Cc uint32 + Hiwat uint32 + Mbcnt uint32 + Mbmax uint32 + Lowat int32 + Flags int16 + Timeo int16 +} + +type XVSockPgen struct { + Len uint32 + Count uint64 + Gen uint64 + Sogen uint64 +} + type _Socklen uint32 type Xucred struct { @@ -287,6 +373,11 @@ const ( SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x14 SizeofSockaddrCtl = 0x20 + SizeofSockaddrVM = 0xc + SizeofXvsockpcb = 0xa8 + SizeofXSocket = 0x64 + SizeofXSockbuf = 0x18 + SizeofXVSockPgen = 0x20 SizeofXucred = 0x4c SizeofLinger = 0x8 SizeofIovec = 0x10 @@ -535,3 +626,143 @@ type CtlInfo struct { Id uint32 Name [96]byte } + +const SizeofKinfoProc = 0x288 + +type Eproc struct { + Paddr uintptr + Sess uintptr + Pcred Pcred + Ucred Ucred + Vm Vmspace + Ppid int32 + Pgid int32 + Jobc int16 + Tdev int32 + Tpgid int32 + Tsess uintptr + Wmesg [8]int8 + Xsize int32 + Xrssize int16 + Xccount int16 + Xswrss int16 + Flag int32 + Login [12]int8 + Spare [4]int32 + _ [4]byte +} + +type ExternProc struct { + P_starttime Timeval + P_vmspace *Vmspace + P_sigacts uintptr + P_flag int32 + P_stat int8 + P_pid int32 + P_oppid int32 + P_dupfd int32 + User_stack *int8 + Exit_thread *byte + P_debugger int32 + Sigwait int32 + P_estcpu uint32 + P_cpticks int32 + P_pctcpu uint32 + P_wchan *byte + P_wmesg *int8 + P_swtime uint32 + P_slptime uint32 + P_realtimer Itimerval + P_rtime Timeval + P_uticks uint64 + P_sticks uint64 + P_iticks uint64 + P_traceflag int32 + P_tracep uintptr + P_siglist int32 + P_textvp uintptr + P_holdcnt int32 + P_sigmask uint32 + P_sigignore uint32 + P_sigcatch uint32 + P_priority uint8 + P_usrpri uint8 + P_nice int8 + P_comm [17]int8 + P_pgrp uintptr + P_addr uintptr + P_xstat uint16 + P_acflag uint16 + P_ru *Rusage +} + +type Itimerval struct { + Interval Timeval + Value Timeval +} + +type KinfoProc struct { + Proc ExternProc + Eproc Eproc +} + +type Vmspace struct { + Dummy int32 + Dummy2 *int8 + Dummy3 [5]int32 + Dummy4 [3]*int8 +} + +type Pcred struct { + Pc_lock [72]int8 + Pc_ucred uintptr + P_ruid uint32 + P_svuid uint32 + P_rgid uint32 + P_svgid uint32 + P_refcnt int32 + _ [4]byte +} + +type Ucred struct { + Ref int32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 +} + +type SysvIpcPerm struct { + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint16 + _ uint16 + _ int32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Lpid int32 + Cpid int32 + Nattch uint16 + _ [34]byte +} + +const ( + IPC_CREAT = 0x200 + IPC_EXCL = 0x400 + IPC_NOWAIT = 0x800 + IPC_PRIVATE = 0x0 +) + +const ( + IPC_RMID = 0x0 + IPC_SET = 0x1 + IPC_STAT = 0x2 +) + +const ( + SHM_RDONLY = 0x1000 + SHM_RND = 0x2000 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go index 1f99c024a..4eec078e5 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go @@ -31,6 +31,8 @@ type Timeval struct { Usec int32 } +type Time_t int32 + type Rusage struct { Utime Timeval Stime Timeval diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go index ddf0305a5..7622904a5 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go @@ -31,6 +31,8 @@ type Timeval struct { Usec int64 } +type Time_t int64 + type Rusage struct { Utime Timeval Stime Timeval diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go index dce0a5c80..19223ce8e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go @@ -33,6 +33,8 @@ type Timeval struct { _ [4]byte } +type Time_t int32 + type Rusage struct { Utime Timeval Stime Timeval diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go index e23244702..8e3e33f67 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go @@ -31,6 +31,8 @@ type Timeval struct { Usec int64 } +type Time_t int64 + type Rusage struct { Utime Timeval Stime Timeval diff --git a/vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go index 236f37ef6..4c485261d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go @@ -13,6 +13,8 @@ const ( I_STR = 0x5308 I_POP = 0x5303 I_PUSH = 0x5302 + I_LINK = 0x530c + I_UNLINK = 0x530d I_PLINK = 0x5316 I_PUNLINK = 0x5317 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 72887abe5..249ecfcd4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -452,6 +452,11 @@ type CanFilter struct { Mask uint32 } +type TCPRepairOpt struct { + Code uint32 + Val uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -484,6 +489,7 @@ const ( SizeofUcred = 0xc SizeofTCPInfo = 0x68 SizeofCanFilter = 0x8 + SizeofTCPRepairOpt = 0x8 ) const ( @@ -681,6 +687,16 @@ type NdMsg struct { Type uint8 } +const ( + ICMP_FILTER = 0x1 + + ICMPV6_FILTER = 0x1 + ICMPV6_FILTER_BLOCK = 0x1 + ICMPV6_FILTER_BLOCKOTHERS = 0x3 + ICMPV6_FILTER_PASS = 0x2 + ICMPV6_FILTER_PASSONLY = 0x4 +) + const ( SizeofSockFilter = 0x8 ) @@ -1001,7 +1017,7 @@ const ( PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 PERF_COUNT_SW_BPF_OUTPUT = 0xa - PERF_COUNT_SW_MAX = 0xb + PERF_COUNT_SW_MAX = 0xc PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 PERF_SAMPLE_TIME = 0x4 @@ -1773,6 +1789,8 @@ const ( NFPROTO_NUMPROTO = 0xd ) +const SO_ORIGINAL_DST = 0x50 + type Nfgenmsg struct { Nfgen_family uint8 Version uint8 @@ -2338,8 +2356,8 @@ const ( SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff + SOF_TIMESTAMPING_LAST = 0x8000 + SOF_TIMESTAMPING_MASK = 0xffff SCM_TSTAMP_SND = 0x0 SCM_TSTAMP_SCHED = 0x1 @@ -2915,7 +2933,7 @@ const ( DEVLINK_CMD_TRAP_POLICER_NEW = 0x47 DEVLINK_CMD_TRAP_POLICER_DEL = 0x48 DEVLINK_CMD_HEALTH_REPORTER_TEST = 0x49 - DEVLINK_CMD_MAX = 0x49 + DEVLINK_CMD_MAX = 0x4d DEVLINK_PORT_TYPE_NOTSET = 0x0 DEVLINK_PORT_TYPE_AUTO = 0x1 DEVLINK_PORT_TYPE_ETH = 0x2 @@ -3138,7 +3156,7 @@ const ( DEVLINK_ATTR_RELOAD_ACTION_INFO = 0xa2 DEVLINK_ATTR_RELOAD_ACTION_STATS = 0xa3 DEVLINK_ATTR_PORT_PCI_SF_NUMBER = 0xa4 - DEVLINK_ATTR_MAX = 0xa4 + DEVLINK_ATTR_MAX = 0xa9 DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE = 0x0 DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX = 0x1 DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT = 0x0 @@ -3434,7 +3452,7 @@ const ( ETHTOOL_MSG_CABLE_TEST_ACT = 0x1a ETHTOOL_MSG_CABLE_TEST_TDR_ACT = 0x1b ETHTOOL_MSG_TUNNEL_INFO_GET = 0x1c - ETHTOOL_MSG_USER_MAX = 0x1c + ETHTOOL_MSG_USER_MAX = 0x21 ETHTOOL_MSG_KERNEL_NONE = 0x0 ETHTOOL_MSG_STRSET_GET_REPLY = 0x1 ETHTOOL_MSG_LINKINFO_GET_REPLY = 0x2 @@ -3465,7 +3483,7 @@ const ( ETHTOOL_MSG_CABLE_TEST_NTF = 0x1b ETHTOOL_MSG_CABLE_TEST_TDR_NTF = 0x1c ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY = 0x1d - ETHTOOL_MSG_KERNEL_MAX = 0x1d + ETHTOOL_MSG_KERNEL_MAX = 0x22 ETHTOOL_A_HEADER_UNSPEC = 0x0 ETHTOOL_A_HEADER_DEV_INDEX = 0x1 ETHTOOL_A_HEADER_DEV_NAME = 0x2 @@ -3905,3 +3923,36 @@ const ( NFC_SDP_ATTR_URI = 0x1 NFC_SDP_ATTR_SAP = 0x2 ) + +type LandlockRulesetAttr struct { + Access_fs uint64 +} + +type LandlockPathBeneathAttr struct { + Allowed_access uint64 + Parent_fd int32 +} + +const ( + LANDLOCK_RULE_PATH_BENEATH = 0x1 +) + +const ( + IPC_CREAT = 0x200 + IPC_EXCL = 0x400 + IPC_NOWAIT = 0x800 + IPC_PRIVATE = 0x0 + + ipc_64 = 0x100 +) + +const ( + IPC_RMID = 0x0 + IPC_SET = 0x1 + IPC_STAT = 0x2 +) + +const ( + SHM_RDONLY = 0x1000 + SHM_RND = 0x2000 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 235c62e46..eeeb9aa39 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -170,6 +170,11 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [16]byte +} + const ( SizeofSockaddrNFCLLCP = 0x58 SizeofIovec = 0x8 @@ -630,3 +635,36 @@ const ( PPS_GETCAP = 0x800470a3 PPS_FETCH = 0xc00470a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint16 + _ [2]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Atime_high uint32 + Dtime uint32 + Dtime_high uint32 + Ctime uint32 + Ctime_high uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + _ uint32 + _ uint32 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index 99b1e5b6a..d30e1155c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -173,6 +173,11 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 @@ -648,3 +653,33 @@ const ( PPS_GETCAP = 0x800870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index cc8bba791..69d029752 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -176,6 +176,11 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [16]byte +} + const ( SizeofSockaddrNFCLLCP = 0x58 SizeofIovec = 0x8 @@ -625,3 +630,36 @@ const ( PPS_GETCAP = 0x800470a3 PPS_FETCH = 0xc00470a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint16 + _ [2]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Atime_high uint32 + Dtime uint32 + Dtime_high uint32 + Ctime uint32 + Ctime_high uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + _ uint32 + _ uint32 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index fa8fe3a75..28a0455bc 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -174,6 +174,11 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 @@ -627,3 +632,33 @@ const ( PPS_GETCAP = 0x800870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index e7fb8d9b7..64a845483 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -175,6 +175,11 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [16]byte +} + const ( SizeofSockaddrNFCLLCP = 0x58 SizeofIovec = 0x8 @@ -631,3 +636,35 @@ const ( PPS_GETCAP = 0x400470a3 PPS_FETCH = 0xc00470a4 ) + +const ( + PIDFD_NONBLOCK = 0x80 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Dtime uint32 + Ctime uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + Atime_high uint16 + Dtime_high uint16 + Ctime_high uint16 + _ uint16 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index 2fa61d593..a1b7dee41 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -174,6 +174,11 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 @@ -630,3 +635,33 @@ const ( PPS_GETCAP = 0x400870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x80 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 7f3639933..936fa6a26 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -174,6 +174,11 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 @@ -630,3 +635,33 @@ const ( PPS_GETCAP = 0x400870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x80 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index f3c20cb86..5dd546fbf 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -175,6 +175,11 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [16]byte +} + const ( SizeofSockaddrNFCLLCP = 0x58 SizeofIovec = 0x8 @@ -631,3 +636,35 @@ const ( PPS_GETCAP = 0x400470a3 PPS_FETCH = 0xc00470a4 ) + +const ( + PIDFD_NONBLOCK = 0x80 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Dtime uint32 + Ctime uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + Atime_high uint16 + Dtime_high uint16 + Ctime_high uint16 + _ uint16 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go index 885d27950..947b32e43 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -176,6 +176,11 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [16]byte +} + const ( SizeofSockaddrNFCLLCP = 0x58 SizeofIovec = 0x8 @@ -637,3 +642,37 @@ const ( PPS_GETCAP = 0x400470a3 PPS_FETCH = 0xc00470a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + Seq uint32 + _ uint32 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime_high uint32 + Atime uint32 + Dtime_high uint32 + Dtime uint32 + Ctime_high uint32 + Ctime uint32 + _ uint32 + Segsz uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + _ uint32 + _ uint32 + _ [4]byte +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index a94eb8e18..2a606151b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -175,6 +175,11 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 @@ -637,3 +642,32 @@ const ( PPS_GETCAP = 0x400870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + Seq uint32 + _ uint32 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime int64 + Dtime int64 + Ctime int64 + Segsz uint64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 659e32ebd..d0d735d02 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -175,6 +175,11 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 @@ -637,3 +642,32 @@ const ( PPS_GETCAP = 0x400870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + Seq uint32 + _ uint32 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime int64 + Dtime int64 + Ctime int64 + Segsz uint64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index ab8ec604f..95e3d6d06 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -174,6 +174,11 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 @@ -655,3 +660,33 @@ const ( PPS_GETCAP = 0x800870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index 3ec08237f..cccf1ef26 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -173,6 +173,11 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 @@ -651,3 +656,32 @@ const ( PPS_GETCAP = 0x800870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ uint16 + Seq uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index 23d474470..44fcbe4e9 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -177,6 +177,11 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( SizeofSockaddrNFCLLCP = 0x60 SizeofIovec = 0x10 @@ -632,3 +637,32 @@ const ( PPS_GETCAP = 0x400870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x4000 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ uint16 + Seq uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime int64 + Dtime int64 + Ctime int64 + Segsz uint64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go index 85effef9c..ad4aad279 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go @@ -440,3 +440,43 @@ const ( POLLWRBAND = 0x100 POLLWRNORM = 0x4 ) + +type fileObj struct { + Atim Timespec + Mtim Timespec + Ctim Timespec + Pad [3]uint64 + Name *int8 +} + +type portEvent struct { + Events int32 + Source uint16 + Pad uint16 + Object uint64 + User *byte +} + +const ( + PORT_SOURCE_AIO = 0x1 + PORT_SOURCE_TIMER = 0x2 + PORT_SOURCE_USER = 0x3 + PORT_SOURCE_FD = 0x4 + PORT_SOURCE_ALERT = 0x5 + PORT_SOURCE_MQ = 0x6 + PORT_SOURCE_FILE = 0x7 + PORT_ALERT_SET = 0x1 + PORT_ALERT_UPDATE = 0x2 + PORT_ALERT_INVALID = 0x3 + FILE_ACCESS = 0x1 + FILE_MODIFIED = 0x2 + FILE_ATTRIB = 0x4 + FILE_TRUNC = 0x100000 + FILE_NOFOLLOW = 0x10000000 + FILE_DELETE = 0x10 + FILE_RENAME_TO = 0x20 + FILE_RENAME_FROM = 0x40 + UNMOUNTED = 0x20000000 + MOUNTEDOVER = 0x40000000 + FILE_EXCEPTION = 0x60000070 +) diff --git a/vendor/golang.org/x/sys/windows/memory_windows.go b/vendor/golang.org/x/sys/windows/memory_windows.go index 1adb60739..6dc0920a8 100644 --- a/vendor/golang.org/x/sys/windows/memory_windows.go +++ b/vendor/golang.org/x/sys/windows/memory_windows.go @@ -35,3 +35,14 @@ const ( QUOTA_LIMITS_HARDWS_MAX_DISABLE = 0x00000008 QUOTA_LIMITS_HARDWS_MAX_ENABLE = 0x00000004 ) + +type MemoryBasicInformation struct { + BaseAddress uintptr + AllocationBase uintptr + AllocationProtect uint32 + PartitionId uint16 + RegionSize uintptr + State uint32 + Protect uint32 + Type uint32 +} diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index 111c10d3a..d414ef13b 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -889,6 +889,7 @@ type WTS_SESSION_INFO struct { //sys WTSQueryUserToken(session uint32, token *Token) (err error) = wtsapi32.WTSQueryUserToken //sys WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) = wtsapi32.WTSEnumerateSessionsW //sys WTSFreeMemory(ptr uintptr) = wtsapi32.WTSFreeMemory +//sys WTSGetActiveConsoleSessionId() (sessionID uint32) type ACL struct { aclRevision byte diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 1215b2ae2..d3b59ae69 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -274,6 +274,11 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) = kernel32.VirtualAlloc //sys VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) = kernel32.VirtualFree //sys VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) = kernel32.VirtualProtect +//sys VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect uint32, oldProtect *uint32) (err error) = kernel32.VirtualProtectEx +//sys VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) = kernel32.VirtualQuery +//sys VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) = kernel32.VirtualQueryEx +//sys ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesRead *uintptr) (err error) = kernel32.ReadProcessMemory +//sys WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesWritten *uintptr) (err error) = kernel32.WriteProcessMemory //sys TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) = mswsock.TransmitFile //sys ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) = kernel32.ReadDirectoryChangesW //sys FindFirstChangeNotification(path string, watchSubtree bool, notifyFilter uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.FindFirstChangeNotificationW @@ -398,6 +403,11 @@ func NewCallbackCDecl(fn interface{}) uintptr { // Process Status API (PSAPI) //sys EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) = psapi.EnumProcesses +//sys EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uint32) (err error) = psapi.EnumProcessModules +//sys EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *uint32, filterFlag uint32) (err error) = psapi.EnumProcessModulesEx +//sys GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) = psapi.GetModuleInformation +//sys GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) = psapi.GetModuleFileNameExW +//sys GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) = psapi.GetModuleBaseNameW // NT Native APIs //sys rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) = ntdll.RtlNtStatusToDosErrorNoTeb diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index 1f733398e..02db2ee5e 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -66,9 +66,21 @@ var signals = [...]string{ } const ( - FILE_LIST_DIRECTORY = 0x00000001 - FILE_APPEND_DATA = 0x00000004 + FILE_READ_DATA = 0x00000001 + FILE_READ_ATTRIBUTES = 0x00000080 + FILE_READ_EA = 0x00000008 + FILE_WRITE_DATA = 0x00000002 FILE_WRITE_ATTRIBUTES = 0x00000100 + FILE_WRITE_EA = 0x00000010 + FILE_APPEND_DATA = 0x00000004 + FILE_EXECUTE = 0x00000020 + + FILE_GENERIC_READ = STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE + FILE_GENERIC_WRITE = STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE + FILE_GENERIC_EXECUTE = STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE + + FILE_LIST_DIRECTORY = 0x00000001 + FILE_TRAVERSE = 0x00000020 FILE_SHARE_READ = 0x00000001 FILE_SHARE_WRITE = 0x00000002 @@ -242,6 +254,14 @@ const ( TH32CS_INHERIT = 0x80000000 ) +const ( + // flags for EnumProcessModulesEx + LIST_MODULES_32BIT = 0x01 + LIST_MODULES_64BIT = 0x02 + LIST_MODULES_ALL = 0x03 + LIST_MODULES_DEFAULT = 0x00 +) + const ( // filters for ReadDirectoryChangesW and FindFirstChangeNotificationW FILE_NOTIFY_CHANGE_FILE_NAME = 0x001 @@ -680,7 +700,7 @@ const ( WTD_CHOICE_CERT = 5 WTD_STATEACTION_IGNORE = 0x00000000 - WTD_STATEACTION_VERIFY = 0x00000010 + WTD_STATEACTION_VERIFY = 0x00000001 WTD_STATEACTION_CLOSE = 0x00000002 WTD_STATEACTION_AUTO_CACHE = 0x00000003 WTD_STATEACTION_AUTO_CACHE_FLUSH = 0x00000004 @@ -1781,7 +1801,53 @@ type reparseDataBuffer struct { } const ( - FSCTL_GET_REPARSE_POINT = 0x900A8 + FSCTL_CREATE_OR_GET_OBJECT_ID = 0x0900C0 + FSCTL_DELETE_OBJECT_ID = 0x0900A0 + FSCTL_DELETE_REPARSE_POINT = 0x0900AC + FSCTL_DUPLICATE_EXTENTS_TO_FILE = 0x098344 + FSCTL_DUPLICATE_EXTENTS_TO_FILE_EX = 0x0983E8 + FSCTL_FILESYSTEM_GET_STATISTICS = 0x090060 + FSCTL_FILE_LEVEL_TRIM = 0x098208 + FSCTL_FIND_FILES_BY_SID = 0x09008F + FSCTL_GET_COMPRESSION = 0x09003C + FSCTL_GET_INTEGRITY_INFORMATION = 0x09027C + FSCTL_GET_NTFS_VOLUME_DATA = 0x090064 + FSCTL_GET_REFS_VOLUME_DATA = 0x0902D8 + FSCTL_GET_OBJECT_ID = 0x09009C + FSCTL_GET_REPARSE_POINT = 0x0900A8 + FSCTL_GET_RETRIEVAL_POINTER_COUNT = 0x09042B + FSCTL_GET_RETRIEVAL_POINTERS = 0x090073 + FSCTL_GET_RETRIEVAL_POINTERS_AND_REFCOUNT = 0x0903D3 + FSCTL_IS_PATHNAME_VALID = 0x09002C + FSCTL_LMR_SET_LINK_TRACKING_INFORMATION = 0x1400EC + FSCTL_MARK_HANDLE = 0x0900FC + FSCTL_OFFLOAD_READ = 0x094264 + FSCTL_OFFLOAD_WRITE = 0x098268 + FSCTL_PIPE_PEEK = 0x11400C + FSCTL_PIPE_TRANSCEIVE = 0x11C017 + FSCTL_PIPE_WAIT = 0x110018 + FSCTL_QUERY_ALLOCATED_RANGES = 0x0940CF + FSCTL_QUERY_FAT_BPB = 0x090058 + FSCTL_QUERY_FILE_REGIONS = 0x090284 + FSCTL_QUERY_ON_DISK_VOLUME_INFO = 0x09013C + FSCTL_QUERY_SPARING_INFO = 0x090138 + FSCTL_READ_FILE_USN_DATA = 0x0900EB + FSCTL_RECALL_FILE = 0x090117 + FSCTL_REFS_STREAM_SNAPSHOT_MANAGEMENT = 0x090440 + FSCTL_SET_COMPRESSION = 0x09C040 + FSCTL_SET_DEFECT_MANAGEMENT = 0x098134 + FSCTL_SET_ENCRYPTION = 0x0900D7 + FSCTL_SET_INTEGRITY_INFORMATION = 0x09C280 + FSCTL_SET_INTEGRITY_INFORMATION_EX = 0x090380 + FSCTL_SET_OBJECT_ID = 0x090098 + FSCTL_SET_OBJECT_ID_EXTENDED = 0x0900BC + FSCTL_SET_REPARSE_POINT = 0x0900A4 + FSCTL_SET_SPARSE = 0x0900C4 + FSCTL_SET_ZERO_DATA = 0x0980C8 + FSCTL_SET_ZERO_ON_DEALLOCATION = 0x090194 + FSCTL_SIS_COPYFILE = 0x090100 + FSCTL_WRITE_USN_CLOSE_RECORD = 0x0900EF + MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16 * 1024 IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003 IO_REPARSE_TAG_SYMLINK = 0xA000000C @@ -2773,3 +2839,9 @@ const ( // Flag for QueryFullProcessImageName. const PROCESS_NAME_NATIVE = 1 + +type ModuleInfo struct { + BaseOfDll uintptr + SizeOfImage uint32 + EntryPoint uintptr +} diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index 148de0ffb..4ea788e4c 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -303,6 +303,7 @@ var ( procReadConsoleW = modkernel32.NewProc("ReadConsoleW") procReadDirectoryChangesW = modkernel32.NewProc("ReadDirectoryChangesW") procReadFile = modkernel32.NewProc("ReadFile") + procReadProcessMemory = modkernel32.NewProc("ReadProcessMemory") procReleaseMutex = modkernel32.NewProc("ReleaseMutex") procRemoveDirectoryW = modkernel32.NewProc("RemoveDirectoryW") procResetEvent = modkernel32.NewProc("ResetEvent") @@ -345,11 +346,16 @@ var ( procVirtualFree = modkernel32.NewProc("VirtualFree") procVirtualLock = modkernel32.NewProc("VirtualLock") procVirtualProtect = modkernel32.NewProc("VirtualProtect") + procVirtualProtectEx = modkernel32.NewProc("VirtualProtectEx") + procVirtualQuery = modkernel32.NewProc("VirtualQuery") + procVirtualQueryEx = modkernel32.NewProc("VirtualQueryEx") procVirtualUnlock = modkernel32.NewProc("VirtualUnlock") + procWTSGetActiveConsoleSessionId = modkernel32.NewProc("WTSGetActiveConsoleSessionId") procWaitForMultipleObjects = modkernel32.NewProc("WaitForMultipleObjects") procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject") procWriteConsoleW = modkernel32.NewProc("WriteConsoleW") procWriteFile = modkernel32.NewProc("WriteFile") + procWriteProcessMemory = modkernel32.NewProc("WriteProcessMemory") procAcceptEx = modmswsock.NewProc("AcceptEx") procGetAcceptExSockaddrs = modmswsock.NewProc("GetAcceptExSockaddrs") procTransmitFile = modmswsock.NewProc("TransmitFile") @@ -376,7 +382,12 @@ var ( procCoTaskMemFree = modole32.NewProc("CoTaskMemFree") procCoUninitialize = modole32.NewProc("CoUninitialize") procStringFromGUID2 = modole32.NewProc("StringFromGUID2") + procEnumProcessModules = modpsapi.NewProc("EnumProcessModules") + procEnumProcessModulesEx = modpsapi.NewProc("EnumProcessModulesEx") procEnumProcesses = modpsapi.NewProc("EnumProcesses") + procGetModuleBaseNameW = modpsapi.NewProc("GetModuleBaseNameW") + procGetModuleFileNameExW = modpsapi.NewProc("GetModuleFileNameExW") + procGetModuleInformation = modpsapi.NewProc("GetModuleInformation") procSubscribeServiceChangeNotifications = modsechost.NewProc("SubscribeServiceChangeNotifications") procUnsubscribeServiceChangeNotifications = modsechost.NewProc("UnsubscribeServiceChangeNotifications") procGetUserNameExW = modsecur32.NewProc("GetUserNameExW") @@ -2630,6 +2641,14 @@ func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) ( return } +func ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesRead *uintptr) (err error) { + r1, _, e1 := syscall.Syscall6(procReadProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesRead)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func ReleaseMutex(mutex Handle) (err error) { r1, _, e1 := syscall.Syscall(procReleaseMutex.Addr(), 1, uintptr(mutex), 0, 0) if r1 == 0 { @@ -2984,6 +3003,30 @@ func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect return } +func VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect uint32, oldProtect *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procVirtualProtectEx.Addr(), 5, uintptr(process), uintptr(address), uintptr(size), uintptr(newProtect), uintptr(unsafe.Pointer(oldProtect)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) { + r1, _, e1 := syscall.Syscall(procVirtualQuery.Addr(), 3, uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) { + r1, _, e1 := syscall.Syscall6(procVirtualQueryEx.Addr(), 4, uintptr(process), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func VirtualUnlock(addr uintptr, length uintptr) (err error) { r1, _, e1 := syscall.Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0) if r1 == 0 { @@ -2992,6 +3035,12 @@ func VirtualUnlock(addr uintptr, length uintptr) (err error) { return } +func WTSGetActiveConsoleSessionId() (sessionID uint32) { + r0, _, _ := syscall.Syscall(procWTSGetActiveConsoleSessionId.Addr(), 0, 0, 0, 0) + sessionID = uint32(r0) + return +} + func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) { var _p0 uint32 if waitAll { @@ -3034,6 +3083,14 @@ func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) return } +func WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesWritten *uintptr) (err error) { + r1, _, e1 := syscall.Syscall6(procWriteProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesWritten)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) { r1, _, e1 := syscall.Syscall9(procAcceptEx.Addr(), 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { @@ -3218,6 +3275,22 @@ func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) { return } +func EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procEnumProcessModules.Addr(), 4, uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *uint32, filterFlag uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procEnumProcessModulesEx.Addr(), 5, uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), uintptr(filterFlag), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) { var _p0 *uint32 if len(processIds) > 0 { @@ -3230,6 +3303,30 @@ func EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) { return } +func GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetModuleBaseNameW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(baseName)), uintptr(size), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetModuleFileNameExW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetModuleInformation.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(modinfo)), uintptr(cb), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) { ret = procSubscribeServiceChangeNotifications.Find() if ret != nil { diff --git a/vendor/golang.org/x/term/codereview.cfg b/vendor/golang.org/x/term/codereview.cfg new file mode 100644 index 000000000..3f8b14b64 --- /dev/null +++ b/vendor/golang.org/x/term/codereview.cfg @@ -0,0 +1 @@ +issuerepo: golang/go diff --git a/vendor/golang.org/x/term/go.mod b/vendor/golang.org/x/term/go.mod index bcbe5b5e3..edf0e5b1d 100644 --- a/vendor/golang.org/x/term/go.mod +++ b/vendor/golang.org/x/term/go.mod @@ -2,4 +2,4 @@ module golang.org/x/term go 1.17 -require golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 +require golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 diff --git a/vendor/golang.org/x/term/go.sum b/vendor/golang.org/x/term/go.sum index de9e09c65..ff132135e 100644 --- a/vendor/golang.org/x/term/go.sum +++ b/vendor/golang.org/x/term/go.sum @@ -1,2 +1,2 @@ -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/vendor/golang.org/x/term/term.go b/vendor/golang.org/x/term/term.go index 1f6a38fad..d59270880 100644 --- a/vendor/golang.org/x/term/term.go +++ b/vendor/golang.org/x/term/term.go @@ -12,6 +12,8 @@ // panic(err) // } // defer term.Restore(int(os.Stdin.Fd()), oldState) +// +// Note that on non-Unix systems os.Stdin.Fd() may not be 0. package term // State contains the state of a terminal. diff --git a/vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/AUTHORS b/vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/AUTHORS new file mode 100644 index 000000000..e640b0bf5 --- /dev/null +++ b/vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/AUTHORS @@ -0,0 +1,3 @@ +This is the complete list of go-patricia copyright holders: + +Ondřej Kupka diff --git a/vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/LICENSE b/vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/LICENSE new file mode 100644 index 000000000..e50d398e9 --- /dev/null +++ b/vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 The AUTHORS + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/patricia/children.go b/vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/patricia/children.go new file mode 100644 index 000000000..b1e4e63c4 --- /dev/null +++ b/vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/patricia/children.go @@ -0,0 +1,182 @@ +// Copyright (c) 2014 The go-patricia AUTHORS +// +// Use of this source code is governed by The MIT License +// that can be found in the LICENSE file. + +package patricia + +import ( + "io" + "sort" +) + +type childList interface { + length() int + head() *Trie + add(child *Trie) childList + remove(b byte) + replace(b byte, child *Trie) + next(b byte) *Trie + combinedMask() uint64 + getChildren() []*Trie + walk(prefix *Prefix, visitor VisitorFunc) error + print(w io.Writer, indent int) + clone() childList + total() int +} + +type tries []*Trie + +func (t tries) Len() int { + return len(t) +} + +func (t tries) Less(i, j int) bool { + strings := sort.StringSlice{string(t[i].prefix), string(t[j].prefix)} + return strings.Less(0, 1) +} + +func (t tries) Swap(i, j int) { + t[i], t[j] = t[j], t[i] +} + +type childContainer struct { + char byte + node *Trie +} +type superDenseChildList struct { + children []childContainer +} + +func newSuperDenseChildList() childList { + return &superDenseChildList{ + make([]childContainer, 0), + } +} + +func (list *superDenseChildList) length() int { + return len(list.children) +} + +func (list *superDenseChildList) head() *Trie { + if len(list.children) > 0 { + return list.children[0].node + } + return nil +} + +func (list *superDenseChildList) add(child *Trie) childList { + char := child.prefix[0] + list.children = append(list.children, childContainer{ + char, + child, + }) + return list +} + +func (list *superDenseChildList) remove(b byte) { + children := list.children + for i := 0; i < len(children); i++ { + if children[i].char == b { + // children[i] = children[len(children)-1] + // children = children[:len(children)-1] + // children = append(children[:i], children[i+1:]...) + newChildren := make([]childContainer, len(children)-1) + // copy the elements over to avoid "memory leaks" + copy(newChildren, children[:i]) + copy(newChildren[i:], children[i+1:]) + list.children = newChildren + + // list.children = make([]childContainer, len(children)) + // copy(list.children, children) + // children = nil + + return + } + } +} + +func (list *superDenseChildList) replace(b byte, child *Trie) { + children := list.children + for i := 0; i < len(list.children); i++ { + if children[i].char == b { + children[i].node = child + return + } + } +} + +func (list *superDenseChildList) next(b byte) *Trie { + children := list.children + for i := 0; i < len(list.children); i++ { + if children[i].char == b { + return children[i].node + } + } + return nil +} + +func (list superDenseChildList) combinedMask() uint64 { + var mask uint64 + for _, child := range list.children { + // fmt.Printf("child = %+v\n", child) + mask |= child.node.mask + } + return mask +} + +func (list *superDenseChildList) getChildren() []*Trie { + children := make([]*Trie, 0, len(list.children)) + for _, child := range list.children { + children = append(children, child.node) + } + return children +} + +func (list *superDenseChildList) walk(prefix *Prefix, visitor VisitorFunc) error { + for _, child := range list.children { + node := child.node + *prefix = append(*prefix, node.prefix...) + if node.item != nil { + if err := visitor(*prefix, node.item); err != nil { + if err == SkipSubtree { + *prefix = (*prefix)[:len(*prefix)-len(node.prefix)] + continue + } + *prefix = (*prefix)[:len(*prefix)-len(node.prefix)] + return err + } + } + + err := node.children.walk(prefix, visitor) + *prefix = (*prefix)[:len(*prefix)-len(node.prefix)] + if err != nil { + return err + } + } + + return nil +} + +func (list *superDenseChildList) print(w io.Writer, indent int) { + for _, child := range list.children { + child.node.print(w, indent) + } +} + +func (list *superDenseChildList) clone() childList { + clones := make([]childContainer, len(list.children)) + + for i := 0; i < len(list.children); i++ { + child := list.children[i] + clones[i] = childContainer{child.char, child.node.Clone()} + } + + return &superDenseChildList{ + clones, + } +} + +func (list *superDenseChildList) total() int { + return len(list.children) +} diff --git a/vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/patricia/patricia.go b/vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/patricia/patricia.go new file mode 100644 index 000000000..7695ca79a --- /dev/null +++ b/vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/patricia/patricia.go @@ -0,0 +1,892 @@ +// Copyright (c) 2014 The go-patricia AUTHORS +// +// Use of this source code is governed by The MIT License +// that can be found in the LICENSE file. + +package patricia + +import ( + "bytes" + "errors" + "fmt" + "io" + "strings" +) + +//------------------------------------------------------------------------------ +// Trie +//------------------------------------------------------------------------------ + +const ( + defaultMaxPrefixPerNode = 10 +) + +var ( + maxPrefixPerNode = defaultMaxPrefixPerNode +) + +type ( + // Prefix is the type of node prefixes + Prefix []byte + // Item is just interface{} + Item interface{} + // VisitorFunc is the type of functions passed to visit function + VisitorFunc func(prefix Prefix, item Item) error + // FuzzyVisitorFunc additionaly returns how many characters were skipped which can be sorted on + FuzzyVisitorFunc func(prefix Prefix, item Item, skipped int) error +) + +// Trie is a generic patricia trie that allows fast retrieval of items by prefix. +// and other funky stuff. +// +// Trie is not thread-safe. +type Trie struct { + prefix Prefix + item Item + mask uint64 + + children childList +} + +// Public API ------------------------------------------------------------------ + +// NewTrie constructs a new trie. +func NewTrie() *Trie { + trie := &Trie{} + + trie.children = newSuperDenseChildList() + + trie.mask = 0 + return trie +} + +// SetMaxPrefixPerNode sets the maximum length of a prefix before it is split into two nodes +func SetMaxPrefixPerNode(value int) { + maxPrefixPerNode = value +} + +// Clone makes a copy of an existing trie. +// Items stored in both tries become shared, obviously. +func (trie *Trie) Clone() *Trie { + return &Trie{ + prefix: append(Prefix(nil), trie.prefix...), + item: trie.item, + children: trie.children.clone(), + } +} + +// Item returns the item stored in the root of this trie. +func (trie *Trie) Item() Item { + return trie.item +} + +// Insert inserts a new item into the trie using the given prefix. Insert does +// not replace existing items. It returns false if an item was already in place. +func (trie *Trie) Insert(key Prefix, item Item) (inserted bool) { + return trie.put(key, item, false) +} + +// Set works much like Insert, but it always sets the item, possibly replacing +// the item previously inserted. +func (trie *Trie) Set(key Prefix, item Item) { + trie.put(key, item, true) +} + +// Get returns the item located at key. +// +// This method is a bit dangerous, because Get can as well end up in an internal +// node that is not really representing any user-defined value. So when nil is +// a valid value being used, it is not possible to tell if the value was inserted +// into the tree by the user or not. A possible workaround for this is not to use +// nil interface as a valid value, even using zero value of any type is enough +// to prevent this bad behaviour. +func (trie *Trie) Get(key Prefix) (item Item) { + _, node, found, leftover := trie.findSubtree(key) + if !found || len(leftover) != 0 { + return nil + } + return node.item +} + +// Match returns what Get(prefix) != nil would return. The same warning as for +// Get applies here as well. +func (trie *Trie) Match(prefix Prefix) (matchedExactly bool) { + return trie.Get(prefix) != nil +} + +// MatchSubtree returns true when there is a subtree representing extensions +// to key, that is if there are any keys in the tree which have key as prefix. +func (trie *Trie) MatchSubtree(key Prefix) (matched bool) { + _, _, matched, _ = trie.findSubtree(key) + return +} + +// Visit calls visitor on every node containing a non-nil item +// in alphabetical order. +// +// If an error is returned from visitor, the function stops visiting the tree +// and returns that error, unless it is a special error - SkipSubtree. In that +// case Visit skips the subtree represented by the current node and continues +// elsewhere. +func (trie *Trie) Visit(visitor VisitorFunc) error { + return trie.walk(nil, visitor) +} + +func (trie *Trie) size() int { + n := 0 + + err := trie.walk(nil, func(prefix Prefix, item Item) error { + n++ + return nil + }) + + if err != nil { + panic(err) + } + + return n +} + +func (trie *Trie) total() int { + return 1 + trie.children.total() +} + +// VisitSubtree works much like Visit, but it only visits nodes matching prefix. +func (trie *Trie) VisitSubtree(prefix Prefix, visitor VisitorFunc) error { + // Nil prefix not allowed. + if prefix == nil { + panic(ErrNilPrefix) + } + + // Empty trie must be handled explicitly. + if trie.prefix == nil { + return nil + } + + // Locate the relevant subtree. + _, root, found, leftover := trie.findSubtree(prefix) + if !found { + return nil + } + prefix = append(prefix, leftover...) + + // Visit it. + return root.walk(prefix, visitor) +} + +type potentialSubtree struct { + idx int + skipped int + prefix Prefix + node *Trie +} + +// VisitFuzzy visits every node that is succesfully matched via fuzzy matching +func (trie *Trie) VisitFuzzy(partial Prefix, caseInsensitive bool, visitor FuzzyVisitorFunc) error { + if len(partial) == 0 { + return trie.VisitPrefixes(partial, caseInsensitive, func(prefix Prefix, item Item) error { + return visitor(prefix, item, 0) + }) + } + + var ( + m uint64 + cmp uint64 + i int + p potentialSubtree + ) + + potential := []potentialSubtree{potentialSubtree{node: trie, prefix: Prefix(""), idx: 0}} + for l := len(potential); l > 0; l = len(potential) { + i = l - 1 + p = potential[i] + + potential = potential[:i] + m = makePrefixMask(partial[p.idx:]) + + if caseInsensitive { + cmp = caseInsensitiveMask(p.node.mask) + } else { + cmp = p.node.mask + } + + if (cmp & m) != m { + continue + } + + matchCount, skipped := fuzzyMatchCount(p.node.prefix, + partial[p.idx:], p.idx, caseInsensitive) + p.idx += matchCount + if p.idx != 0 { + p.skipped += skipped + } + + if p.idx == len(partial) { + fullPrefix := append(p.prefix, p.node.prefix...) + + err := p.node.walk(Prefix(""), func(prefix Prefix, item Item) error { + key := make([]byte, len(fullPrefix), len(fullPrefix)+len(prefix)) + copy(key, fullPrefix) + key = append(key, prefix...) + + err := visitor(key, item, p.skipped) + if err != nil { + return err + } + + return nil + }) + if err != nil { + return err + } + + continue + } + + for _, c := range p.node.children.getChildren() { + if c != nil { + newPrefix := make(Prefix, len(p.prefix), len(p.prefix)+len(p.node.prefix)) + copy(newPrefix, p.prefix) + newPrefix = append(newPrefix, p.node.prefix...) + potential = append(potential, potentialSubtree{ + node: c, + prefix: newPrefix, + idx: p.idx, + skipped: p.skipped, + }) + } else { + fmt.Println("warning, child isn il") + } + } + } + + return nil +} + +func fuzzyMatchCount(prefix, query Prefix, idx int, caseInsensitive bool) (count, skipped int) { + for i := 0; i < len(prefix); i++ { + var match bool + + if caseInsensitive { + match = matchCaseInsensitive(prefix[i], query[count]) + } else { + match = prefix[i] == query[count] + } + + if !match { + if count+idx > 0 { + skipped++ + } + continue + } + + count++ + if count >= len(query) { + return + } + } + return +} + +// VisitSubstring takes a substring and visits all the nodes that whos prefix contains this substring +func (trie *Trie) VisitSubstring(substring Prefix, caseInsensitive bool, visitor VisitorFunc) error { + if len(substring) == 0 { + return trie.VisitSubtree(substring, visitor) + } + + var ( + m uint64 + cmp uint64 + i int + p potentialSubtree + suffixLen int + maxSuffixLen = len(substring) - 1 + ) + + potential := []potentialSubtree{potentialSubtree{node: trie, prefix: nil}} + for l := len(potential); l > 0; l = len(potential) { + i = l - 1 + p = potential[i] + + potential = potential[:i] + + if len(p.prefix) < maxSuffixLen { + suffixLen = len(p.prefix) + } else { + suffixLen = maxSuffixLen + } + + searchBytes := append(p.prefix[len(p.prefix)-suffixLen:], p.node.prefix...) + + contains := false + + if caseInsensitive { + contains = bytes.Contains(bytes.ToUpper(searchBytes), bytes.ToUpper(substring)) + } else { + contains = bytes.Contains(searchBytes, substring) + } + + if contains { + fullPrefix := append(p.prefix, p.node.prefix...) + err := p.node.walk(Prefix(""), func(prefix Prefix, item Item) error { + key := make([]byte, len(fullPrefix), len(fullPrefix)+len(prefix)) + copy(key, fullPrefix) + key = append(key, prefix...) + copy(key, append(fullPrefix, prefix...)) + + err := visitor(key, item) + if err != nil { + return err + } + + return nil + }) + if err != nil { + return err + } + } + + newPrefix := make(Prefix, len(p.prefix), len(p.prefix)+len(p.node.prefix)) + copy(newPrefix, p.prefix) + newPrefix = append(newPrefix, p.node.prefix...) + + overLap := overlapLength(newPrefix, substring, caseInsensitive) + m = makePrefixMask(substring[overLap:]) + + for _, c := range p.node.children.getChildren() { + if caseInsensitive { + cmp = caseInsensitiveMask(c.mask) + } else { + cmp = c.mask + } + if c != nil && (cmp&m == m) { + potential = append(potential, potentialSubtree{ + node: c, + prefix: newPrefix, + }) + } + } + } + + return nil +} + +func overlapLength(prefix, query Prefix, caseInsensitive bool) int { + startLength := len(query) - 1 + if len(prefix) < startLength { + startLength = len(prefix) + } + for i := startLength; i > 0; i-- { + suffix := prefix[len(prefix)-i:] + queryPrefix := query[:i] + if caseInsensitive { + if bytes.EqualFold(suffix, queryPrefix) { + return i + } + } else if bytes.Equal(suffix, queryPrefix) { + return i + } + } + + return 0 +} + +// VisitPrefixes visits only nodes that represent prefixes of key. +// To say the obvious, returning SkipSubtree from visitor makes no sense here. +func (trie *Trie) VisitPrefixes(key Prefix, caseInsensitive bool, visitor VisitorFunc) error { + // Nil key not allowed. + if key == nil { + panic(ErrNilPrefix) + } + + // Empty trie must be handled explicitly. + if trie.prefix == nil { + return nil + } + + // Walk the path matching key prefixes. + node := trie + prefix := key + offset := 0 + for { + // Compute what part of prefix matches. + common := node.longestCommonPrefixLength(key, caseInsensitive) + key = key[common:] + offset += common + + // Partial match means that there is no subtree matching prefix. + if common < len(node.prefix) { + return nil + } + + // Call the visitor. + if item := node.item; item != nil { + if err := visitor(prefix[:offset], item); err != nil { + return err + } + } + + if len(key) == 0 { + // This node represents key, we are finished. + return nil + } + + // There is some key suffix left, move to the children. + child := node.children.next(key[0]) + if child == nil { + // There is nowhere to continue, return. + return nil + } + + node = child + } +} + +// Delete deletes the item represented by the given prefix. +// +// True is returned if the matching node was found and deleted. +func (trie *Trie) Delete(key Prefix) (deleted bool) { + // Nil prefix not allowed. + if key == nil { + panic(ErrNilPrefix) + } + + // Empty trie must be handled explicitly. + if trie.prefix == nil { + return false + } + + // Find the relevant node. + path, found, _ := trie.findSubtreePath(key) + if !found { + return false + } + + node := path[len(path)-1] + var parent *Trie + if len(path) != 1 { + parent = path[len(path)-2] + } + + // If the item is already set to nil, there is nothing to do. + if node.item == nil { + return false + } + + // Delete the item. + node.item = nil + + // Initialise i before goto. + // Will be used later in a loop. + i := len(path) - 1 + + // In case there are some child nodes, we cannot drop the whole subtree. + // We can try to compact nodes, though. + if node.children.length() != 0 { + goto Compact + } + + // In case we are at the root, just reset it and we are done. + if parent == nil { + node.reset() + return true + } + + // We can drop a subtree. + // Find the first ancestor that has its value set or it has 2 or more child nodes. + // That will be the node where to drop the subtree at. + for ; i >= 0; i-- { + if current := path[i]; current.item != nil || current.children.length() >= 2 { + break + } + } + + // Handle the case when there is no such node. + // In other words, we can reset the whole tree. + if i == -1 { + path[0].reset() + return true + } + + // We can just remove the subtree here. + node = path[i] + if i == 0 { + parent = nil + } else { + parent = path[i-1] + } + // i+1 is always a valid index since i is never pointing to the last node. + // The loop above skips at least the last node since we are sure that the item + // is set to nil and it has no children, othewise we would be compacting instead. + node.children.remove(path[i+1].prefix[0]) + + // lastly, the bitmasks of all of the parent nodes have to be updated again, since + // a child node of all of them has bin removed + for ; i >= 0; i-- { + n := path[i] + n.mask = n.children.combinedMask() + } + +Compact: + // The node is set to the first non-empty ancestor, + // so try to compact since that might be possible now. + if compacted := node.compact(); compacted != node { + if parent == nil { + *node = *compacted + } else { + parent.children.replace(node.prefix[0], compacted) + *parent = *parent.compact() + } + } + + return true +} + +// DeleteSubtree finds the subtree exactly matching prefix and deletes it. +// +// True is returned if the subtree was found and deleted. +func (trie *Trie) DeleteSubtree(prefix Prefix) (deleted bool) { + // Nil prefix not allowed. + if prefix == nil { + panic(ErrNilPrefix) + } + + // Empty trie must be handled explicitly. + if trie.prefix == nil { + return false + } + + // Locate the relevant subtree. + parent, root, found, _ := trie.findSubtree(prefix) + path, _, _ := trie.findSubtreePath(prefix) + if !found { + return false + } + + // If we are in the root of the trie, reset the trie. + if parent == nil { + root.reset() + return true + } + + // Otherwise remove the root node from its parent. + parent.children.remove(root.prefix[0]) + + // update masks + parent.mask = parent.children.combinedMask() + for i := len(path) - 1; i >= 0; i-- { + n := path[i] + n.mask = n.children.combinedMask() + } + + return true +} + +// Internal helper methods ----------------------------------------------------- + +func (trie *Trie) empty() bool { + return trie.item == nil && trie.children.length() == 0 +} + +func (trie *Trie) reset() { + trie.prefix = nil + trie.children = newSuperDenseChildList() +} + +func makePrefixMask(key Prefix) uint64 { + var mask uint64 + for _, b := range key { + if b >= '0' && b <= '9' { + // 0-9 bits: 0-9 + b -= 48 + } else if b >= 'A' && b <= 'Z' { + // A-Z bits: 10-35 + b -= 55 + } else if b >= 'a' && b <= 'z' { + // a-z bits: 36-61 + b -= 61 + } else if b == '.' { + b = 62 + } else if b == '-' { + b = 63 + } else { + continue + } + mask |= uint64(1) << uint64(b) + } + return mask +} + +const upperBits = 0xFFFFFFC00 +const lowerBits = 0x3FFFFFF000000000 + +func caseInsensitiveMask(mask uint64) uint64 { + mask |= (mask & upperBits) << uint64(26) + mask |= (mask & lowerBits) >> uint64(26) + return mask +} + +var charmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-" + +func (trie *Trie) put(key Prefix, item Item, replace bool) (inserted bool) { + // Nil prefix not allowed. + if key == nil { + panic(ErrNilPrefix) + } + + var ( + common int + node = trie + child *Trie + mask uint64 + ) + + mask = makePrefixMask(key) + + if node.prefix == nil { + node.mask |= mask + if len(key) <= maxPrefixPerNode { + node.prefix = key + goto InsertItem + } + node.prefix = key[:maxPrefixPerNode] + key = key[maxPrefixPerNode:] + mask = makePrefixMask(key) + goto AppendChild + } + + for { + // Compute the longest common prefix length. + common = node.longestCommonPrefixLength(key, false) + key = key[common:] + + // Only a part matches, split. + if common < len(node.prefix) { + goto SplitPrefix + } + + // common == len(node.prefix) since never (common > len(node.prefix)) + // common == len(former key) <-> 0 == len(key) + // -> former key == node.prefix + if len(key) == 0 { + goto InsertItem + } + + node.mask |= mask + // Check children for matching prefix. + child = node.children.next(key[0]) + if child == nil { + goto AppendChild + } + node = child + } + +SplitPrefix: + // Split the prefix if necessary. + child = new(Trie) + *child = *node + *node = *NewTrie() + node.prefix = child.prefix[:common] + child.prefix = child.prefix[common:] + child = child.compact() + node.children = node.children.add(child) + node.mask = child.mask + node.mask |= mask + mask = makePrefixMask(key) + +AppendChild: + // Keep appending children until whole prefix is inserted. + // This loop starts with empty node.prefix that needs to be filled. + for len(key) != 0 { + child := NewTrie() + child.mask = mask + if len(key) <= maxPrefixPerNode { + child.prefix = key + node.children = node.children.add(child) + node = child + goto InsertItem + } else { + child.prefix = key[:maxPrefixPerNode] + key = key[maxPrefixPerNode:] + mask = makePrefixMask(key) + node.children = node.children.add(child) + node = child + } + } + +InsertItem: + // Try to insert the item if possible. + if replace || node.item == nil { + node.item = item + return true + } + return false +} + +func (trie *Trie) compact() *Trie { + // Only a node with a single child can be compacted. + if trie.children.length() != 1 { + return trie + } + + child := trie.children.head() + + // If any item is set, we cannot compact since we want to retain + // the ability to do searching by key. This makes compaction less usable, + // but that simply cannot be avoided. + if trie.item != nil || child.item != nil { + return trie + } + + // Make sure the combined prefixes fit into a single node. + if len(trie.prefix)+len(child.prefix) > maxPrefixPerNode { + return trie + } + + // Concatenate the prefixes, move the items. + child.prefix = append(trie.prefix, child.prefix...) + child.mask = trie.mask + if trie.item != nil { + child.item = trie.item + } + + return child +} + +func (trie *Trie) findSubtree(prefix Prefix) (parent *Trie, root *Trie, found bool, leftover Prefix) { + // Find the subtree matching prefix. + root = trie + for { + // Compute what part of prefix matches. + common := root.longestCommonPrefixLength(prefix, false) + prefix = prefix[common:] + + // We used up the whole prefix, subtree found. + if len(prefix) == 0 { + found = true + leftover = root.prefix[common:] + return + } + + // Partial match means that there is no subtree matching prefix. + if common < len(root.prefix) { + leftover = root.prefix[common:] + return + } + + // There is some prefix left, move to the children. + child := root.children.next(prefix[0]) + if child == nil { + // There is nowhere to continue, there is no subtree matching prefix. + return + } + + parent = root + root = child + } +} + +func (trie *Trie) findSubtreePath(prefix Prefix) (path []*Trie, found bool, leftover Prefix) { + // Find the subtree matching prefix. + root := trie + var subtreePath []*Trie + for { + // Append the current root to the path. + subtreePath = append(subtreePath, root) + + // Compute what part of prefix matches. + common := root.longestCommonPrefixLength(prefix, false) + prefix = prefix[common:] + + // We used up the whole prefix, subtree found. + if len(prefix) == 0 { + path = subtreePath + found = true + leftover = root.prefix[common:] + return + } + + // Partial match means that there is no subtree matching prefix. + if common < len(root.prefix) { + leftover = root.prefix[common:] + return + } + + // There is some prefix left, move to the children. + child := root.children.next(prefix[0]) + if child == nil { + // There is nowhere to continue, there is no subtree matching prefix. + return + } + + root = child + } +} + +func (trie *Trie) walk(actualRootPrefix Prefix, visitor VisitorFunc) error { + var prefix Prefix + // Allocate a bit more space for prefix at the beginning. + if actualRootPrefix == nil { + prefix = make(Prefix, 32+len(trie.prefix)) + copy(prefix, trie.prefix) + prefix = prefix[:len(trie.prefix)] + } else { + prefix = make(Prefix, 32+len(actualRootPrefix)) + copy(prefix, actualRootPrefix) + prefix = prefix[:len(actualRootPrefix)] + } + + // Visit the root first. Not that this works for empty trie as well since + // in that case item == nil && len(children) == 0. + if trie.item != nil { + if err := visitor(prefix, trie.item); err != nil { + if err == SkipSubtree { + return nil + } + return err + } + } + + // Then continue to the children. + return trie.children.walk(&prefix, visitor) +} + +func (trie *Trie) longestCommonPrefixLength(prefix Prefix, caseInsensitive bool) (i int) { + for ; i < len(prefix) && i < len(trie.prefix); i++ { + p := prefix[i] + t := trie.prefix[i] + + if caseInsensitive { + if !(matchCaseInsensitive(t, p)) { + break + } + } else { + if p != t { + break + } + } + } + return +} + +func matchCaseInsensitive(a byte, b byte) bool { + return a == b+32 || b == a+32 || a == b +} + +func (trie *Trie) dump() string { + writer := &bytes.Buffer{} + trie.print(writer, 0) + return writer.String() +} + +func (trie *Trie) print(writer io.Writer, indent int) { + fmt.Fprintf(writer, "%s%s %v\n", strings.Repeat(" ", indent), string(trie.prefix), trie.item) + trie.children.print(writer, indent+2) +} + +// Errors ---------------------------------------------------------------------- + +var ( + SkipSubtree = errors.New("Skip this subtree") + ErrNilPrefix = errors.New("Nil prefix passed into a method call") +) diff --git a/vendor/gopkg.in/yaml.v2/LICENSE b/vendor/gopkg.in/yaml.v2/LICENSE deleted file mode 100644 index 8dada3eda..000000000 --- a/vendor/gopkg.in/yaml.v2/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/gopkg.in/yaml.v2/encode.go b/vendor/gopkg.in/yaml.v2/encode.go deleted file mode 100644 index 0ee738e11..000000000 --- a/vendor/gopkg.in/yaml.v2/encode.go +++ /dev/null @@ -1,390 +0,0 @@ -package yaml - -import ( - "encoding" - "fmt" - "io" - "reflect" - "regexp" - "sort" - "strconv" - "strings" - "time" - "unicode/utf8" -) - -// jsonNumber is the interface of the encoding/json.Number datatype. -// Repeating the interface here avoids a dependency on encoding/json, and also -// supports other libraries like jsoniter, which use a similar datatype with -// the same interface. Detecting this interface is useful when dealing with -// structures containing json.Number, which is a string under the hood. The -// encoder should prefer the use of Int64(), Float64() and string(), in that -// order, when encoding this type. -type jsonNumber interface { - Float64() (float64, error) - Int64() (int64, error) - String() string -} - -type encoder struct { - emitter yaml_emitter_t - event yaml_event_t - out []byte - flow bool - // doneInit holds whether the initial stream_start_event has been - // emitted. - doneInit bool -} - -func newEncoder() *encoder { - e := &encoder{} - yaml_emitter_initialize(&e.emitter) - yaml_emitter_set_output_string(&e.emitter, &e.out) - yaml_emitter_set_unicode(&e.emitter, true) - return e -} - -func newEncoderWithWriter(w io.Writer) *encoder { - e := &encoder{} - yaml_emitter_initialize(&e.emitter) - yaml_emitter_set_output_writer(&e.emitter, w) - yaml_emitter_set_unicode(&e.emitter, true) - return e -} - -func (e *encoder) init() { - if e.doneInit { - return - } - yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING) - e.emit() - e.doneInit = true -} - -func (e *encoder) finish() { - e.emitter.open_ended = false - yaml_stream_end_event_initialize(&e.event) - e.emit() -} - -func (e *encoder) destroy() { - yaml_emitter_delete(&e.emitter) -} - -func (e *encoder) emit() { - // This will internally delete the e.event value. - e.must(yaml_emitter_emit(&e.emitter, &e.event)) -} - -func (e *encoder) must(ok bool) { - if !ok { - msg := e.emitter.problem - if msg == "" { - msg = "unknown problem generating YAML content" - } - failf("%s", msg) - } -} - -func (e *encoder) marshalDoc(tag string, in reflect.Value) { - e.init() - yaml_document_start_event_initialize(&e.event, nil, nil, true) - e.emit() - e.marshal(tag, in) - yaml_document_end_event_initialize(&e.event, true) - e.emit() -} - -func (e *encoder) marshal(tag string, in reflect.Value) { - if !in.IsValid() || in.Kind() == reflect.Ptr && in.IsNil() { - e.nilv() - return - } - iface := in.Interface() - switch m := iface.(type) { - case jsonNumber: - integer, err := m.Int64() - if err == nil { - // In this case the json.Number is a valid int64 - in = reflect.ValueOf(integer) - break - } - float, err := m.Float64() - if err == nil { - // In this case the json.Number is a valid float64 - in = reflect.ValueOf(float) - break - } - // fallback case - no number could be obtained - in = reflect.ValueOf(m.String()) - case time.Time, *time.Time: - // Although time.Time implements TextMarshaler, - // we don't want to treat it as a string for YAML - // purposes because YAML has special support for - // timestamps. - case Marshaler: - v, err := m.MarshalYAML() - if err != nil { - fail(err) - } - if v == nil { - e.nilv() - return - } - in = reflect.ValueOf(v) - case encoding.TextMarshaler: - text, err := m.MarshalText() - if err != nil { - fail(err) - } - in = reflect.ValueOf(string(text)) - case nil: - e.nilv() - return - } - switch in.Kind() { - case reflect.Interface: - e.marshal(tag, in.Elem()) - case reflect.Map: - e.mapv(tag, in) - case reflect.Ptr: - if in.Type() == ptrTimeType { - e.timev(tag, in.Elem()) - } else { - e.marshal(tag, in.Elem()) - } - case reflect.Struct: - if in.Type() == timeType { - e.timev(tag, in) - } else { - e.structv(tag, in) - } - case reflect.Slice, reflect.Array: - if in.Type().Elem() == mapItemType { - e.itemsv(tag, in) - } else { - e.slicev(tag, in) - } - case reflect.String: - e.stringv(tag, in) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - if in.Type() == durationType { - e.stringv(tag, reflect.ValueOf(iface.(time.Duration).String())) - } else { - e.intv(tag, in) - } - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - e.uintv(tag, in) - case reflect.Float32, reflect.Float64: - e.floatv(tag, in) - case reflect.Bool: - e.boolv(tag, in) - default: - panic("cannot marshal type: " + in.Type().String()) - } -} - -func (e *encoder) mapv(tag string, in reflect.Value) { - e.mappingv(tag, func() { - keys := keyList(in.MapKeys()) - sort.Sort(keys) - for _, k := range keys { - e.marshal("", k) - e.marshal("", in.MapIndex(k)) - } - }) -} - -func (e *encoder) itemsv(tag string, in reflect.Value) { - e.mappingv(tag, func() { - slice := in.Convert(reflect.TypeOf([]MapItem{})).Interface().([]MapItem) - for _, item := range slice { - e.marshal("", reflect.ValueOf(item.Key)) - e.marshal("", reflect.ValueOf(item.Value)) - } - }) -} - -func (e *encoder) structv(tag string, in reflect.Value) { - sinfo, err := getStructInfo(in.Type()) - if err != nil { - panic(err) - } - e.mappingv(tag, func() { - for _, info := range sinfo.FieldsList { - var value reflect.Value - if info.Inline == nil { - value = in.Field(info.Num) - } else { - value = in.FieldByIndex(info.Inline) - } - if info.OmitEmpty && isZero(value) { - continue - } - e.marshal("", reflect.ValueOf(info.Key)) - e.flow = info.Flow - e.marshal("", value) - } - if sinfo.InlineMap >= 0 { - m := in.Field(sinfo.InlineMap) - if m.Len() > 0 { - e.flow = false - keys := keyList(m.MapKeys()) - sort.Sort(keys) - for _, k := range keys { - if _, found := sinfo.FieldsMap[k.String()]; found { - panic(fmt.Sprintf("Can't have key %q in inlined map; conflicts with struct field", k.String())) - } - e.marshal("", k) - e.flow = false - e.marshal("", m.MapIndex(k)) - } - } - } - }) -} - -func (e *encoder) mappingv(tag string, f func()) { - implicit := tag == "" - style := yaml_BLOCK_MAPPING_STYLE - if e.flow { - e.flow = false - style = yaml_FLOW_MAPPING_STYLE - } - yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style) - e.emit() - f() - yaml_mapping_end_event_initialize(&e.event) - e.emit() -} - -func (e *encoder) slicev(tag string, in reflect.Value) { - implicit := tag == "" - style := yaml_BLOCK_SEQUENCE_STYLE - if e.flow { - e.flow = false - style = yaml_FLOW_SEQUENCE_STYLE - } - e.must(yaml_sequence_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)) - e.emit() - n := in.Len() - for i := 0; i < n; i++ { - e.marshal("", in.Index(i)) - } - e.must(yaml_sequence_end_event_initialize(&e.event)) - e.emit() -} - -// isBase60 returns whether s is in base 60 notation as defined in YAML 1.1. -// -// The base 60 float notation in YAML 1.1 is a terrible idea and is unsupported -// in YAML 1.2 and by this package, but these should be marshalled quoted for -// the time being for compatibility with other parsers. -func isBase60Float(s string) (result bool) { - // Fast path. - if s == "" { - return false - } - c := s[0] - if !(c == '+' || c == '-' || c >= '0' && c <= '9') || strings.IndexByte(s, ':') < 0 { - return false - } - // Do the full match. - return base60float.MatchString(s) -} - -// From http://yaml.org/type/float.html, except the regular expression there -// is bogus. In practice parsers do not enforce the "\.[0-9_]*" suffix. -var base60float = regexp.MustCompile(`^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+(?:\.[0-9_]*)?$`) - -func (e *encoder) stringv(tag string, in reflect.Value) { - var style yaml_scalar_style_t - s := in.String() - canUsePlain := true - switch { - case !utf8.ValidString(s): - if tag == yaml_BINARY_TAG { - failf("explicitly tagged !!binary data must be base64-encoded") - } - if tag != "" { - failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag)) - } - // It can't be encoded directly as YAML so use a binary tag - // and encode it as base64. - tag = yaml_BINARY_TAG - s = encodeBase64(s) - case tag == "": - // Check to see if it would resolve to a specific - // tag when encoded unquoted. If it doesn't, - // there's no need to quote it. - rtag, _ := resolve("", s) - canUsePlain = rtag == yaml_STR_TAG && !isBase60Float(s) - } - // Note: it's possible for user code to emit invalid YAML - // if they explicitly specify a tag and a string containing - // text that's incompatible with that tag. - switch { - case strings.Contains(s, "\n"): - style = yaml_LITERAL_SCALAR_STYLE - case canUsePlain: - style = yaml_PLAIN_SCALAR_STYLE - default: - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - e.emitScalar(s, "", tag, style) -} - -func (e *encoder) boolv(tag string, in reflect.Value) { - var s string - if in.Bool() { - s = "true" - } else { - s = "false" - } - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) intv(tag string, in reflect.Value) { - s := strconv.FormatInt(in.Int(), 10) - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) uintv(tag string, in reflect.Value) { - s := strconv.FormatUint(in.Uint(), 10) - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) timev(tag string, in reflect.Value) { - t := in.Interface().(time.Time) - s := t.Format(time.RFC3339Nano) - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) floatv(tag string, in reflect.Value) { - // Issue #352: When formatting, use the precision of the underlying value - precision := 64 - if in.Kind() == reflect.Float32 { - precision = 32 - } - - s := strconv.FormatFloat(in.Float(), 'g', -1, precision) - switch s { - case "+Inf": - s = ".inf" - case "-Inf": - s = "-.inf" - case "NaN": - s = ".nan" - } - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) nilv() { - e.emitScalar("null", "", "", yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) emitScalar(value, anchor, tag string, style yaml_scalar_style_t) { - implicit := tag == "" - e.must(yaml_scalar_event_initialize(&e.event, []byte(anchor), []byte(tag), []byte(value), implicit, implicit, style)) - e.emit() -} diff --git a/vendor/gopkg.in/yaml.v2/writerc.go b/vendor/gopkg.in/yaml.v2/writerc.go deleted file mode 100644 index a2dde608c..000000000 --- a/vendor/gopkg.in/yaml.v2/writerc.go +++ /dev/null @@ -1,26 +0,0 @@ -package yaml - -// Set the writer error and return false. -func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { - emitter.error = yaml_WRITER_ERROR - emitter.problem = problem - return false -} - -// Flush the output buffer. -func yaml_emitter_flush(emitter *yaml_emitter_t) bool { - if emitter.write_handler == nil { - panic("write handler not set") - } - - // Check if the buffer is empty. - if emitter.buffer_pos == 0 { - return true - } - - if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { - return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) - } - emitter.buffer_pos = 0 - return true -} diff --git a/vendor/gopkg.in/yaml.v2/LICENSE.libyaml b/vendor/gopkg.in/yaml.v3/LICENSE similarity index 51% rename from vendor/gopkg.in/yaml.v2/LICENSE.libyaml rename to vendor/gopkg.in/yaml.v3/LICENSE index 8da58fbf6..2683e4bb1 100644 --- a/vendor/gopkg.in/yaml.v2/LICENSE.libyaml +++ b/vendor/gopkg.in/yaml.v3/LICENSE @@ -1,16 +1,17 @@ + +This project is covered by two different licenses: MIT and Apache. + +#### MIT License #### + The following files were ported to Go from C files of libyaml, and thus -are still covered by their original copyright and license: +are still covered by their original MIT license, with the additional +copyright staring in 2011 when the project was ported over: - apic.go - emitterc.go - parserc.go - readerc.go - scannerc.go - writerc.go - yamlh.go - yamlprivateh.go + apic.go emitterc.go parserc.go readerc.go scannerc.go + writerc.go yamlh.go yamlprivateh.go -Copyright (c) 2006 Kirill Simonov +Copyright (c) 2006-2010 Kirill Simonov +Copyright (c) 2006-2011 Kirill Simonov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -29,3 +30,21 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +### Apache License ### + +All the remaining project files are covered by the Apache license: + +Copyright (c) 2011-2019 Canonical Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/vendor/gopkg.in/yaml.v2/NOTICE b/vendor/gopkg.in/yaml.v3/NOTICE similarity index 100% rename from vendor/gopkg.in/yaml.v2/NOTICE rename to vendor/gopkg.in/yaml.v3/NOTICE diff --git a/vendor/gopkg.in/yaml.v2/README.md b/vendor/gopkg.in/yaml.v3/README.md similarity index 66% rename from vendor/gopkg.in/yaml.v2/README.md rename to vendor/gopkg.in/yaml.v3/README.md index b50c6e877..08eb1babd 100644 --- a/vendor/gopkg.in/yaml.v2/README.md +++ b/vendor/gopkg.in/yaml.v3/README.md @@ -12,7 +12,23 @@ C library to parse and generate YAML data quickly and reliably. Compatibility ------------- -The yaml package supports most of YAML 1.1 and 1.2, including support for +The yaml package supports most of YAML 1.2, but preserves some behavior +from 1.1 for backwards compatibility. + +Specifically, as of v3 of the yaml package: + + - YAML 1.1 bools (_yes/no, on/off_) are supported as long as they are being + decoded into a typed bool value. Otherwise they behave as a string. Booleans + in YAML 1.2 are _true/false_ only. + - Octals encode and decode as _0777_ per YAML 1.1, rather than _0o777_ + as specified in YAML 1.2, because most parsers still use the old format. + Octals in the _0o777_ format are supported though, so new files work. + - Does not support base-60 floats. These are gone from YAML 1.2, and were + actually never supported by this package as it's clearly a poor choice. + +and offers backwards +compatibility with YAML 1.1 in some cases. +1.2, including support for anchors, tags, map merging, etc. Multi-document unmarshalling is not yet implemented, and base-60 floats from YAML 1.1 are purposefully not supported since they're a poor design and are gone in YAML 1.2. @@ -20,29 +36,30 @@ supported since they're a poor design and are gone in YAML 1.2. Installation and usage ---------------------- -The import path for the package is *gopkg.in/yaml.v2*. +The import path for the package is *gopkg.in/yaml.v3*. To install it, run: - go get gopkg.in/yaml.v2 + go get gopkg.in/yaml.v3 API documentation ----------------- If opened in a browser, the import path itself leads to the API documentation: - * [https://gopkg.in/yaml.v2](https://gopkg.in/yaml.v2) + - [https://gopkg.in/yaml.v3](https://gopkg.in/yaml.v3) API stability ------------- -The package API for yaml v2 will remain stable as described in [gopkg.in](https://gopkg.in). +The package API for yaml v3 will remain stable as described in [gopkg.in](https://gopkg.in). License ------- -The yaml package is licensed under the Apache License 2.0. Please see the LICENSE file for details. +The yaml package is licensed under the MIT and Apache License 2.0 licenses. +Please see the LICENSE file for details. Example @@ -55,7 +72,7 @@ import ( "fmt" "log" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" ) var data = ` diff --git a/vendor/gopkg.in/yaml.v2/apic.go b/vendor/gopkg.in/yaml.v3/apic.go similarity index 93% rename from vendor/gopkg.in/yaml.v2/apic.go rename to vendor/gopkg.in/yaml.v3/apic.go index d2c2308f1..65846e674 100644 --- a/vendor/gopkg.in/yaml.v2/apic.go +++ b/vendor/gopkg.in/yaml.v3/apic.go @@ -1,3 +1,25 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + package yaml import ( @@ -86,7 +108,6 @@ func yaml_emitter_initialize(emitter *yaml_emitter_t) { raw_buffer: make([]byte, 0, output_raw_buffer_size), states: make([]yaml_emitter_state_t, 0, initial_stack_size), events: make([]yaml_event_t, 0, initial_queue_size), - best_width: -1, } } @@ -139,7 +160,7 @@ func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) { emitter.canonical = canonical } -//// Set the indentation increment. +// Set the indentation increment. func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) { if indent < 2 || indent > 9 { indent = 2 @@ -289,29 +310,14 @@ func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) { } } -///* -// * Create ALIAS. -// */ -// -//YAML_DECLARE(int) -//yaml_alias_event_initialize(event *yaml_event_t, anchor *yaml_char_t) -//{ -// mark yaml_mark_t = { 0, 0, 0 } -// anchor_copy *yaml_char_t = NULL -// -// assert(event) // Non-NULL event object is expected. -// assert(anchor) // Non-NULL anchor is expected. -// -// if (!yaml_check_utf8(anchor, strlen((char *)anchor))) return 0 -// -// anchor_copy = yaml_strdup(anchor) -// if (!anchor_copy) -// return 0 -// -// ALIAS_EVENT_INIT(*event, anchor_copy, mark, mark) -// -// return 1 -//} +// Create ALIAS. +func yaml_alias_event_initialize(event *yaml_event_t, anchor []byte) bool { + *event = yaml_event_t{ + typ: yaml_ALIAS_EVENT, + anchor: anchor, + } + return true +} // Create SCALAR. func yaml_scalar_event_initialize(event *yaml_event_t, anchor, tag, value []byte, plain_implicit, quoted_implicit bool, style yaml_scalar_style_t) bool { diff --git a/vendor/gopkg.in/yaml.v2/decode.go b/vendor/gopkg.in/yaml.v3/decode.go similarity index 55% rename from vendor/gopkg.in/yaml.v2/decode.go rename to vendor/gopkg.in/yaml.v3/decode.go index 129bc2a97..be63169b7 100644 --- a/vendor/gopkg.in/yaml.v2/decode.go +++ b/vendor/gopkg.in/yaml.v3/decode.go @@ -1,3 +1,18 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package yaml import ( @@ -11,33 +26,14 @@ import ( "time" ) -const ( - documentNode = 1 << iota - mappingNode - sequenceNode - scalarNode - aliasNode -) - -type node struct { - kind int - line, column int - tag string - // For an alias node, alias holds the resolved alias. - alias *node - value string - implicit bool - children []*node - anchors map[string]*node -} - // ---------------------------------------------------------------------------- // Parser, produces a node tree out of a libyaml event stream. type parser struct { parser yaml_parser_t event yaml_event_t - doc *node + doc *Node + anchors map[string]*Node doneInit bool } @@ -66,6 +62,7 @@ func (p *parser) init() { if p.doneInit { return } + p.anchors = make(map[string]*Node) p.expect(yaml_STREAM_START_EVENT) p.doneInit = true } @@ -132,13 +129,14 @@ func (p *parser) fail() { failf("%s%s", where, msg) } -func (p *parser) anchor(n *node, anchor []byte) { +func (p *parser) anchor(n *Node, anchor []byte) { if anchor != nil { - p.doc.anchors[string(anchor)] = n + n.Anchor = string(anchor) + p.anchors[n.Anchor] = n } } -func (p *parser) parse() *node { +func (p *parser) parse() *Node { p.init() switch p.peek() { case yaml_SCALAR_EVENT: @@ -154,67 +152,145 @@ func (p *parser) parse() *node { case yaml_STREAM_END_EVENT: // Happens when attempting to decode an empty buffer. return nil + case yaml_TAIL_COMMENT_EVENT: + panic("internal error: unexpected tail comment event (please report)") default: - panic("attempted to parse unknown event: " + p.event.typ.String()) + panic("internal error: attempted to parse unknown event (please report): " + p.event.typ.String()) } } -func (p *parser) node(kind int) *node { - return &node{ - kind: kind, - line: p.event.start_mark.line, - column: p.event.start_mark.column, +func (p *parser) node(kind Kind, defaultTag, tag, value string) *Node { + var style Style + if tag != "" && tag != "!" { + tag = shortTag(tag) + style = TaggedStyle + } else if defaultTag != "" { + tag = defaultTag + } else if kind == ScalarNode { + tag, _ = resolve("", value) + } + return &Node{ + Kind: kind, + Tag: tag, + Value: value, + Style: style, + Line: p.event.start_mark.line + 1, + Column: p.event.start_mark.column + 1, + HeadComment: string(p.event.head_comment), + LineComment: string(p.event.line_comment), + FootComment: string(p.event.foot_comment), } } -func (p *parser) document() *node { - n := p.node(documentNode) - n.anchors = make(map[string]*node) +func (p *parser) parseChild(parent *Node) *Node { + child := p.parse() + parent.Content = append(parent.Content, child) + return child +} + +func (p *parser) document() *Node { + n := p.node(DocumentNode, "", "", "") p.doc = n p.expect(yaml_DOCUMENT_START_EVENT) - n.children = append(n.children, p.parse()) + p.parseChild(n) + if p.peek() == yaml_DOCUMENT_END_EVENT { + n.FootComment = string(p.event.foot_comment) + } p.expect(yaml_DOCUMENT_END_EVENT) return n } -func (p *parser) alias() *node { - n := p.node(aliasNode) - n.value = string(p.event.anchor) - n.alias = p.doc.anchors[n.value] - if n.alias == nil { - failf("unknown anchor '%s' referenced", n.value) +func (p *parser) alias() *Node { + n := p.node(AliasNode, "", "", string(p.event.anchor)) + n.Alias = p.anchors[n.Value] + if n.Alias == nil { + failf("unknown anchor '%s' referenced", n.Value) } p.expect(yaml_ALIAS_EVENT) return n } -func (p *parser) scalar() *node { - n := p.node(scalarNode) - n.value = string(p.event.value) - n.tag = string(p.event.tag) - n.implicit = p.event.implicit +func (p *parser) scalar() *Node { + var parsedStyle = p.event.scalar_style() + var nodeStyle Style + switch { + case parsedStyle&yaml_DOUBLE_QUOTED_SCALAR_STYLE != 0: + nodeStyle = DoubleQuotedStyle + case parsedStyle&yaml_SINGLE_QUOTED_SCALAR_STYLE != 0: + nodeStyle = SingleQuotedStyle + case parsedStyle&yaml_LITERAL_SCALAR_STYLE != 0: + nodeStyle = LiteralStyle + case parsedStyle&yaml_FOLDED_SCALAR_STYLE != 0: + nodeStyle = FoldedStyle + } + var nodeValue = string(p.event.value) + var nodeTag = string(p.event.tag) + var defaultTag string + if nodeStyle == 0 { + if nodeValue == "<<" { + defaultTag = mergeTag + } + } else { + defaultTag = strTag + } + n := p.node(ScalarNode, defaultTag, nodeTag, nodeValue) + n.Style |= nodeStyle p.anchor(n, p.event.anchor) p.expect(yaml_SCALAR_EVENT) return n } -func (p *parser) sequence() *node { - n := p.node(sequenceNode) +func (p *parser) sequence() *Node { + n := p.node(SequenceNode, seqTag, string(p.event.tag), "") + if p.event.sequence_style()&yaml_FLOW_SEQUENCE_STYLE != 0 { + n.Style |= FlowStyle + } p.anchor(n, p.event.anchor) p.expect(yaml_SEQUENCE_START_EVENT) for p.peek() != yaml_SEQUENCE_END_EVENT { - n.children = append(n.children, p.parse()) + p.parseChild(n) } + n.LineComment = string(p.event.line_comment) + n.FootComment = string(p.event.foot_comment) p.expect(yaml_SEQUENCE_END_EVENT) return n } -func (p *parser) mapping() *node { - n := p.node(mappingNode) +func (p *parser) mapping() *Node { + n := p.node(MappingNode, mapTag, string(p.event.tag), "") + block := true + if p.event.mapping_style()&yaml_FLOW_MAPPING_STYLE != 0 { + block = false + n.Style |= FlowStyle + } p.anchor(n, p.event.anchor) p.expect(yaml_MAPPING_START_EVENT) for p.peek() != yaml_MAPPING_END_EVENT { - n.children = append(n.children, p.parse(), p.parse()) + k := p.parseChild(n) + if block && k.FootComment != "" { + // Must be a foot comment for the prior value when being dedented. + if len(n.Content) > 2 { + n.Content[len(n.Content)-3].FootComment = k.FootComment + k.FootComment = "" + } + } + v := p.parseChild(n) + if k.FootComment == "" && v.FootComment != "" { + k.FootComment = v.FootComment + v.FootComment = "" + } + if p.peek() == yaml_TAIL_COMMENT_EVENT { + if k.FootComment == "" { + k.FootComment = string(p.event.foot_comment) + } + p.expect(yaml_TAIL_COMMENT_EVENT) + } + } + n.LineComment = string(p.event.line_comment) + n.FootComment = string(p.event.foot_comment) + if n.Style&FlowStyle == 0 && n.FootComment != "" && len(n.Content) > 1 { + n.Content[len(n.Content)-2].FootComment = n.FootComment + n.FootComment = "" } p.expect(yaml_MAPPING_END_EVENT) return n @@ -224,48 +300,68 @@ func (p *parser) mapping() *node { // Decoder, unmarshals a node into a provided value. type decoder struct { - doc *node - aliases map[*node]bool - mapType reflect.Type + doc *Node + aliases map[*Node]bool terrors []string - strict bool + stringMapType reflect.Type + generalMapType reflect.Type + + knownFields bool + uniqueKeys bool decodeCount int aliasCount int aliasDepth int } var ( - mapItemType = reflect.TypeOf(MapItem{}) + nodeType = reflect.TypeOf(Node{}) durationType = reflect.TypeOf(time.Duration(0)) - defaultMapType = reflect.TypeOf(map[interface{}]interface{}{}) - ifaceType = defaultMapType.Elem() + stringMapType = reflect.TypeOf(map[string]interface{}{}) + generalMapType = reflect.TypeOf(map[interface{}]interface{}{}) + ifaceType = generalMapType.Elem() timeType = reflect.TypeOf(time.Time{}) ptrTimeType = reflect.TypeOf(&time.Time{}) ) -func newDecoder(strict bool) *decoder { - d := &decoder{mapType: defaultMapType, strict: strict} - d.aliases = make(map[*node]bool) +func newDecoder() *decoder { + d := &decoder{ + stringMapType: stringMapType, + generalMapType: generalMapType, + uniqueKeys: true, + } + d.aliases = make(map[*Node]bool) return d } -func (d *decoder) terror(n *node, tag string, out reflect.Value) { - if n.tag != "" { - tag = n.tag +func (d *decoder) terror(n *Node, tag string, out reflect.Value) { + if n.Tag != "" { + tag = n.Tag } - value := n.value - if tag != yaml_SEQ_TAG && tag != yaml_MAP_TAG { + value := n.Value + if tag != seqTag && tag != mapTag { if len(value) > 10 { value = " `" + value[:7] + "...`" } else { value = " `" + value + "`" } } - d.terrors = append(d.terrors, fmt.Sprintf("line %d: cannot unmarshal %s%s into %s", n.line+1, shortTag(tag), value, out.Type())) + d.terrors = append(d.terrors, fmt.Sprintf("line %d: cannot unmarshal %s%s into %s", n.Line, shortTag(tag), value, out.Type())) } -func (d *decoder) callUnmarshaler(n *node, u Unmarshaler) (good bool) { +func (d *decoder) callUnmarshaler(n *Node, u Unmarshaler) (good bool) { + err := u.UnmarshalYAML(n) + if e, ok := err.(*TypeError); ok { + d.terrors = append(d.terrors, e.Errors...) + return false + } + if err != nil { + fail(err) + } + return true +} + +func (d *decoder) callObsoleteUnmarshaler(n *Node, u obsoleteUnmarshaler) (good bool) { terrlen := len(d.terrors) err := u.UnmarshalYAML(func(v interface{}) (err error) { defer handleErr(&err) @@ -294,8 +390,8 @@ func (d *decoder) callUnmarshaler(n *node, u Unmarshaler) (good bool) { // its types unmarshalled appropriately. // // If n holds a null value, prepare returns before doing anything. -func (d *decoder) prepare(n *node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) { - if n.tag == yaml_NULL_TAG || n.kind == scalarNode && n.tag == "" && (n.value == "null" || n.value == "~" || n.value == "" && n.implicit) { +func (d *decoder) prepare(n *Node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) { + if n.ShortTag() == nullTag { return out, false, false } again := true @@ -309,15 +405,40 @@ func (d *decoder) prepare(n *node, out reflect.Value) (newout reflect.Value, unm again = true } if out.CanAddr() { - if u, ok := out.Addr().Interface().(Unmarshaler); ok { + outi := out.Addr().Interface() + if u, ok := outi.(Unmarshaler); ok { good = d.callUnmarshaler(n, u) return out, true, good } + if u, ok := outi.(obsoleteUnmarshaler); ok { + good = d.callObsoleteUnmarshaler(n, u) + return out, true, good + } } } return out, false, false } +func (d *decoder) fieldByIndex(n *Node, v reflect.Value, index []int) (field reflect.Value) { + if n.ShortTag() == nullTag { + return reflect.Value{} + } + for _, num := range index { + for { + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(v.Type().Elem())) + } + v = v.Elem() + continue + } + break + } + v = v.Field(num) + } + return v +} + const ( // 400,000 decode operations is ~500kb of dense object declarations, or // ~5kb of dense object declarations with 10000% alias expansion @@ -347,7 +468,7 @@ func allowedAliasRatio(decodeCount int) float64 { } } -func (d *decoder) unmarshal(n *node, out reflect.Value) (good bool) { +func (d *decoder) unmarshal(n *Node, out reflect.Value) (good bool) { d.decodeCount++ if d.aliasDepth > 0 { d.aliasCount++ @@ -355,46 +476,50 @@ func (d *decoder) unmarshal(n *node, out reflect.Value) (good bool) { if d.aliasCount > 100 && d.decodeCount > 1000 && float64(d.aliasCount)/float64(d.decodeCount) > allowedAliasRatio(d.decodeCount) { failf("document contains excessive aliasing") } - switch n.kind { - case documentNode: + if out.Type() == nodeType { + out.Set(reflect.ValueOf(n).Elem()) + return true + } + switch n.Kind { + case DocumentNode: return d.document(n, out) - case aliasNode: + case AliasNode: return d.alias(n, out) } out, unmarshaled, good := d.prepare(n, out) if unmarshaled { return good } - switch n.kind { - case scalarNode: + switch n.Kind { + case ScalarNode: good = d.scalar(n, out) - case mappingNode: + case MappingNode: good = d.mapping(n, out) - case sequenceNode: + case SequenceNode: good = d.sequence(n, out) default: - panic("internal error: unknown node kind: " + strconv.Itoa(n.kind)) + panic("internal error: unknown node kind: " + strconv.Itoa(int(n.Kind))) } return good } -func (d *decoder) document(n *node, out reflect.Value) (good bool) { - if len(n.children) == 1 { +func (d *decoder) document(n *Node, out reflect.Value) (good bool) { + if len(n.Content) == 1 { d.doc = n - d.unmarshal(n.children[0], out) + d.unmarshal(n.Content[0], out) return true } return false } -func (d *decoder) alias(n *node, out reflect.Value) (good bool) { +func (d *decoder) alias(n *Node, out reflect.Value) (good bool) { if d.aliases[n] { // TODO this could actually be allowed in some circumstances. - failf("anchor '%s' value contains itself", n.value) + failf("anchor '%s' value contains itself", n.Value) } d.aliases[n] = true d.aliasDepth++ - good = d.unmarshal(n.alias, out) + good = d.unmarshal(n.Alias, out) d.aliasDepth-- delete(d.aliases, n) return good @@ -408,15 +533,15 @@ func resetMap(out reflect.Value) { } } -func (d *decoder) scalar(n *node, out reflect.Value) bool { +func (d *decoder) scalar(n *Node, out reflect.Value) bool { var tag string var resolved interface{} - if n.tag == "" && !n.implicit { - tag = yaml_STR_TAG - resolved = n.value + if n.indicatedString() { + tag = strTag + resolved = n.Value } else { - tag, resolved = resolve(n.tag, n.value) - if tag == yaml_BINARY_TAG { + tag, resolved = resolve(n.Tag, n.Value) + if tag == binaryTag { data, err := base64.StdEncoding.DecodeString(resolved.(string)) if err != nil { failf("!!binary value contains invalid base64 data") @@ -425,12 +550,14 @@ func (d *decoder) scalar(n *node, out reflect.Value) bool { } } if resolved == nil { - if out.Kind() == reflect.Map && !out.CanAddr() { - resetMap(out) - } else { - out.Set(reflect.Zero(out.Type())) + if out.CanAddr() { + switch out.Kind() { + case reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: + out.Set(reflect.Zero(out.Type())) + return true + } } - return true + return false } if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { // We've resolved to exactly the type we want, so use that. @@ -443,13 +570,13 @@ func (d *decoder) scalar(n *node, out reflect.Value) bool { u, ok := out.Addr().Interface().(encoding.TextUnmarshaler) if ok { var text []byte - if tag == yaml_BINARY_TAG { + if tag == binaryTag { text = []byte(resolved.(string)) } else { // We let any value be unmarshaled into TextUnmarshaler. // That might be more lax than we'd like, but the // TextUnmarshaler itself should bowl out any dubious values. - text = []byte(n.value) + text = []byte(n.Value) } err := u.UnmarshalText(text) if err != nil { @@ -460,47 +587,37 @@ func (d *decoder) scalar(n *node, out reflect.Value) bool { } switch out.Kind() { case reflect.String: - if tag == yaml_BINARY_TAG { + if tag == binaryTag { out.SetString(resolved.(string)) return true } - if resolved != nil { - out.SetString(n.value) - return true - } + out.SetString(n.Value) + return true case reflect.Interface: - if resolved == nil { - out.Set(reflect.Zero(out.Type())) - } else if tag == yaml_TIMESTAMP_TAG { - // It looks like a timestamp but for backward compatibility - // reasons we set it as a string, so that code that unmarshals - // timestamp-like values into interface{} will continue to - // see a string and not a time.Time. - // TODO(v3) Drop this. - out.Set(reflect.ValueOf(n.value)) - } else { - out.Set(reflect.ValueOf(resolved)) - } + out.Set(reflect.ValueOf(resolved)) return true case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + // This used to work in v2, but it's very unfriendly. + isDuration := out.Type() == durationType + switch resolved := resolved.(type) { case int: - if !out.OverflowInt(int64(resolved)) { + if !isDuration && !out.OverflowInt(int64(resolved)) { out.SetInt(int64(resolved)) return true } case int64: - if !out.OverflowInt(resolved) { + if !isDuration && !out.OverflowInt(resolved) { out.SetInt(resolved) return true } case uint64: - if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { + if !isDuration && resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { out.SetInt(int64(resolved)) return true } case float64: - if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { + if !isDuration && resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { out.SetInt(int64(resolved)) return true } @@ -541,6 +658,17 @@ func (d *decoder) scalar(n *node, out reflect.Value) bool { case bool: out.SetBool(resolved) return true + case string: + // This offers some compatibility with the 1.1 spec (https://yaml.org/type/bool.html). + // It only works if explicitly attempting to unmarshal into a typed bool value. + switch resolved { + case "y", "Y", "yes", "Yes", "YES", "on", "On", "ON": + out.SetBool(true) + return true + case "n", "N", "no", "No", "NO", "off", "Off", "OFF": + out.SetBool(false) + return true + } } case reflect.Float32, reflect.Float64: switch resolved := resolved.(type) { @@ -563,13 +691,7 @@ func (d *decoder) scalar(n *node, out reflect.Value) bool { return true } case reflect.Ptr: - if out.Type().Elem() == reflect.TypeOf(resolved) { - // TODO DOes this make sense? When is out a Ptr except when decoding a nil value? - elem := reflect.New(out.Type().Elem()) - elem.Elem().Set(reflect.ValueOf(resolved)) - out.Set(elem) - return true - } + panic("yaml internal error: please report the issue") } d.terror(n, tag, out) return false @@ -582,8 +704,8 @@ func settableValueOf(i interface{}) reflect.Value { return sv } -func (d *decoder) sequence(n *node, out reflect.Value) (good bool) { - l := len(n.children) +func (d *decoder) sequence(n *Node, out reflect.Value) (good bool) { + l := len(n.Content) var iface reflect.Value switch out.Kind() { @@ -598,7 +720,7 @@ func (d *decoder) sequence(n *node, out reflect.Value) (good bool) { iface = out out = settableValueOf(make([]interface{}, l)) default: - d.terror(n, yaml_SEQ_TAG, out) + d.terror(n, seqTag, out) return false } et := out.Type().Elem() @@ -606,7 +728,7 @@ func (d *decoder) sequence(n *node, out reflect.Value) (good bool) { j := 0 for i := 0; i < l; i++ { e := reflect.New(et).Elem() - if ok := d.unmarshal(n.children[i], e); ok { + if ok := d.unmarshal(n.Content[i], e); ok { out.Index(j).Set(e) j++ } @@ -620,51 +742,65 @@ func (d *decoder) sequence(n *node, out reflect.Value) (good bool) { return true } -func (d *decoder) mapping(n *node, out reflect.Value) (good bool) { +func (d *decoder) mapping(n *Node, out reflect.Value) (good bool) { + l := len(n.Content) + if d.uniqueKeys { + nerrs := len(d.terrors) + for i := 0; i < l; i += 2 { + ni := n.Content[i] + for j := i + 2; j < l; j += 2 { + nj := n.Content[j] + if ni.Kind == nj.Kind && ni.Value == nj.Value { + d.terrors = append(d.terrors, fmt.Sprintf("line %d: mapping key %#v already defined at line %d", nj.Line, nj.Value, ni.Line)) + } + } + } + if len(d.terrors) > nerrs { + return false + } + } switch out.Kind() { case reflect.Struct: return d.mappingStruct(n, out) - case reflect.Slice: - return d.mappingSlice(n, out) case reflect.Map: // okay case reflect.Interface: - if d.mapType.Kind() == reflect.Map { - iface := out - out = reflect.MakeMap(d.mapType) - iface.Set(out) + iface := out + if isStringMap(n) { + out = reflect.MakeMap(d.stringMapType) } else { - slicev := reflect.New(d.mapType).Elem() - if !d.mappingSlice(n, slicev) { - return false - } - out.Set(slicev) - return true + out = reflect.MakeMap(d.generalMapType) } + iface.Set(out) default: - d.terror(n, yaml_MAP_TAG, out) + d.terror(n, mapTag, out) return false } + outt := out.Type() kt := outt.Key() et := outt.Elem() - mapType := d.mapType - if outt.Key() == ifaceType && outt.Elem() == ifaceType { - d.mapType = outt + stringMapType := d.stringMapType + generalMapType := d.generalMapType + if outt.Elem() == ifaceType { + if outt.Key().Kind() == reflect.String { + d.stringMapType = outt + } else if outt.Key() == ifaceType { + d.generalMapType = outt + } } if out.IsNil() { out.Set(reflect.MakeMap(outt)) } - l := len(n.children) for i := 0; i < l; i += 2 { - if isMerge(n.children[i]) { - d.merge(n.children[i+1], out) + if isMerge(n.Content[i]) { + d.merge(n.Content[i+1], out) continue } k := reflect.New(kt).Elem() - if d.unmarshal(n.children[i], k) { + if d.unmarshal(n.Content[i], k) { kkind := k.Kind() if kkind == reflect.Interface { kkind = k.Elem().Kind() @@ -673,61 +809,34 @@ func (d *decoder) mapping(n *node, out reflect.Value) (good bool) { failf("invalid map key: %#v", k.Interface()) } e := reflect.New(et).Elem() - if d.unmarshal(n.children[i+1], e) { - d.setMapIndex(n.children[i+1], out, k, e) + if d.unmarshal(n.Content[i+1], e) { + out.SetMapIndex(k, e) } } } - d.mapType = mapType + d.stringMapType = stringMapType + d.generalMapType = generalMapType return true } -func (d *decoder) setMapIndex(n *node, out, k, v reflect.Value) { - if d.strict && out.MapIndex(k) != zeroValue { - d.terrors = append(d.terrors, fmt.Sprintf("line %d: key %#v already set in map", n.line+1, k.Interface())) - return - } - out.SetMapIndex(k, v) -} - -func (d *decoder) mappingSlice(n *node, out reflect.Value) (good bool) { - outt := out.Type() - if outt.Elem() != mapItemType { - d.terror(n, yaml_MAP_TAG, out) +func isStringMap(n *Node) bool { + if n.Kind != MappingNode { return false } - - mapType := d.mapType - d.mapType = outt - - var slice []MapItem - var l = len(n.children) + l := len(n.Content) for i := 0; i < l; i += 2 { - if isMerge(n.children[i]) { - d.merge(n.children[i+1], out) - continue - } - item := MapItem{} - k := reflect.ValueOf(&item.Key).Elem() - if d.unmarshal(n.children[i], k) { - v := reflect.ValueOf(&item.Value).Elem() - if d.unmarshal(n.children[i+1], v) { - slice = append(slice, item) - } + if n.Content[i].ShortTag() != strTag { + return false } } - out.Set(reflect.ValueOf(slice)) - d.mapType = mapType return true } -func (d *decoder) mappingStruct(n *node, out reflect.Value) (good bool) { +func (d *decoder) mappingStruct(n *Node, out reflect.Value) (good bool) { sinfo, err := getStructInfo(out.Type()) if err != nil { panic(err) } - name := settableValueOf("") - l := len(n.children) var inlineMap reflect.Value var elemType reflect.Type @@ -737,23 +846,30 @@ func (d *decoder) mappingStruct(n *node, out reflect.Value) (good bool) { elemType = inlineMap.Type().Elem() } + for _, index := range sinfo.InlineUnmarshalers { + field := d.fieldByIndex(n, out, index) + d.prepare(n, field) + } + var doneFields []bool - if d.strict { + if d.uniqueKeys { doneFields = make([]bool, len(sinfo.FieldsList)) } + name := settableValueOf("") + l := len(n.Content) for i := 0; i < l; i += 2 { - ni := n.children[i] + ni := n.Content[i] if isMerge(ni) { - d.merge(n.children[i+1], out) + d.merge(n.Content[i+1], out) continue } if !d.unmarshal(ni, name) { continue } if info, ok := sinfo.FieldsMap[name.String()]; ok { - if d.strict { + if d.uniqueKeys { if doneFields[info.Id] { - d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s already set in type %s", ni.line+1, name.String(), out.Type())) + d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s already set in type %s", ni.Line, name.String(), out.Type())) continue } doneFields[info.Id] = true @@ -762,18 +878,18 @@ func (d *decoder) mappingStruct(n *node, out reflect.Value) (good bool) { if info.Inline == nil { field = out.Field(info.Num) } else { - field = out.FieldByIndex(info.Inline) + field = d.fieldByIndex(n, out, info.Inline) } - d.unmarshal(n.children[i+1], field) + d.unmarshal(n.Content[i+1], field) } else if sinfo.InlineMap != -1 { if inlineMap.IsNil() { inlineMap.Set(reflect.MakeMap(inlineMap.Type())) } value := reflect.New(elemType).Elem() - d.unmarshal(n.children[i+1], value) - d.setMapIndex(n.children[i+1], inlineMap, name, value) - } else if d.strict { - d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s not found in type %s", ni.line+1, name.String(), out.Type())) + d.unmarshal(n.Content[i+1], value) + inlineMap.SetMapIndex(name, value) + } else if d.knownFields { + d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s not found in type %s", ni.Line, name.String(), out.Type())) } } return true @@ -783,24 +899,24 @@ func failWantMap() { failf("map merge requires map or sequence of maps as the value") } -func (d *decoder) merge(n *node, out reflect.Value) { - switch n.kind { - case mappingNode: +func (d *decoder) merge(n *Node, out reflect.Value) { + switch n.Kind { + case MappingNode: d.unmarshal(n, out) - case aliasNode: - if n.alias != nil && n.alias.kind != mappingNode { + case AliasNode: + if n.Alias != nil && n.Alias.Kind != MappingNode { failWantMap() } d.unmarshal(n, out) - case sequenceNode: + case SequenceNode: // Step backwards as earlier nodes take precedence. - for i := len(n.children) - 1; i >= 0; i-- { - ni := n.children[i] - if ni.kind == aliasNode { - if ni.alias != nil && ni.alias.kind != mappingNode { + for i := len(n.Content) - 1; i >= 0; i-- { + ni := n.Content[i] + if ni.Kind == AliasNode { + if ni.Alias != nil && ni.Alias.Kind != MappingNode { failWantMap() } - } else if ni.kind != mappingNode { + } else if ni.Kind != MappingNode { failWantMap() } d.unmarshal(ni, out) @@ -810,6 +926,6 @@ func (d *decoder) merge(n *node, out reflect.Value) { } } -func isMerge(n *node) bool { - return n.kind == scalarNode && n.value == "<<" && (n.implicit == true || n.tag == yaml_MERGE_TAG) +func isMerge(n *Node) bool { + return n.Kind == ScalarNode && n.Value == "<<" && (n.Tag == "" || n.Tag == "!" || shortTag(n.Tag) == mergeTag) } diff --git a/vendor/gopkg.in/yaml.v2/emitterc.go b/vendor/gopkg.in/yaml.v3/emitterc.go similarity index 82% rename from vendor/gopkg.in/yaml.v2/emitterc.go rename to vendor/gopkg.in/yaml.v3/emitterc.go index a1c2cc526..ab2a06619 100644 --- a/vendor/gopkg.in/yaml.v2/emitterc.go +++ b/vendor/gopkg.in/yaml.v3/emitterc.go @@ -1,3 +1,25 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + package yaml import ( @@ -43,8 +65,13 @@ func put_break(emitter *yaml_emitter_t) bool { default: panic("unknown line break setting") } + if emitter.column == 0 { + emitter.space_above = true + } emitter.column = 0 emitter.line++ + // [Go] Do this here and below and drop from everywhere else (see commented lines). + emitter.indention = true return true } @@ -97,8 +124,13 @@ func write_break(emitter *yaml_emitter_t, s []byte, i *int) bool { if !write(emitter, s, i) { return false } + if emitter.column == 0 { + emitter.space_above = true + } emitter.column = 0 emitter.line++ + // [Go] Do this here and above and drop from everywhere else (see commented lines). + emitter.indention = true } return true } @@ -204,6 +236,10 @@ func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool } } else if !indentless { emitter.indent += emitter.best_indent + // [Go] If inside a block sequence item, discount the space taken by the indicator. + if emitter.best_indent > 2 && emitter.states[len(emitter.states)-1] == yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE { + emitter.indent -= 2 + } } return true } @@ -228,16 +264,22 @@ func yaml_emitter_state_machine(emitter *yaml_emitter_t, event *yaml_event_t) bo return yaml_emitter_emit_document_end(emitter, event) case yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE: - return yaml_emitter_emit_flow_sequence_item(emitter, event, true) + return yaml_emitter_emit_flow_sequence_item(emitter, event, true, false) + + case yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE: + return yaml_emitter_emit_flow_sequence_item(emitter, event, false, true) case yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE: - return yaml_emitter_emit_flow_sequence_item(emitter, event, false) + return yaml_emitter_emit_flow_sequence_item(emitter, event, false, false) case yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE: - return yaml_emitter_emit_flow_mapping_key(emitter, event, true) + return yaml_emitter_emit_flow_mapping_key(emitter, event, true, false) + + case yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE: + return yaml_emitter_emit_flow_mapping_key(emitter, event, false, true) case yaml_EMIT_FLOW_MAPPING_KEY_STATE: - return yaml_emitter_emit_flow_mapping_key(emitter, event, false) + return yaml_emitter_emit_flow_mapping_key(emitter, event, false, false) case yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE: return yaml_emitter_emit_flow_mapping_value(emitter, event, true) @@ -298,6 +340,8 @@ func yaml_emitter_emit_stream_start(emitter *yaml_emitter_t, event *yaml_event_t emitter.column = 0 emitter.whitespace = true emitter.indention = true + emitter.space_above = true + emitter.foot_indent = -1 if emitter.encoding != yaml_UTF8_ENCODING { if !yaml_emitter_write_bom(emitter) { @@ -392,13 +436,22 @@ func yaml_emitter_emit_document_start(emitter *yaml_emitter_t, event *yaml_event if !yaml_emitter_write_indicator(emitter, []byte("---"), true, false, false) { return false } - if emitter.canonical { + if emitter.canonical || true { if !yaml_emitter_write_indent(emitter) { return false } } } + if len(emitter.head_comment) > 0 { + if !yaml_emitter_process_head_comment(emitter) { + return false + } + if !put_break(emitter) { + return false + } + } + emitter.state = yaml_EMIT_DOCUMENT_CONTENT_STATE return true } @@ -425,7 +478,20 @@ func yaml_emitter_emit_document_start(emitter *yaml_emitter_t, event *yaml_event // Expect the root node. func yaml_emitter_emit_document_content(emitter *yaml_emitter_t, event *yaml_event_t) bool { emitter.states = append(emitter.states, yaml_EMIT_DOCUMENT_END_STATE) - return yaml_emitter_emit_node(emitter, event, true, false, false, false) + + if !yaml_emitter_process_head_comment(emitter) { + return false + } + if !yaml_emitter_emit_node(emitter, event, true, false, false, false) { + return false + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + return true } // Expect DOCUMENT-END. @@ -433,6 +499,12 @@ func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml_event_t if event.typ != yaml_DOCUMENT_END_EVENT { return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-END") } + // [Go] Force document foot separation. + emitter.foot_indent = 0 + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + emitter.foot_indent = -1 if !yaml_emitter_write_indent(emitter) { return false } @@ -454,7 +526,7 @@ func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml_event_t } // Expect a flow item node. -func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { +func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first, trail bool) bool { if first { if !yaml_emitter_write_indicator(emitter, []byte{'['}, true, true, false) { return false @@ -466,13 +538,15 @@ func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_e } if event.typ == yaml_SEQUENCE_END_EVENT { - emitter.flow_level-- - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - if emitter.canonical && !first { + if emitter.canonical && !first && !trail { if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { return false } + } + emitter.flow_level-- + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + if emitter.column == 0 || emitter.canonical && !first { if !yaml_emitter_write_indent(emitter) { return false } @@ -480,29 +554,62 @@ func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_e if !yaml_emitter_write_indicator(emitter, []byte{']'}, false, false, false) { return false } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } emitter.state = emitter.states[len(emitter.states)-1] emitter.states = emitter.states[:len(emitter.states)-1] return true } - if !first { + if !first && !trail { if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { return false } } + if !yaml_emitter_process_head_comment(emitter) { + return false + } + if emitter.column == 0 { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if emitter.canonical || emitter.column > emitter.best_width { if !yaml_emitter_write_indent(emitter) { return false } } - emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE) - return yaml_emitter_emit_node(emitter, event, false, true, false, false) + if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE) + } else { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE) + } + if !yaml_emitter_emit_node(emitter, event, false, true, false, false) { + return false + } + if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + return true } // Expect a flow key node. -func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { +func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first, trail bool) bool { if first { if !yaml_emitter_write_indicator(emitter, []byte{'{'}, true, true, false) { return false @@ -514,13 +621,18 @@ func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_eve } if event.typ == yaml_MAPPING_END_EVENT { + if (emitter.canonical || len(emitter.head_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0) && !first && !trail { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + if !yaml_emitter_process_head_comment(emitter) { + return false + } emitter.flow_level-- emitter.indent = emitter.indents[len(emitter.indents)-1] emitter.indents = emitter.indents[:len(emitter.indents)-1] if emitter.canonical && !first { - if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { - return false - } if !yaml_emitter_write_indent(emitter) { return false } @@ -528,16 +640,33 @@ func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_eve if !yaml_emitter_write_indicator(emitter, []byte{'}'}, false, false, false) { return false } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } emitter.state = emitter.states[len(emitter.states)-1] emitter.states = emitter.states[:len(emitter.states)-1] return true } - if !first { + if !first && !trail { if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { return false } } + + if !yaml_emitter_process_head_comment(emitter) { + return false + } + + if emitter.column == 0 { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if emitter.canonical || emitter.column > emitter.best_width { if !yaml_emitter_write_indent(emitter) { return false @@ -571,16 +700,41 @@ func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, event *yaml_e return false } } - emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_KEY_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, false) + if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE) + } else { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_KEY_STATE) + } + if !yaml_emitter_emit_node(emitter, event, false, false, true, false) { + return false + } + if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + return true } // Expect a block item node. func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { if first { - if !yaml_emitter_increase_indent(emitter, false, emitter.mapping_context && !emitter.indention) { + // [Go] The original logic here would not indent the sequence when inside a mapping. + // In Go we always indent it, but take the sequence indicator out of the indentation. + indentless := emitter.best_indent == 2 && emitter.mapping_context && (emitter.column == 0 || !emitter.indention) + original := emitter.indent + if !yaml_emitter_increase_indent(emitter, false, indentless) { return false } + if emitter.indent > original+2 { + emitter.indent -= 2 + } } if event.typ == yaml_SEQUENCE_END_EVENT { emitter.indent = emitter.indents[len(emitter.indents)-1] @@ -589,6 +743,9 @@ func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_ emitter.states = emitter.states[:len(emitter.states)-1] return true } + if !yaml_emitter_process_head_comment(emitter) { + return false + } if !yaml_emitter_write_indent(emitter) { return false } @@ -596,7 +753,16 @@ func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_ return false } emitter.states = append(emitter.states, yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE) - return yaml_emitter_emit_node(emitter, event, false, true, false, false) + if !yaml_emitter_emit_node(emitter, event, false, true, false, false) { + return false + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + return true } // Expect a block key node. @@ -606,6 +772,9 @@ func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, event *yaml_ev return false } } + if !yaml_emitter_process_head_comment(emitter) { + return false + } if event.typ == yaml_MAPPING_END_EVENT { emitter.indent = emitter.indents[len(emitter.indents)-1] emitter.indents = emitter.indents[:len(emitter.indents)-1] @@ -642,7 +811,16 @@ func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_ } } emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_KEY_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, false) + if !yaml_emitter_emit_node(emitter, event, false, false, true, false) { + return false + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + return true } // Expect a node. @@ -908,6 +1086,71 @@ func yaml_emitter_process_scalar(emitter *yaml_emitter_t) bool { panic("unknown scalar style") } +// Write a head comment. +func yaml_emitter_process_head_comment(emitter *yaml_emitter_t) bool { + if len(emitter.tail_comment) > 0 { + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_comment(emitter, emitter.tail_comment) { + return false + } + emitter.tail_comment = emitter.tail_comment[:0] + emitter.foot_indent = emitter.indent + if emitter.foot_indent < 0 { + emitter.foot_indent = 0 + } + } + + if len(emitter.head_comment) == 0 { + return true + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_comment(emitter, emitter.head_comment) { + return false + } + emitter.head_comment = emitter.head_comment[:0] + return true +} + +// Write an line comment. +func yaml_emitter_process_line_comment(emitter *yaml_emitter_t) bool { + if len(emitter.line_comment) == 0 { + return true + } + if !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + if !yaml_emitter_write_comment(emitter, emitter.line_comment) { + return false + } + emitter.line_comment = emitter.line_comment[:0] + return true +} + +// Write a foot comment. +func yaml_emitter_process_foot_comment(emitter *yaml_emitter_t) bool { + if len(emitter.foot_comment) == 0 { + return true + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_comment(emitter, emitter.foot_comment) { + return false + } + emitter.foot_comment = emitter.foot_comment[:0] + emitter.foot_indent = emitter.indent + if emitter.foot_indent < 0 { + emitter.foot_indent = 0 + } + return true +} + // Check if a %YAML directive is valid. func yaml_emitter_analyze_version_directive(emitter *yaml_emitter_t, version_directive *yaml_version_directive_t) bool { if version_directive.major != 1 || version_directive.minor != 1 { @@ -987,6 +1230,7 @@ func yaml_emitter_analyze_scalar(emitter *yaml_emitter_t, value []byte) bool { flow_indicators = false line_breaks = false special_characters = false + tab_characters = false leading_space = false leading_break = false @@ -1055,7 +1299,9 @@ func yaml_emitter_analyze_scalar(emitter *yaml_emitter_t, value []byte) bool { } } - if !is_printable(value, i) || !is_ascii(value, i) && !emitter.unicode { + if value[i] == '\t' { + tab_characters = true + } else if !is_printable(value, i) || !is_ascii(value, i) && !emitter.unicode { special_characters = true } if is_space(value, i) { @@ -1110,10 +1356,12 @@ func yaml_emitter_analyze_scalar(emitter *yaml_emitter_t, value []byte) bool { emitter.scalar_data.block_plain_allowed = false emitter.scalar_data.single_quoted_allowed = false } - if space_break || special_characters { + if space_break || tab_characters || special_characters { emitter.scalar_data.flow_plain_allowed = false emitter.scalar_data.block_plain_allowed = false emitter.scalar_data.single_quoted_allowed = false + } + if space_break || special_characters { emitter.scalar_data.block_allowed = false } if line_breaks { @@ -1137,6 +1385,19 @@ func yaml_emitter_analyze_event(emitter *yaml_emitter_t, event *yaml_event_t) bo emitter.tag_data.suffix = nil emitter.scalar_data.value = nil + if len(event.head_comment) > 0 { + emitter.head_comment = event.head_comment + } + if len(event.line_comment) > 0 { + emitter.line_comment = event.line_comment + } + if len(event.foot_comment) > 0 { + emitter.foot_comment = event.foot_comment + } + if len(event.tail_comment) > 0 { + emitter.tail_comment = event.tail_comment + } + switch event.typ { case yaml_ALIAS_EVENT: if !yaml_emitter_analyze_anchor(emitter, event.anchor, true) { @@ -1208,13 +1469,20 @@ func yaml_emitter_write_indent(emitter *yaml_emitter_t) bool { return false } } + if emitter.foot_indent == indent { + if !put_break(emitter) { + return false + } + } for emitter.column < indent { if !put(emitter, ' ') { return false } } emitter.whitespace = true - emitter.indention = true + //emitter.indention = true + emitter.space_above = false + emitter.foot_indent = -1 return true } @@ -1311,7 +1579,7 @@ func yaml_emitter_write_tag_content(emitter *yaml_emitter_t, value []byte, need_ } func yaml_emitter_write_plain_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { - if !emitter.whitespace { + if len(value) > 0 && !emitter.whitespace { if !put(emitter, ' ') { return false } @@ -1341,7 +1609,7 @@ func yaml_emitter_write_plain_scalar(emitter *yaml_emitter_t, value []byte, allo if !write_break(emitter, value, &i) { return false } - emitter.indention = true + //emitter.indention = true breaks = true } else { if breaks { @@ -1358,7 +1626,9 @@ func yaml_emitter_write_plain_scalar(emitter *yaml_emitter_t, value []byte, allo } } - emitter.whitespace = false + if len(value) > 0 { + emitter.whitespace = false + } emitter.indention = false if emitter.root_context { emitter.open_ended = true @@ -1397,7 +1667,7 @@ func yaml_emitter_write_single_quoted_scalar(emitter *yaml_emitter_t, value []by if !write_break(emitter, value, &i) { return false } - emitter.indention = true + //emitter.indention = true breaks = true } else { if breaks { @@ -1599,7 +1869,7 @@ func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []byte) bo if !put_break(emitter) { return false } - emitter.indention = true + //emitter.indention = true emitter.whitespace = true breaks := true for i := 0; i < len(value); { @@ -1607,7 +1877,7 @@ func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []byte) bo if !write_break(emitter, value, &i) { return false } - emitter.indention = true + //emitter.indention = true breaks = true } else { if breaks { @@ -1637,7 +1907,7 @@ func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []byte) boo if !put_break(emitter) { return false } - emitter.indention = true + //emitter.indention = true emitter.whitespace = true breaks := true @@ -1658,7 +1928,7 @@ func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []byte) boo if !write_break(emitter, value, &i) { return false } - emitter.indention = true + //emitter.indention = true breaks = true } else { if breaks { @@ -1683,3 +1953,40 @@ func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []byte) boo } return true } + +func yaml_emitter_write_comment(emitter *yaml_emitter_t, comment []byte) bool { + breaks := false + pound := false + for i := 0; i < len(comment); { + if is_break(comment, i) { + if !write_break(emitter, comment, &i) { + return false + } + //emitter.indention = true + breaks = true + pound = false + } else { + if breaks && !yaml_emitter_write_indent(emitter) { + return false + } + if !pound { + if comment[i] != '#' && (!put(emitter, '#') || !put(emitter, ' ')) { + return false + } + pound = true + } + if !write(emitter, comment, &i) { + return false + } + emitter.indention = false + breaks = false + } + } + if !breaks && !put_break(emitter) { + return false + } + + emitter.whitespace = true + //emitter.indention = true + return true +} diff --git a/vendor/gopkg.in/yaml.v3/encode.go b/vendor/gopkg.in/yaml.v3/encode.go new file mode 100644 index 000000000..1f37271ce --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/encode.go @@ -0,0 +1,561 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package yaml + +import ( + "encoding" + "fmt" + "io" + "reflect" + "regexp" + "sort" + "strconv" + "strings" + "time" + "unicode/utf8" +) + +type encoder struct { + emitter yaml_emitter_t + event yaml_event_t + out []byte + flow bool + indent int + doneInit bool +} + +func newEncoder() *encoder { + e := &encoder{} + yaml_emitter_initialize(&e.emitter) + yaml_emitter_set_output_string(&e.emitter, &e.out) + yaml_emitter_set_unicode(&e.emitter, true) + return e +} + +func newEncoderWithWriter(w io.Writer) *encoder { + e := &encoder{} + yaml_emitter_initialize(&e.emitter) + yaml_emitter_set_output_writer(&e.emitter, w) + yaml_emitter_set_unicode(&e.emitter, true) + return e +} + +func (e *encoder) init() { + if e.doneInit { + return + } + if e.indent == 0 { + e.indent = 4 + } + e.emitter.best_indent = e.indent + yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING) + e.emit() + e.doneInit = true +} + +func (e *encoder) finish() { + e.emitter.open_ended = false + yaml_stream_end_event_initialize(&e.event) + e.emit() +} + +func (e *encoder) destroy() { + yaml_emitter_delete(&e.emitter) +} + +func (e *encoder) emit() { + // This will internally delete the e.event value. + e.must(yaml_emitter_emit(&e.emitter, &e.event)) +} + +func (e *encoder) must(ok bool) { + if !ok { + msg := e.emitter.problem + if msg == "" { + msg = "unknown problem generating YAML content" + } + failf("%s", msg) + } +} + +func (e *encoder) marshalDoc(tag string, in reflect.Value) { + e.init() + var node *Node + if in.IsValid() { + node, _ = in.Interface().(*Node) + } + if node != nil && node.Kind == DocumentNode { + e.nodev(in) + } else { + yaml_document_start_event_initialize(&e.event, nil, nil, true) + e.emit() + e.marshal(tag, in) + yaml_document_end_event_initialize(&e.event, true) + e.emit() + } +} + +func (e *encoder) marshal(tag string, in reflect.Value) { + tag = shortTag(tag) + if !in.IsValid() || in.Kind() == reflect.Ptr && in.IsNil() { + e.nilv() + return + } + iface := in.Interface() + switch value := iface.(type) { + case *Node: + e.nodev(in) + return + case time.Time: + e.timev(tag, in) + return + case *time.Time: + e.timev(tag, in.Elem()) + return + case time.Duration: + e.stringv(tag, reflect.ValueOf(value.String())) + return + case Marshaler: + v, err := value.MarshalYAML() + if err != nil { + fail(err) + } + if v == nil { + e.nilv() + return + } + e.marshal(tag, reflect.ValueOf(v)) + return + case encoding.TextMarshaler: + text, err := value.MarshalText() + if err != nil { + fail(err) + } + in = reflect.ValueOf(string(text)) + case nil: + e.nilv() + return + } + switch in.Kind() { + case reflect.Interface: + e.marshal(tag, in.Elem()) + case reflect.Map: + e.mapv(tag, in) + case reflect.Ptr: + e.marshal(tag, in.Elem()) + case reflect.Struct: + e.structv(tag, in) + case reflect.Slice, reflect.Array: + e.slicev(tag, in) + case reflect.String: + e.stringv(tag, in) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + e.intv(tag, in) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + e.uintv(tag, in) + case reflect.Float32, reflect.Float64: + e.floatv(tag, in) + case reflect.Bool: + e.boolv(tag, in) + default: + panic("cannot marshal type: " + in.Type().String()) + } +} + +func (e *encoder) mapv(tag string, in reflect.Value) { + e.mappingv(tag, func() { + keys := keyList(in.MapKeys()) + sort.Sort(keys) + for _, k := range keys { + e.marshal("", k) + e.marshal("", in.MapIndex(k)) + } + }) +} + +func (e *encoder) fieldByIndex(v reflect.Value, index []int) (field reflect.Value) { + for _, num := range index { + for { + if v.Kind() == reflect.Ptr { + if v.IsNil() { + return reflect.Value{} + } + v = v.Elem() + continue + } + break + } + v = v.Field(num) + } + return v +} + +func (e *encoder) structv(tag string, in reflect.Value) { + sinfo, err := getStructInfo(in.Type()) + if err != nil { + panic(err) + } + e.mappingv(tag, func() { + for _, info := range sinfo.FieldsList { + var value reflect.Value + if info.Inline == nil { + value = in.Field(info.Num) + } else { + value = e.fieldByIndex(in, info.Inline) + if !value.IsValid() { + continue + } + } + if info.OmitEmpty && isZero(value) { + continue + } + e.marshal("", reflect.ValueOf(info.Key)) + e.flow = info.Flow + e.marshal("", value) + } + if sinfo.InlineMap >= 0 { + m := in.Field(sinfo.InlineMap) + if m.Len() > 0 { + e.flow = false + keys := keyList(m.MapKeys()) + sort.Sort(keys) + for _, k := range keys { + if _, found := sinfo.FieldsMap[k.String()]; found { + panic(fmt.Sprintf("cannot have key %q in inlined map: conflicts with struct field", k.String())) + } + e.marshal("", k) + e.flow = false + e.marshal("", m.MapIndex(k)) + } + } + } + }) +} + +func (e *encoder) mappingv(tag string, f func()) { + implicit := tag == "" + style := yaml_BLOCK_MAPPING_STYLE + if e.flow { + e.flow = false + style = yaml_FLOW_MAPPING_STYLE + } + yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style) + e.emit() + f() + yaml_mapping_end_event_initialize(&e.event) + e.emit() +} + +func (e *encoder) slicev(tag string, in reflect.Value) { + implicit := tag == "" + style := yaml_BLOCK_SEQUENCE_STYLE + if e.flow { + e.flow = false + style = yaml_FLOW_SEQUENCE_STYLE + } + e.must(yaml_sequence_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)) + e.emit() + n := in.Len() + for i := 0; i < n; i++ { + e.marshal("", in.Index(i)) + } + e.must(yaml_sequence_end_event_initialize(&e.event)) + e.emit() +} + +// isBase60 returns whether s is in base 60 notation as defined in YAML 1.1. +// +// The base 60 float notation in YAML 1.1 is a terrible idea and is unsupported +// in YAML 1.2 and by this package, but these should be marshalled quoted for +// the time being for compatibility with other parsers. +func isBase60Float(s string) (result bool) { + // Fast path. + if s == "" { + return false + } + c := s[0] + if !(c == '+' || c == '-' || c >= '0' && c <= '9') || strings.IndexByte(s, ':') < 0 { + return false + } + // Do the full match. + return base60float.MatchString(s) +} + +// From http://yaml.org/type/float.html, except the regular expression there +// is bogus. In practice parsers do not enforce the "\.[0-9_]*" suffix. +var base60float = regexp.MustCompile(`^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+(?:\.[0-9_]*)?$`) + +// isOldBool returns whether s is bool notation as defined in YAML 1.1. +// +// We continue to force strings that YAML 1.1 would interpret as booleans to be +// rendered as quotes strings so that the marshalled output valid for YAML 1.1 +// parsing. +func isOldBool(s string) (result bool) { + switch s { + case "y", "Y", "yes", "Yes", "YES", "on", "On", "ON", + "n", "N", "no", "No", "NO", "off", "Off", "OFF": + return true + default: + return false + } +} + +func (e *encoder) stringv(tag string, in reflect.Value) { + var style yaml_scalar_style_t + s := in.String() + canUsePlain := true + switch { + case !utf8.ValidString(s): + if tag == binaryTag { + failf("explicitly tagged !!binary data must be base64-encoded") + } + if tag != "" { + failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag)) + } + // It can't be encoded directly as YAML so use a binary tag + // and encode it as base64. + tag = binaryTag + s = encodeBase64(s) + case tag == "": + // Check to see if it would resolve to a specific + // tag when encoded unquoted. If it doesn't, + // there's no need to quote it. + rtag, _ := resolve("", s) + canUsePlain = rtag == strTag && !(isBase60Float(s) || isOldBool(s)) + } + // Note: it's possible for user code to emit invalid YAML + // if they explicitly specify a tag and a string containing + // text that's incompatible with that tag. + switch { + case strings.Contains(s, "\n"): + if e.flow { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } else { + style = yaml_LITERAL_SCALAR_STYLE + } + case canUsePlain: + style = yaml_PLAIN_SCALAR_STYLE + default: + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + e.emitScalar(s, "", tag, style, nil, nil, nil, nil) +} + +func (e *encoder) boolv(tag string, in reflect.Value) { + var s string + if in.Bool() { + s = "true" + } else { + s = "false" + } + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) intv(tag string, in reflect.Value) { + s := strconv.FormatInt(in.Int(), 10) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) uintv(tag string, in reflect.Value) { + s := strconv.FormatUint(in.Uint(), 10) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) timev(tag string, in reflect.Value) { + t := in.Interface().(time.Time) + s := t.Format(time.RFC3339Nano) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) floatv(tag string, in reflect.Value) { + // Issue #352: When formatting, use the precision of the underlying value + precision := 64 + if in.Kind() == reflect.Float32 { + precision = 32 + } + + s := strconv.FormatFloat(in.Float(), 'g', -1, precision) + switch s { + case "+Inf": + s = ".inf" + case "-Inf": + s = "-.inf" + case "NaN": + s = ".nan" + } + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) nilv() { + e.emitScalar("null", "", "", yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) emitScalar(value, anchor, tag string, style yaml_scalar_style_t, head, line, foot, tail []byte) { + // TODO Kill this function. Replace all initialize calls by their underlining Go literals. + implicit := tag == "" + if !implicit { + tag = longTag(tag) + } + e.must(yaml_scalar_event_initialize(&e.event, []byte(anchor), []byte(tag), []byte(value), implicit, implicit, style)) + e.event.head_comment = head + e.event.line_comment = line + e.event.foot_comment = foot + e.event.tail_comment = tail + e.emit() +} + +func (e *encoder) nodev(in reflect.Value) { + e.node(in.Interface().(*Node), "") +} + +func (e *encoder) node(node *Node, tail string) { + // If the tag was not explicitly requested, and dropping it won't change the + // implicit tag of the value, don't include it in the presentation. + var tag = node.Tag + var stag = shortTag(tag) + var rtag string + var forceQuoting bool + if tag != "" && node.Style&TaggedStyle == 0 { + if node.Kind == ScalarNode { + if stag == strTag && node.Style&(SingleQuotedStyle|DoubleQuotedStyle|LiteralStyle|FoldedStyle) != 0 { + tag = "" + } else { + rtag, _ = resolve("", node.Value) + if rtag == stag { + tag = "" + } else if stag == strTag { + tag = "" + forceQuoting = true + } + } + } else { + switch node.Kind { + case MappingNode: + rtag = mapTag + case SequenceNode: + rtag = seqTag + } + if rtag == stag { + tag = "" + } + } + } + + switch node.Kind { + case DocumentNode: + yaml_document_start_event_initialize(&e.event, nil, nil, true) + e.event.head_comment = []byte(node.HeadComment) + e.emit() + for _, node := range node.Content { + e.node(node, "") + } + yaml_document_end_event_initialize(&e.event, true) + e.event.foot_comment = []byte(node.FootComment) + e.emit() + + case SequenceNode: + style := yaml_BLOCK_SEQUENCE_STYLE + if node.Style&FlowStyle != 0 { + style = yaml_FLOW_SEQUENCE_STYLE + } + e.must(yaml_sequence_start_event_initialize(&e.event, []byte(node.Anchor), []byte(tag), tag == "", style)) + e.event.head_comment = []byte(node.HeadComment) + e.emit() + for _, node := range node.Content { + e.node(node, "") + } + e.must(yaml_sequence_end_event_initialize(&e.event)) + e.event.line_comment = []byte(node.LineComment) + e.event.foot_comment = []byte(node.FootComment) + e.emit() + + case MappingNode: + style := yaml_BLOCK_MAPPING_STYLE + if node.Style&FlowStyle != 0 { + style = yaml_FLOW_MAPPING_STYLE + } + yaml_mapping_start_event_initialize(&e.event, []byte(node.Anchor), []byte(tag), tag == "", style) + e.event.tail_comment = []byte(tail) + e.event.head_comment = []byte(node.HeadComment) + e.emit() + + // The tail logic below moves the foot comment of prior keys to the following key, + // since the value for each key may be a nested structure and the foot needs to be + // processed only the entirety of the value is streamed. The last tail is processed + // with the mapping end event. + var tail string + for i := 0; i+1 < len(node.Content); i += 2 { + k := node.Content[i] + foot := k.FootComment + if foot != "" { + kopy := *k + kopy.FootComment = "" + k = &kopy + } + e.node(k, tail) + tail = foot + + v := node.Content[i+1] + e.node(v, "") + } + + yaml_mapping_end_event_initialize(&e.event) + e.event.tail_comment = []byte(tail) + e.event.line_comment = []byte(node.LineComment) + e.event.foot_comment = []byte(node.FootComment) + e.emit() + + case AliasNode: + yaml_alias_event_initialize(&e.event, []byte(node.Value)) + e.event.head_comment = []byte(node.HeadComment) + e.event.line_comment = []byte(node.LineComment) + e.event.foot_comment = []byte(node.FootComment) + e.emit() + + case ScalarNode: + value := node.Value + if !utf8.ValidString(value) { + if tag == binaryTag { + failf("explicitly tagged !!binary data must be base64-encoded") + } + if tag != "" { + failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag)) + } + // It can't be encoded directly as YAML so use a binary tag + // and encode it as base64. + tag = binaryTag + value = encodeBase64(value) + } + + style := yaml_PLAIN_SCALAR_STYLE + switch { + case node.Style&DoubleQuotedStyle != 0: + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + case node.Style&SingleQuotedStyle != 0: + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + case node.Style&LiteralStyle != 0: + style = yaml_LITERAL_SCALAR_STYLE + case node.Style&FoldedStyle != 0: + style = yaml_FOLDED_SCALAR_STYLE + case strings.Contains(value, "\n"): + style = yaml_LITERAL_SCALAR_STYLE + case forceQuoting: + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + + e.emitScalar(value, node.Anchor, tag, style, []byte(node.HeadComment), []byte(node.LineComment), []byte(node.FootComment), []byte(tail)) + } +} diff --git a/vendor/gopkg.in/yaml.v2/go.mod b/vendor/gopkg.in/yaml.v3/go.mod similarity index 72% rename from vendor/gopkg.in/yaml.v2/go.mod rename to vendor/gopkg.in/yaml.v3/go.mod index 1934e8769..f407ea321 100644 --- a/vendor/gopkg.in/yaml.v2/go.mod +++ b/vendor/gopkg.in/yaml.v3/go.mod @@ -1,4 +1,4 @@ -module "gopkg.in/yaml.v2" +module "gopkg.in/yaml.v3" require ( "gopkg.in/check.v1" v0.0.0-20161208181325-20d25e280405 diff --git a/vendor/gopkg.in/yaml.v2/parserc.go b/vendor/gopkg.in/yaml.v3/parserc.go similarity index 86% rename from vendor/gopkg.in/yaml.v2/parserc.go rename to vendor/gopkg.in/yaml.v3/parserc.go index 81d05dfe5..aea9050b8 100644 --- a/vendor/gopkg.in/yaml.v2/parserc.go +++ b/vendor/gopkg.in/yaml.v3/parserc.go @@ -1,3 +1,25 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + package yaml import ( @@ -45,11 +67,46 @@ import ( // Peek the next token in the token queue. func peek_token(parser *yaml_parser_t) *yaml_token_t { if parser.token_available || yaml_parser_fetch_more_tokens(parser) { - return &parser.tokens[parser.tokens_head] + token := &parser.tokens[parser.tokens_head] + yaml_parser_unfold_comments(parser, token) + return token } return nil } +// yaml_parser_unfold_comments walks through the comments queue and joins all +// comments behind the position of the provided token into the respective +// top-level comment slices in the parser. +func yaml_parser_unfold_comments(parser *yaml_parser_t, token *yaml_token_t) { + for parser.comments_head < len(parser.comments) && token.start_mark.index >= parser.comments[parser.comments_head].token_mark.index { + comment := &parser.comments[parser.comments_head] + if len(comment.head) > 0 { + if token.typ == yaml_BLOCK_END_TOKEN { + // No heads on ends, so keep comment.head for a follow up token. + break + } + if len(parser.head_comment) > 0 { + parser.head_comment = append(parser.head_comment, '\n') + } + parser.head_comment = append(parser.head_comment, comment.head...) + } + if len(comment.foot) > 0 { + if len(parser.foot_comment) > 0 { + parser.foot_comment = append(parser.foot_comment, '\n') + } + parser.foot_comment = append(parser.foot_comment, comment.foot...) + } + if len(comment.line) > 0 { + if len(parser.line_comment) > 0 { + parser.line_comment = append(parser.line_comment, '\n') + } + parser.line_comment = append(parser.line_comment, comment.line...) + } + *comment = yaml_comment_t{} + parser.comments_head++ + } +} + // Remove the next token from the queue (must be called after peek_token). func skip_token(parser *yaml_parser_t) { parser.token_available = false @@ -224,10 +281,32 @@ func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) parser.state = yaml_PARSE_BLOCK_NODE_STATE + var head_comment []byte + if len(parser.head_comment) > 0 { + // [Go] Scan the header comment backwards, and if an empty line is found, break + // the header so the part before the last empty line goes into the + // document header, while the bottom of it goes into a follow up event. + for i := len(parser.head_comment) - 1; i > 0; i-- { + if parser.head_comment[i] == '\n' { + if i == len(parser.head_comment)-1 { + head_comment = parser.head_comment[:i] + parser.head_comment = parser.head_comment[i+1:] + break + } else if parser.head_comment[i-1] == '\n' { + head_comment = parser.head_comment[:i-1] + parser.head_comment = parser.head_comment[i+1:] + break + } + } + } + } + *event = yaml_event_t{ typ: yaml_DOCUMENT_START_EVENT, start_mark: token.start_mark, end_mark: token.end_mark, + + head_comment: head_comment, } } else if token.typ != yaml_STREAM_END_TOKEN { @@ -284,6 +363,7 @@ func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event if token == nil { return false } + if token.typ == yaml_VERSION_DIRECTIVE_TOKEN || token.typ == yaml_TAG_DIRECTIVE_TOKEN || token.typ == yaml_DOCUMENT_START_TOKEN || @@ -327,9 +407,25 @@ func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) end_mark: end_mark, implicit: implicit, } + yaml_parser_set_event_comments(parser, event) + if len(event.head_comment) > 0 && len(event.foot_comment) == 0 { + event.foot_comment = event.head_comment + event.head_comment = nil + } return true } +func yaml_parser_set_event_comments(parser *yaml_parser_t, event *yaml_event_t) { + event.head_comment = parser.head_comment + event.line_comment = parser.line_comment + event.foot_comment = parser.foot_comment + parser.head_comment = nil + parser.line_comment = nil + parser.foot_comment = nil + parser.tail_comment = nil + parser.stem_comment = nil +} + // Parse the productions: // block_node_or_indentless_sequence ::= // ALIAS @@ -373,6 +469,7 @@ func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, i end_mark: token.end_mark, anchor: token.value, } + yaml_parser_set_event_comments(parser, event) skip_token(parser) return true } @@ -486,6 +583,7 @@ func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, i quoted_implicit: quoted_implicit, style: yaml_style_t(token.style), } + yaml_parser_set_event_comments(parser, event) skip_token(parser) return true } @@ -502,6 +600,7 @@ func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, i implicit: implicit, style: yaml_style_t(yaml_FLOW_SEQUENCE_STYLE), } + yaml_parser_set_event_comments(parser, event) return true } if token.typ == yaml_FLOW_MAPPING_START_TOKEN { @@ -516,6 +615,7 @@ func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, i implicit: implicit, style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), } + yaml_parser_set_event_comments(parser, event) return true } if block && token.typ == yaml_BLOCK_SEQUENCE_START_TOKEN { @@ -530,6 +630,10 @@ func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, i implicit: implicit, style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), } + if parser.stem_comment != nil { + event.head_comment = parser.stem_comment + parser.stem_comment = nil + } return true } if block && token.typ == yaml_BLOCK_MAPPING_START_TOKEN { @@ -590,11 +694,25 @@ func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_e if token.typ == yaml_BLOCK_ENTRY_TOKEN { mark := token.end_mark + prior_head := len(parser.head_comment) skip_token(parser) token = peek_token(parser) if token == nil { return false } + if prior_head > 0 && token.typ == yaml_BLOCK_SEQUENCE_START_TOKEN { + // [Go] It's a sequence under a sequence entry, so the former head comment + // is for the list itself, not the first list item under it. + parser.stem_comment = parser.head_comment[:prior_head] + if len(parser.head_comment) == prior_head { + parser.head_comment = nil + } else { + // Copy suffix to prevent very strange bugs if someone ever appends + // further bytes to the prefix in the stem_comment slice above. + parser.head_comment = append([]byte(nil), parser.head_comment[prior_head+1:]...) + } + + } if token.typ != yaml_BLOCK_ENTRY_TOKEN && token.typ != yaml_BLOCK_END_TOKEN { parser.states = append(parser.states, yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE) return yaml_parser_parse_node(parser, event, true, false) @@ -684,6 +802,19 @@ func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_even return false } + // [Go] A tail comment was left from the prior mapping value processed. Emit an event + // as it needs to be processed with that value and not the following key. + if len(parser.tail_comment) > 0 { + *event = yaml_event_t{ + typ: yaml_TAIL_COMMENT_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + foot_comment: parser.tail_comment, + } + parser.tail_comment = nil + return true + } + if token.typ == yaml_KEY_TOKEN { mark := token.end_mark skip_token(parser) @@ -709,6 +840,7 @@ func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_even start_mark: token.start_mark, end_mark: token.end_mark, } + yaml_parser_set_event_comments(parser, event) skip_token(parser) return true } @@ -820,6 +952,7 @@ func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_ev start_mark: token.start_mark, end_mark: token.end_mark, } + yaml_parser_set_event_comments(parser, event) skip_token(parser) return true @@ -959,6 +1092,7 @@ func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event start_mark: token.start_mark, end_mark: token.end_mark, } + yaml_parser_set_event_comments(parser, event) skip_token(parser) return true } diff --git a/vendor/gopkg.in/yaml.v2/readerc.go b/vendor/gopkg.in/yaml.v3/readerc.go similarity index 91% rename from vendor/gopkg.in/yaml.v2/readerc.go rename to vendor/gopkg.in/yaml.v3/readerc.go index 7c1f5fac3..b7de0a89c 100644 --- a/vendor/gopkg.in/yaml.v2/readerc.go +++ b/vendor/gopkg.in/yaml.v3/readerc.go @@ -1,3 +1,25 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + package yaml import ( @@ -95,7 +117,7 @@ func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool { // [Go] This function was changed to guarantee the requested length size at EOF. // The fact we need to do this is pretty awful, but the description above implies - // for that to be the case, and there are tests + // for that to be the case, and there are tests // If the EOF flag is set and the raw buffer is empty, do nothing. if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) { diff --git a/vendor/gopkg.in/yaml.v2/resolve.go b/vendor/gopkg.in/yaml.v3/resolve.go similarity index 60% rename from vendor/gopkg.in/yaml.v2/resolve.go rename to vendor/gopkg.in/yaml.v3/resolve.go index 4120e0c91..64ae88805 100644 --- a/vendor/gopkg.in/yaml.v2/resolve.go +++ b/vendor/gopkg.in/yaml.v3/resolve.go @@ -1,3 +1,18 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package yaml import ( @@ -34,18 +49,14 @@ func init() { tag string l []string }{ - {true, yaml_BOOL_TAG, []string{"y", "Y", "yes", "Yes", "YES"}}, - {true, yaml_BOOL_TAG, []string{"true", "True", "TRUE"}}, - {true, yaml_BOOL_TAG, []string{"on", "On", "ON"}}, - {false, yaml_BOOL_TAG, []string{"n", "N", "no", "No", "NO"}}, - {false, yaml_BOOL_TAG, []string{"false", "False", "FALSE"}}, - {false, yaml_BOOL_TAG, []string{"off", "Off", "OFF"}}, - {nil, yaml_NULL_TAG, []string{"", "~", "null", "Null", "NULL"}}, - {math.NaN(), yaml_FLOAT_TAG, []string{".nan", ".NaN", ".NAN"}}, - {math.Inf(+1), yaml_FLOAT_TAG, []string{".inf", ".Inf", ".INF"}}, - {math.Inf(+1), yaml_FLOAT_TAG, []string{"+.inf", "+.Inf", "+.INF"}}, - {math.Inf(-1), yaml_FLOAT_TAG, []string{"-.inf", "-.Inf", "-.INF"}}, - {"<<", yaml_MERGE_TAG, []string{"<<"}}, + {true, boolTag, []string{"true", "True", "TRUE"}}, + {false, boolTag, []string{"false", "False", "FALSE"}}, + {nil, nullTag, []string{"", "~", "null", "Null", "NULL"}}, + {math.NaN(), floatTag, []string{".nan", ".NaN", ".NAN"}}, + {math.Inf(+1), floatTag, []string{".inf", ".Inf", ".INF"}}, + {math.Inf(+1), floatTag, []string{"+.inf", "+.Inf", "+.INF"}}, + {math.Inf(-1), floatTag, []string{"-.inf", "-.Inf", "-.INF"}}, + {"<<", mergeTag, []string{"<<"}}, } m := resolveMap @@ -56,11 +67,37 @@ func init() { } } +const ( + nullTag = "!!null" + boolTag = "!!bool" + strTag = "!!str" + intTag = "!!int" + floatTag = "!!float" + timestampTag = "!!timestamp" + seqTag = "!!seq" + mapTag = "!!map" + binaryTag = "!!binary" + mergeTag = "!!merge" +) + +var longTags = make(map[string]string) +var shortTags = make(map[string]string) + +func init() { + for _, stag := range []string{nullTag, boolTag, strTag, intTag, floatTag, timestampTag, seqTag, mapTag, binaryTag, mergeTag} { + ltag := longTag(stag) + longTags[stag] = ltag + shortTags[ltag] = stag + } +} + const longTagPrefix = "tag:yaml.org,2002:" func shortTag(tag string) string { - // TODO This can easily be made faster and produce less garbage. if strings.HasPrefix(tag, longTagPrefix) { + if stag, ok := shortTags[tag]; ok { + return stag + } return "!!" + tag[len(longTagPrefix):] } return tag @@ -68,6 +105,9 @@ func shortTag(tag string) string { func longTag(tag string) string { if strings.HasPrefix(tag, "!!") { + if ltag, ok := longTags[tag]; ok { + return ltag + } return longTagPrefix + tag[2:] } return tag @@ -75,7 +115,7 @@ func longTag(tag string) string { func resolvableTag(tag string) bool { switch tag { - case "", yaml_STR_TAG, yaml_BOOL_TAG, yaml_INT_TAG, yaml_FLOAT_TAG, yaml_NULL_TAG, yaml_TIMESTAMP_TAG: + case "", strTag, boolTag, intTag, floatTag, nullTag, timestampTag: return true } return false @@ -84,23 +124,24 @@ func resolvableTag(tag string) bool { var yamlStyleFloat = regexp.MustCompile(`^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$`) func resolve(tag string, in string) (rtag string, out interface{}) { + tag = shortTag(tag) if !resolvableTag(tag) { return tag, in } defer func() { switch tag { - case "", rtag, yaml_STR_TAG, yaml_BINARY_TAG: + case "", rtag, strTag, binaryTag: return - case yaml_FLOAT_TAG: - if rtag == yaml_INT_TAG { + case floatTag: + if rtag == intTag { switch v := out.(type) { case int64: - rtag = yaml_FLOAT_TAG + rtag = floatTag out = float64(v) return case int: - rtag = yaml_FLOAT_TAG + rtag = floatTag out = float64(v) return } @@ -115,7 +156,7 @@ func resolve(tag string, in string) (rtag string, out interface{}) { if in != "" { hint = resolveTable[in[0]] } - if hint != 0 && tag != yaml_STR_TAG && tag != yaml_BINARY_TAG { + if hint != 0 && tag != strTag && tag != binaryTag { // Handle things we can lookup in a map. if item, ok := resolveMap[in]; ok { return item.tag, item.value @@ -133,17 +174,17 @@ func resolve(tag string, in string) (rtag string, out interface{}) { // Not in the map, so maybe a normal float. floatv, err := strconv.ParseFloat(in, 64) if err == nil { - return yaml_FLOAT_TAG, floatv + return floatTag, floatv } case 'D', 'S': // Int, float, or timestamp. // Only try values as a timestamp if the value is unquoted or there's an explicit // !!timestamp tag. - if tag == "" || tag == yaml_TIMESTAMP_TAG { + if tag == "" || tag == timestampTag { t, ok := parseTimestamp(in) if ok { - return yaml_TIMESTAMP_TAG, t + return timestampTag, t } } @@ -151,49 +192,76 @@ func resolve(tag string, in string) (rtag string, out interface{}) { intv, err := strconv.ParseInt(plain, 0, 64) if err == nil { if intv == int64(int(intv)) { - return yaml_INT_TAG, int(intv) + return intTag, int(intv) } else { - return yaml_INT_TAG, intv + return intTag, intv } } uintv, err := strconv.ParseUint(plain, 0, 64) if err == nil { - return yaml_INT_TAG, uintv + return intTag, uintv } if yamlStyleFloat.MatchString(plain) { floatv, err := strconv.ParseFloat(plain, 64) if err == nil { - return yaml_FLOAT_TAG, floatv + return floatTag, floatv } } if strings.HasPrefix(plain, "0b") { intv, err := strconv.ParseInt(plain[2:], 2, 64) if err == nil { if intv == int64(int(intv)) { - return yaml_INT_TAG, int(intv) + return intTag, int(intv) } else { - return yaml_INT_TAG, intv + return intTag, intv } } uintv, err := strconv.ParseUint(plain[2:], 2, 64) if err == nil { - return yaml_INT_TAG, uintv + return intTag, uintv } } else if strings.HasPrefix(plain, "-0b") { - intv, err := strconv.ParseInt("-" + plain[3:], 2, 64) + intv, err := strconv.ParseInt("-"+plain[3:], 2, 64) if err == nil { if true || intv == int64(int(intv)) { - return yaml_INT_TAG, int(intv) + return intTag, int(intv) } else { - return yaml_INT_TAG, intv + return intTag, intv + } + } + } + // Octals as introduced in version 1.2 of the spec. + // Octals from the 1.1 spec, spelled as 0777, are still + // decoded by default in v3 as well for compatibility. + // May be dropped in v4 depending on how usage evolves. + if strings.HasPrefix(plain, "0o") { + intv, err := strconv.ParseInt(plain[2:], 8, 64) + if err == nil { + if intv == int64(int(intv)) { + return intTag, int(intv) + } else { + return intTag, intv + } + } + uintv, err := strconv.ParseUint(plain[2:], 8, 64) + if err == nil { + return intTag, uintv + } + } else if strings.HasPrefix(plain, "-0o") { + intv, err := strconv.ParseInt("-"+plain[3:], 8, 64) + if err == nil { + if true || intv == int64(int(intv)) { + return intTag, int(intv) + } else { + return intTag, intv } } } default: - panic("resolveTable item not yet handled: " + string(rune(hint)) + " (with " + in + ")") + panic("internal error: missing handler for resolver table: " + string(rune(hint)) + " (with " + in + ")") } } - return yaml_STR_TAG, in + return strTag, in } // encodeBase64 encodes s as base64 that is broken up into multiple lines diff --git a/vendor/gopkg.in/yaml.v2/scannerc.go b/vendor/gopkg.in/yaml.v3/scannerc.go similarity index 87% rename from vendor/gopkg.in/yaml.v2/scannerc.go rename to vendor/gopkg.in/yaml.v3/scannerc.go index 0b9bb6030..57e954ca5 100644 --- a/vendor/gopkg.in/yaml.v2/scannerc.go +++ b/vendor/gopkg.in/yaml.v3/scannerc.go @@ -1,3 +1,25 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + package yaml import ( @@ -489,6 +511,9 @@ func cache(parser *yaml_parser_t, length int) bool { // Advance the buffer pointer. func skip(parser *yaml_parser_t) { + if !is_blank(parser.buffer, parser.buffer_pos) { + parser.newlines = 0 + } parser.mark.index++ parser.mark.column++ parser.unread-- @@ -502,17 +527,22 @@ func skip_line(parser *yaml_parser_t) { parser.mark.line++ parser.unread -= 2 parser.buffer_pos += 2 + parser.newlines++ } else if is_break(parser.buffer, parser.buffer_pos) { parser.mark.index++ parser.mark.column = 0 parser.mark.line++ parser.unread-- parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) + parser.newlines++ } } // Copy a character to a string buffer and advance pointers. func read(parser *yaml_parser_t, s []byte) []byte { + if !is_blank(parser.buffer, parser.buffer_pos) { + parser.newlines = 0 + } w := width(parser.buffer[parser.buffer_pos]) if w == 0 { panic("invalid character sequence") @@ -564,6 +594,7 @@ func read_line(parser *yaml_parser_t, s []byte) []byte { parser.mark.column = 0 parser.mark.line++ parser.unread-- + parser.newlines++ return s } @@ -626,9 +657,13 @@ func trace(args ...interface{}) func() { func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool { // While we need more tokens to fetch, do it. for { - if parser.tokens_head != len(parser.tokens) { - // If queue is non-empty, check if any potential simple key may - // occupy the head position. + // [Go] The comment parsing logic requires a lookahead of two tokens + // so that foot comments may be parsed in time of associating them + // with the tokens that are parsed before them, and also for line + // comments to be transformed into head comments in some edge cases. + if parser.tokens_head < len(parser.tokens)-2 { + // If a potential simple key is at the head position, we need to fetch + // the next token to disambiguate it. head_tok_idx, ok := parser.simple_keys_by_tok[parser.tokens_parsed] if !ok { break @@ -649,7 +684,7 @@ func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool { } // The dispatcher for token fetchers. -func yaml_parser_fetch_next_token(parser *yaml_parser_t) bool { +func yaml_parser_fetch_next_token(parser *yaml_parser_t) (ok bool) { // Ensure that the buffer is initialized. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { return false @@ -660,13 +695,19 @@ func yaml_parser_fetch_next_token(parser *yaml_parser_t) bool { return yaml_parser_fetch_stream_start(parser) } + scan_mark := parser.mark + // Eat whitespaces and comments until we reach the next token. if !yaml_parser_scan_to_next_token(parser) { return false } + // [Go] While unrolling indents, transform the head comments of prior + // indentation levels observed after scan_start into foot comments at + // the respective indexes. + // Check the indentation level against the current column. - if !yaml_parser_unroll_indent(parser, parser.mark.column) { + if !yaml_parser_unroll_indent(parser, parser.mark.column, scan_mark) { return false } @@ -699,6 +740,21 @@ func yaml_parser_fetch_next_token(parser *yaml_parser_t) bool { return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_END_TOKEN) } + comment_mark := parser.mark + if len(parser.tokens) > 0 && (parser.flow_level == 0 && buf[pos] == ':' || parser.flow_level > 0 && buf[pos] == ',') { + // Associate any following comments with the prior token. + comment_mark = parser.tokens[len(parser.tokens)-1].start_mark + } + defer func() { + if !ok { + return + } + if !yaml_parser_scan_line_comment(parser, comment_mark) { + ok = false + return + } + }() + // Is it the flow sequence start indicator? if buf[pos] == '[' { return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_SEQUENCE_START_TOKEN) @@ -792,7 +848,7 @@ func yaml_parser_fetch_next_token(parser *yaml_parser_t) bool { // if it is followed by a non-space character. // // The last rule is more restrictive than the specification requires. - // [Go] Make this logic more reasonable. + // [Go] TODO Make this logic more reasonable. //switch parser.buffer[parser.buffer_pos] { //case '-', '?', ':', ',', '?', '-', ',', ':', ']', '[', '}', '{', '&', '#', '!', '*', '>', '|', '"', '\'', '@', '%', '-', '`': //} @@ -965,19 +1021,49 @@ func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, typ yaml // Pop indentation levels from the indents stack until the current level // becomes less or equal to the column. For each indentation level, append // the BLOCK-END token. -func yaml_parser_unroll_indent(parser *yaml_parser_t, column int) bool { +func yaml_parser_unroll_indent(parser *yaml_parser_t, column int, scan_mark yaml_mark_t) bool { // In the flow context, do nothing. if parser.flow_level > 0 { return true } + block_mark := scan_mark + block_mark.index-- + // Loop through the indentation levels in the stack. for parser.indent > column { + + // [Go] Reposition the end token before potential following + // foot comments of parent blocks. For that, search + // backwards for recent comments that were at the same + // indent as the block that is ending now. + stop_index := block_mark.index + for i := len(parser.comments) - 1; i >= 0; i-- { + comment := &parser.comments[i] + + if comment.end_mark.index < stop_index { + // Don't go back beyond the start of the comment/whitespace scan, unless column < 0. + // If requested indent column is < 0, then the document is over and everything else + // is a foot anyway. + break + } + if comment.start_mark.column == parser.indent+1 { + // This is a good match. But maybe there's a former comment + // at that same indent level, so keep searching. + block_mark = comment.start_mark + } + + // While the end of the former comment matches with + // the start of the following one, we know there's + // nothing in between and scanning is still safe. + stop_index = comment.scan_mark.index + } + // Create a token and append it to the queue. token := yaml_token_t{ typ: yaml_BLOCK_END_TOKEN, - start_mark: parser.mark, - end_mark: parser.mark, + start_mark: block_mark, + end_mark: block_mark, } yaml_insert_token(parser, -1, &token) @@ -1026,7 +1112,7 @@ func yaml_parser_fetch_stream_end(parser *yaml_parser_t) bool { } // Reset the indentation level. - if !yaml_parser_unroll_indent(parser, -1) { + if !yaml_parser_unroll_indent(parser, -1, parser.mark) { return false } @@ -1050,7 +1136,7 @@ func yaml_parser_fetch_stream_end(parser *yaml_parser_t) bool { // Produce a VERSION-DIRECTIVE or TAG-DIRECTIVE token. func yaml_parser_fetch_directive(parser *yaml_parser_t) bool { // Reset the indentation level. - if !yaml_parser_unroll_indent(parser, -1) { + if !yaml_parser_unroll_indent(parser, -1, parser.mark) { return false } @@ -1074,7 +1160,7 @@ func yaml_parser_fetch_directive(parser *yaml_parser_t) bool { // Produce the DOCUMENT-START or DOCUMENT-END token. func yaml_parser_fetch_document_indicator(parser *yaml_parser_t, typ yaml_token_type_t) bool { // Reset the indentation level. - if !yaml_parser_unroll_indent(parser, -1) { + if !yaml_parser_unroll_indent(parser, -1, parser.mark) { return false } @@ -1107,6 +1193,7 @@ func yaml_parser_fetch_document_indicator(parser *yaml_parser_t, typ yaml_token_ // Produce the FLOW-SEQUENCE-START or FLOW-MAPPING-START token. func yaml_parser_fetch_flow_collection_start(parser *yaml_parser_t, typ yaml_token_type_t) bool { + // The indicators '[' and '{' may start a simple key. if !yaml_parser_save_simple_key(parser) { return false @@ -1442,6 +1529,8 @@ func yaml_parser_fetch_plain_scalar(parser *yaml_parser_t) bool { // Eat whitespaces and comments until the next token is found. func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { + scan_mark := parser.mark + // Until the next token is not found. for { // Allow the BOM mark to start a line. @@ -1468,13 +1557,33 @@ func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { } } + // Check if we just had a line comment under a sequence entry that + // looks more like a header to the following content. Similar to this: + // + // - # The comment + // - Some data + // + // If so, transform the line comment to a head comment and reposition. + if len(parser.comments) > 0 && len(parser.tokens) > 1 { + tokenA := parser.tokens[len(parser.tokens)-2] + tokenB := parser.tokens[len(parser.tokens)-1] + comment := &parser.comments[len(parser.comments)-1] + if tokenA.typ == yaml_BLOCK_SEQUENCE_START_TOKEN && tokenB.typ == yaml_BLOCK_ENTRY_TOKEN && len(comment.line) > 0 && !is_break(parser.buffer, parser.buffer_pos) { + // If it was in the prior line, reposition so it becomes a + // header of the follow up token. Otherwise, keep it in place + // so it becomes a header of the former. + comment.head = comment.line + comment.line = nil + if comment.start_mark.line == parser.mark.line-1 { + comment.token_mark = parser.mark + } + } + } + // Eat a comment until a line break. if parser.buffer[parser.buffer_pos] == '#' { - for !is_breakz(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } + if !yaml_parser_scan_comments(parser, scan_mark) { + return false } } @@ -1572,6 +1681,10 @@ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool } if parser.buffer[parser.buffer_pos] == '#' { + // [Go] Discard this inline comment for the time being. + //if !yaml_parser_scan_line_comment(parser, start_mark) { + // return false + //} for !is_breakz(parser.buffer, parser.buffer_pos) { skip(parser) if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1987,7 +2100,7 @@ func yaml_parser_scan_tag_uri(parser *yaml_parser_t, directive bool, head []byte // '0'-'9', 'A'-'Z', 'a'-'z', '_', '-', ';', '/', '?', ':', '@', '&', // '=', '+', '$', ',', '.', '!', '~', '*', '\'', '(', ')', '[', ']', // '%'. - // [Go] Convert this into more reasonable logic. + // [Go] TODO Convert this into more reasonable logic. for is_alpha(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == ';' || parser.buffer[parser.buffer_pos] == '/' || parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == '@' || @@ -2142,6 +2255,10 @@ func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, l } } if parser.buffer[parser.buffer_pos] == '#' { + // TODO Test this and then re-enable it. + //if !yaml_parser_scan_line_comment(parser, start_mark) { + // return false + //} for !is_breakz(parser.buffer, parser.buffer_pos) { skip(parser) if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -2709,3 +2826,200 @@ func yaml_parser_scan_plain_scalar(parser *yaml_parser_t, token *yaml_token_t) b } return true } + +func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t) bool { + if parser.newlines > 0 { + return true + } + + var start_mark yaml_mark_t + var text []byte + + for peek := 0; peek < 512; peek++ { + if parser.unread < peek+1 && !yaml_parser_update_buffer(parser, peek+1) { + break + } + if is_blank(parser.buffer, parser.buffer_pos+peek) { + continue + } + if parser.buffer[parser.buffer_pos+peek] == '#' { + seen := parser.mark.index+peek + for { + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if is_breakz(parser.buffer, parser.buffer_pos) { + if parser.mark.index >= seen { + break + } + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + } else { + if parser.mark.index >= seen { + if len(text) == 0 { + start_mark = parser.mark + } + text = append(text, parser.buffer[parser.buffer_pos]) + } + skip(parser) + } + } + } + break + } + if len(text) > 0 { + parser.comments = append(parser.comments, yaml_comment_t{ + token_mark: token_mark, + start_mark: start_mark, + line: text, + }) + } + return true +} + +func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) bool { + token := parser.tokens[len(parser.tokens)-1] + + if token.typ == yaml_FLOW_ENTRY_TOKEN && len(parser.tokens) > 1 { + token = parser.tokens[len(parser.tokens)-2] + } + + var token_mark = token.start_mark + var start_mark yaml_mark_t + + var recent_empty = false + var first_empty = parser.newlines <= 1 + + var line = parser.mark.line + var column = parser.mark.column + + var text []byte + + // The foot line is the place where a comment must start to + // still be considered as a foot of the prior content. + // If there's some content in the currently parsed line, then + // the foot is the line below it. + var foot_line = -1 + if scan_mark.line > 0 { + foot_line = parser.mark.line-parser.newlines+1 + if parser.newlines == 0 && parser.mark.column > 1 { + foot_line++ + } + } + + var peek = 0 + for ; peek < 512; peek++ { + if parser.unread < peek+1 && !yaml_parser_update_buffer(parser, peek+1) { + break + } + column++ + if is_blank(parser.buffer, parser.buffer_pos+peek) { + continue + } + c := parser.buffer[parser.buffer_pos+peek] + if is_breakz(parser.buffer, parser.buffer_pos+peek) || parser.flow_level > 0 && (c == ']' || c == '}') { + // Got line break or terminator. + if !recent_empty { + if first_empty && (start_mark.line == foot_line || start_mark.column-1 < parser.indent) { + // This is the first empty line and there were no empty lines before, + // so this initial part of the comment is a foot of the prior token + // instead of being a head for the following one. Split it up. + if len(text) > 0 { + if start_mark.column-1 < parser.indent { + // If dedented it's unrelated to the prior token. + token_mark = start_mark + } + parser.comments = append(parser.comments, yaml_comment_t{ + scan_mark: scan_mark, + token_mark: token_mark, + start_mark: start_mark, + end_mark: yaml_mark_t{parser.mark.index + peek, line, column}, + foot: text, + }) + scan_mark = yaml_mark_t{parser.mark.index + peek, line, column} + token_mark = scan_mark + text = nil + } + } else { + if len(text) > 0 && parser.buffer[parser.buffer_pos+peek] != 0 { + text = append(text, '\n') + } + } + } + if !is_break(parser.buffer, parser.buffer_pos+peek) { + break + } + first_empty = false + recent_empty = true + column = 0 + line++ + continue + } + + if len(text) > 0 && column < parser.indent+1 && column != start_mark.column { + // The comment at the different indentation is a foot of the + // preceding data rather than a head of the upcoming one. + parser.comments = append(parser.comments, yaml_comment_t{ + scan_mark: scan_mark, + token_mark: token_mark, + start_mark: start_mark, + end_mark: yaml_mark_t{parser.mark.index + peek, line, column}, + foot: text, + }) + scan_mark = yaml_mark_t{parser.mark.index + peek, line, column} + token_mark = scan_mark + text = nil + } + + if parser.buffer[parser.buffer_pos+peek] != '#' { + break + } + + if len(text) == 0 { + start_mark = yaml_mark_t{parser.mark.index + peek, line, column} + } else { + text = append(text, '\n') + } + + recent_empty = false + + // Consume until after the consumed comment line. + seen := parser.mark.index+peek + for { + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if is_breakz(parser.buffer, parser.buffer_pos) { + if parser.mark.index >= seen { + break + } + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + } else { + if parser.mark.index >= seen { + text = append(text, parser.buffer[parser.buffer_pos]) + } + skip(parser) + } + } + + peek = 0 + column = 0 + line = parser.mark.line + } + + if len(text) > 0 { + parser.comments = append(parser.comments, yaml_comment_t{ + scan_mark: scan_mark, + token_mark: start_mark, + start_mark: start_mark, + end_mark: yaml_mark_t{parser.mark.index + peek - 1, line, column}, + head: text, + }) + } + return true +} diff --git a/vendor/gopkg.in/yaml.v2/sorter.go b/vendor/gopkg.in/yaml.v3/sorter.go similarity index 76% rename from vendor/gopkg.in/yaml.v2/sorter.go rename to vendor/gopkg.in/yaml.v3/sorter.go index 4c45e660a..9210ece7e 100644 --- a/vendor/gopkg.in/yaml.v2/sorter.go +++ b/vendor/gopkg.in/yaml.v3/sorter.go @@ -1,3 +1,18 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package yaml import ( @@ -37,8 +52,10 @@ func (l keyList) Less(i, j int) bool { return ak < bk } ar, br := []rune(a.String()), []rune(b.String()) + digits := false for i := 0; i < len(ar) && i < len(br); i++ { if ar[i] == br[i] { + digits = unicode.IsDigit(ar[i]) continue } al := unicode.IsLetter(ar[i]) @@ -47,12 +64,16 @@ func (l keyList) Less(i, j int) bool { return ar[i] < br[i] } if al || bl { - return bl + if digits { + return al + } else { + return bl + } } var ai, bi int var an, bn int64 if ar[i] == '0' || br[i] == '0' { - for j := i-1; j >= 0 && unicode.IsDigit(ar[j]); j-- { + for j := i - 1; j >= 0 && unicode.IsDigit(ar[j]); j-- { if ar[j] != '0' { an = 1 bn = 1 diff --git a/vendor/gopkg.in/yaml.v3/writerc.go b/vendor/gopkg.in/yaml.v3/writerc.go new file mode 100644 index 000000000..b8a116bf9 --- /dev/null +++ b/vendor/gopkg.in/yaml.v3/writerc.go @@ -0,0 +1,48 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package yaml + +// Set the writer error and return false. +func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { + emitter.error = yaml_WRITER_ERROR + emitter.problem = problem + return false +} + +// Flush the output buffer. +func yaml_emitter_flush(emitter *yaml_emitter_t) bool { + if emitter.write_handler == nil { + panic("write handler not set") + } + + // Check if the buffer is empty. + if emitter.buffer_pos == 0 { + return true + } + + if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { + return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) + } + emitter.buffer_pos = 0 + return true +} diff --git a/vendor/gopkg.in/yaml.v2/yaml.go b/vendor/gopkg.in/yaml.v3/yaml.go similarity index 59% rename from vendor/gopkg.in/yaml.v2/yaml.go rename to vendor/gopkg.in/yaml.v3/yaml.go index 89650e293..b5d35a50d 100644 --- a/vendor/gopkg.in/yaml.v2/yaml.go +++ b/vendor/gopkg.in/yaml.v3/yaml.go @@ -1,3 +1,18 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Package yaml implements YAML support for the Go language. // // Source code and other details for the project are available at GitHub: @@ -13,23 +28,16 @@ import ( "reflect" "strings" "sync" + "unicode/utf8" ) -// MapSlice encodes and decodes as a YAML map. -// The order of keys is preserved when encoding and decoding. -type MapSlice []MapItem - -// MapItem is an item in a MapSlice. -type MapItem struct { - Key, Value interface{} +// The Unmarshaler interface may be implemented by types to customize their +// behavior when being unmarshaled from a YAML document. +type Unmarshaler interface { + UnmarshalYAML(value *Node) error } -// The Unmarshaler interface may be implemented by types to customize their -// behavior when being unmarshaled from a YAML document. The UnmarshalYAML -// method receives a function that may be called to unmarshal the original -// YAML value into a field or variable. It is safe to call the unmarshal -// function parameter more than once if necessary. -type Unmarshaler interface { +type obsoleteUnmarshaler interface { UnmarshalYAML(unmarshal func(interface{}) error) error } @@ -81,18 +89,10 @@ func Unmarshal(in []byte, out interface{}) (err error) { return unmarshal(in, out, false) } -// UnmarshalStrict is like Unmarshal except that any fields that are found -// in the data that do not have corresponding struct members, or mapping -// keys that are duplicates, will result in -// an error. -func UnmarshalStrict(in []byte, out interface{}) (err error) { - return unmarshal(in, out, true) -} - -// A Decoder reads and decodes YAML values from an input stream. +// A Decorder reads and decodes YAML values from an input stream. type Decoder struct { - strict bool - parser *parser + parser *parser + knownFields bool } // NewDecoder returns a new decoder that reads from r. @@ -105,10 +105,10 @@ func NewDecoder(r io.Reader) *Decoder { } } -// SetStrict sets whether strict decoding behaviour is enabled when -// decoding items in the data (see UnmarshalStrict). By default, decoding is not strict. -func (dec *Decoder) SetStrict(strict bool) { - dec.strict = strict +// KnownFields ensures that the keys in decoded mappings to +// exist as fields in the struct being decoded into. +func (dec *Decoder) KnownFields(enable bool) { + dec.knownFields = enable } // Decode reads the next YAML-encoded value from its input @@ -117,7 +117,8 @@ func (dec *Decoder) SetStrict(strict bool) { // See the documentation for Unmarshal for details about the // conversion of YAML into a Go value. func (dec *Decoder) Decode(v interface{}) (err error) { - d := newDecoder(dec.strict) + d := newDecoder() + d.knownFields = dec.knownFields defer handleErr(&err) node := dec.parser.parse() if node == nil { @@ -134,9 +135,27 @@ func (dec *Decoder) Decode(v interface{}) (err error) { return nil } +// Decode decodes the node and stores its data into the value pointed to by v. +// +// See the documentation for Unmarshal for details about the +// conversion of YAML into a Go value. +func (n *Node) Decode(v interface{}) (err error) { + d := newDecoder() + defer handleErr(&err) + out := reflect.ValueOf(v) + if out.Kind() == reflect.Ptr && !out.IsNil() { + out = out.Elem() + } + d.unmarshal(n, out) + if len(d.terrors) > 0 { + return &TypeError{d.terrors} + } + return nil +} + func unmarshal(in []byte, out interface{}, strict bool) (err error) { defer handleErr(&err) - d := newDecoder(strict) + d := newDecoder() p := newParser(in) defer p.destroy() node := p.parse() @@ -233,6 +252,14 @@ func (e *Encoder) Encode(v interface{}) (err error) { return nil } +// SetIndent changes the used indentation used when encoding. +func (e *Encoder) SetIndent(spaces int) { + if spaces < 0 { + panic("yaml: cannot indent to a negative number of spaces") + } + e.encoder.indent = spaces +} + // Close closes the encoder by writing any remaining data. // It does not write a stream terminating string "...". func (e *Encoder) Close() (err error) { @@ -275,6 +302,150 @@ func (e *TypeError) Error() string { return fmt.Sprintf("yaml: unmarshal errors:\n %s", strings.Join(e.Errors, "\n ")) } +type Kind uint32 + +const ( + DocumentNode Kind = 1 << iota + SequenceNode + MappingNode + ScalarNode + AliasNode +) + +type Style uint32 + +const ( + TaggedStyle Style = 1 << iota + DoubleQuotedStyle + SingleQuotedStyle + LiteralStyle + FoldedStyle + FlowStyle +) + +// Node represents an element in the YAML document hierarchy. While documents +// are typically encoded and decoded into higher level types, such as structs +// and maps, Node is an intermediate representation that allows detailed +// control over the content being decoded or encoded. +// +// Values that make use of the Node type interact with the yaml package in the +// same way any other type would do, by encoding and decoding yaml data +// directly or indirectly into them. +// +// For example: +// +// var person struct { +// Name string +// Address yaml.Node +// } +// err := yaml.Unmarshal(data, &person) +// +// Or by itself: +// +// var person Node +// err := yaml.Unmarshal(data, &person) +// +type Node struct { + // Kind defines whether the node is a document, a mapping, a sequence, + // a scalar value, or an alias to another node. The specific data type of + // scalar nodes may be obtained via the ShortTag and LongTag methods. + Kind Kind + + // Style allows customizing the apperance of the node in the tree. + Style Style + + // Tag holds the YAML tag defining the data type for the value. + // When decoding, this field will always be set to the resolved tag, + // even when it wasn't explicitly provided in the YAML content. + // When encoding, if this field is unset the value type will be + // implied from the node properties, and if it is set, it will only + // be serialized into the representation if TaggedStyle is used or + // the implicit tag diverges from the provided one. + Tag string + + // Value holds the unescaped and unquoted represenation of the value. + Value string + + // Anchor holds the anchor name for this node, which allows aliases to point to it. + Anchor string + + // Alias holds the node that this alias points to. Only valid when Kind is AliasNode. + Alias *Node + + // Content holds contained nodes for documents, mappings, and sequences. + Content []*Node + + // HeadComment holds any comments in the lines preceding the node and + // not separated by an empty line. + HeadComment string + + // LineComment holds any comments at the end of the line where the node is in. + LineComment string + + // FootComment holds any comments following the node and before empty lines. + FootComment string + + // Line and Column hold the node position in the decoded YAML text. + // These fields are not respected when encoding the node. + Line int + Column int +} + +// LongTag returns the long form of the tag that indicates the data type for +// the node. If the Tag field isn't explicitly defined, one will be computed +// based on the node properties. +func (n *Node) LongTag() string { + return longTag(n.ShortTag()) +} + +// ShortTag returns the short form of the YAML tag that indicates data type for +// the node. If the Tag field isn't explicitly defined, one will be computed +// based on the node properties. +func (n *Node) ShortTag() string { + if n.indicatedString() { + return strTag + } + if n.Tag == "" || n.Tag == "!" { + switch n.Kind { + case MappingNode: + return mapTag + case SequenceNode: + return seqTag + case AliasNode: + if n.Alias != nil { + return n.Alias.ShortTag() + } + case ScalarNode: + tag, _ := resolve("", n.Value) + return tag + } + return "" + } + return shortTag(n.Tag) +} + +func (n *Node) indicatedString() bool { + return n.Kind == ScalarNode && + (shortTag(n.Tag) == strTag || + (n.Tag == "" || n.Tag == "!") && n.Style&(SingleQuotedStyle|DoubleQuotedStyle|LiteralStyle|FoldedStyle) != 0) +} + +// SetString is a convenience function that sets the node to a string value +// and defines its style in a pleasant way depending on its content. +func (n *Node) SetString(s string) { + n.Kind = ScalarNode + if utf8.ValidString(s) { + n.Value = s + n.Tag = strTag + } else { + n.Value = encodeBase64(s) + n.Tag = binaryTag + } + if strings.Contains(n.Value, "\n") { + n.Style = LiteralStyle + } +} + // -------------------------------------------------------------------------- // Maintain a mapping of keys to structure field indexes @@ -289,6 +460,10 @@ type structInfo struct { // InlineMap is the number of the field in the struct that // contains an ,inline map, or -1 if there's none. InlineMap int + + // InlineUnmarshalers holds indexes to inlined fields that + // contain unmarshaler values. + InlineUnmarshalers [][]int } type fieldInfo struct { @@ -306,6 +481,12 @@ type fieldInfo struct { var structMap = make(map[reflect.Type]*structInfo) var fieldMapMutex sync.RWMutex +var unmarshalerType reflect.Type + +func init() { + var v Unmarshaler + unmarshalerType = reflect.ValueOf(&v).Elem().Type() +} func getStructInfo(st reflect.Type) (*structInfo, error) { fieldMapMutex.RLock() @@ -319,6 +500,7 @@ func getStructInfo(st reflect.Type) (*structInfo, error) { fieldsMap := make(map[string]fieldInfo) fieldsList := make([]fieldInfo, 0, n) inlineMap := -1 + inlineUnmarshalers := [][]int(nil) for i := 0; i != n; i++ { field := st.Field(i) if field.PkgPath != "" && !field.Anonymous { @@ -347,7 +529,7 @@ func getStructInfo(st reflect.Type) (*structInfo, error) { case "inline": inline = true default: - return nil, errors.New(fmt.Sprintf("Unsupported flag %q in tag %q of type %s", flag, tag, st)) + return nil, errors.New(fmt.Sprintf("unsupported flag %q in tag %q of type %s", flag, tag, st)) } } tag = fields[0] @@ -357,34 +539,47 @@ func getStructInfo(st reflect.Type) (*structInfo, error) { switch field.Type.Kind() { case reflect.Map: if inlineMap >= 0 { - return nil, errors.New("Multiple ,inline maps in struct " + st.String()) + return nil, errors.New("multiple ,inline maps in struct " + st.String()) } if field.Type.Key() != reflect.TypeOf("") { - return nil, errors.New("Option ,inline needs a map with string keys in struct " + st.String()) + return nil, errors.New("option ,inline needs a map with string keys in struct " + st.String()) } inlineMap = info.Num - case reflect.Struct: - sinfo, err := getStructInfo(field.Type) - if err != nil { - return nil, err + case reflect.Struct, reflect.Ptr: + ftype := field.Type + for ftype.Kind() == reflect.Ptr { + ftype = ftype.Elem() } - for _, finfo := range sinfo.FieldsList { - if _, found := fieldsMap[finfo.Key]; found { - msg := "Duplicated key '" + finfo.Key + "' in struct " + st.String() - return nil, errors.New(msg) + if ftype.Kind() != reflect.Struct { + return nil, errors.New("option ,inline may only be used on a struct or map field") + } + if reflect.PtrTo(ftype).Implements(unmarshalerType) { + inlineUnmarshalers = append(inlineUnmarshalers, []int{i}) + } else { + sinfo, err := getStructInfo(ftype) + if err != nil { + return nil, err } - if finfo.Inline == nil { - finfo.Inline = []int{i, finfo.Num} - } else { - finfo.Inline = append([]int{i}, finfo.Inline...) + for _, index := range sinfo.InlineUnmarshalers { + inlineUnmarshalers = append(inlineUnmarshalers, append([]int{i}, index...)) + } + for _, finfo := range sinfo.FieldsList { + if _, found := fieldsMap[finfo.Key]; found { + msg := "duplicated key '" + finfo.Key + "' in struct " + st.String() + return nil, errors.New(msg) + } + if finfo.Inline == nil { + finfo.Inline = []int{i, finfo.Num} + } else { + finfo.Inline = append([]int{i}, finfo.Inline...) + } + finfo.Id = len(fieldsList) + fieldsMap[finfo.Key] = finfo + fieldsList = append(fieldsList, finfo) } - finfo.Id = len(fieldsList) - fieldsMap[finfo.Key] = finfo - fieldsList = append(fieldsList, finfo) } default: - //return nil, errors.New("Option ,inline needs a struct value or map field") - return nil, errors.New("Option ,inline needs a struct value field") + return nil, errors.New("option ,inline may only be used on a struct or map field") } continue } @@ -396,7 +591,7 @@ func getStructInfo(st reflect.Type) (*structInfo, error) { } if _, found = fieldsMap[info.Key]; found { - msg := "Duplicated key '" + info.Key + "' in struct " + st.String() + msg := "duplicated key '" + info.Key + "' in struct " + st.String() return nil, errors.New(msg) } @@ -406,9 +601,10 @@ func getStructInfo(st reflect.Type) (*structInfo, error) { } sinfo = &structInfo{ - FieldsMap: fieldsMap, - FieldsList: fieldsList, - InlineMap: inlineMap, + FieldsMap: fieldsMap, + FieldsList: fieldsList, + InlineMap: inlineMap, + InlineUnmarshalers: inlineUnmarshalers, } fieldMapMutex.Lock() diff --git a/vendor/gopkg.in/yaml.v2/yamlh.go b/vendor/gopkg.in/yaml.v3/yamlh.go similarity index 88% rename from vendor/gopkg.in/yaml.v2/yamlh.go rename to vendor/gopkg.in/yaml.v3/yamlh.go index f6a9c8e34..2719cfbb0 100644 --- a/vendor/gopkg.in/yaml.v2/yamlh.go +++ b/vendor/gopkg.in/yaml.v3/yamlh.go @@ -1,3 +1,25 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + package yaml import ( @@ -73,13 +95,13 @@ type yaml_scalar_style_t yaml_style_t // Scalar styles. const ( // Let the emitter choose the style. - yaml_ANY_SCALAR_STYLE yaml_scalar_style_t = iota + yaml_ANY_SCALAR_STYLE yaml_scalar_style_t = 0 - yaml_PLAIN_SCALAR_STYLE // The plain scalar style. - yaml_SINGLE_QUOTED_SCALAR_STYLE // The single-quoted scalar style. - yaml_DOUBLE_QUOTED_SCALAR_STYLE // The double-quoted scalar style. - yaml_LITERAL_SCALAR_STYLE // The literal scalar style. - yaml_FOLDED_SCALAR_STYLE // The folded scalar style. + yaml_PLAIN_SCALAR_STYLE yaml_scalar_style_t = 1 << iota // The plain scalar style. + yaml_SINGLE_QUOTED_SCALAR_STYLE // The single-quoted scalar style. + yaml_DOUBLE_QUOTED_SCALAR_STYLE // The double-quoted scalar style. + yaml_LITERAL_SCALAR_STYLE // The literal scalar style. + yaml_FOLDED_SCALAR_STYLE // The folded scalar style. ) type yaml_sequence_style_t yaml_style_t @@ -238,6 +260,7 @@ const ( yaml_SEQUENCE_END_EVENT // A SEQUENCE-END event. yaml_MAPPING_START_EVENT // A MAPPING-START event. yaml_MAPPING_END_EVENT // A MAPPING-END event. + yaml_TAIL_COMMENT_EVENT ) var eventStrings = []string{ @@ -252,6 +275,7 @@ var eventStrings = []string{ yaml_SEQUENCE_END_EVENT: "sequence end", yaml_MAPPING_START_EVENT: "mapping start", yaml_MAPPING_END_EVENT: "mapping end", + yaml_TAIL_COMMENT_EVENT: "tail comment", } func (e yaml_event_type_t) String() string { @@ -279,6 +303,12 @@ type yaml_event_t struct { // The list of tag directives (for yaml_DOCUMENT_START_EVENT). tag_directives []yaml_tag_directive_t + // The comments + head_comment []byte + line_comment []byte + foot_comment []byte + tail_comment []byte + // The anchor (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_ALIAS_EVENT). anchor []byte @@ -554,6 +584,8 @@ type yaml_parser_t struct { unread int // The number of unread characters in the buffer. + newlines int // The number of line breaks since last non-break/non-blank character + raw_buffer []byte // The raw buffer. raw_buffer_pos int // The current position of the buffer. @@ -562,6 +594,17 @@ type yaml_parser_t struct { offset int // The offset of the current position (in bytes). mark yaml_mark_t // The mark of the current position. + // Comments + + head_comment []byte // The current head comments + line_comment []byte // The current line comments + foot_comment []byte // The current foot comments + tail_comment []byte // Foot comment that happens at the end of a block. + stem_comment []byte // Comment in item preceding a nested structure (list inside list item, etc) + + comments []yaml_comment_t // The folded comments for all parsed tokens + comments_head int + // Scanner stuff stream_start_produced bool // Have we started to scan the input stream? @@ -595,6 +638,18 @@ type yaml_parser_t struct { document *yaml_document_t // The currently parsed document. } +type yaml_comment_t struct { + + scan_mark yaml_mark_t // Position where scanning for comments started + token_mark yaml_mark_t // Position after which tokens will be associated with this comment + start_mark yaml_mark_t // Position of '#' comment mark + end_mark yaml_mark_t // Position where comment terminated + + head []byte + line []byte + foot []byte +} + // Emitter Definitions // The prototype of a write handler. @@ -625,8 +680,10 @@ const ( yaml_EMIT_DOCUMENT_CONTENT_STATE // Expect the content of a document. yaml_EMIT_DOCUMENT_END_STATE // Expect DOCUMENT-END. yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a flow sequence. + yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE // Expect the next item of a flow sequence, with the comma already written out yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE // Expect an item of a flow sequence. yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. + yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE // Expect the next key of a flow mapping, with the comma already written out yaml_EMIT_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a flow mapping. yaml_EMIT_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. @@ -698,6 +755,9 @@ type yaml_emitter_t struct { indention bool // If the last character was an indentation character (' ', '-', '?', ':')? open_ended bool // If an explicit document end is required? + space_above bool // Is there's an empty line above? + foot_indent int // The indent used to write the foot comment above, or -1 if none. + // Anchor analysis. anchor_data struct { anchor []byte // The anchor value. @@ -721,6 +781,12 @@ type yaml_emitter_t struct { style yaml_scalar_style_t // The output style. } + // Comments + head_comment []byte + line_comment []byte + foot_comment []byte + tail_comment []byte + // Dumper stuff opened bool // If the stream was already opened? diff --git a/vendor/gopkg.in/yaml.v2/yamlprivateh.go b/vendor/gopkg.in/yaml.v3/yamlprivateh.go similarity index 78% rename from vendor/gopkg.in/yaml.v2/yamlprivateh.go rename to vendor/gopkg.in/yaml.v3/yamlprivateh.go index 8110ce3c3..e88f9c54a 100644 --- a/vendor/gopkg.in/yaml.v2/yamlprivateh.go +++ b/vendor/gopkg.in/yaml.v3/yamlprivateh.go @@ -1,3 +1,25 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + package yaml const ( @@ -114,8 +136,9 @@ func is_crlf(b []byte, i int) bool { // Check if the character is a line break or NUL. func is_breakz(b []byte, i int) bool { //return is_break(b, i) || is_z(b, i) - return ( // is_break: - b[i] == '\r' || // CR (#xD) + return ( + // is_break: + b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) @@ -127,8 +150,9 @@ func is_breakz(b []byte, i int) bool { // Check if the character is a line break, space, or NUL. func is_spacez(b []byte, i int) bool { //return is_space(b, i) || is_breakz(b, i) - return ( // is_space: - b[i] == ' ' || + return ( + // is_space: + b[i] == ' ' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) @@ -141,8 +165,9 @@ func is_spacez(b []byte, i int) bool { // Check if the character is a line break, space, tab, or NUL. func is_blankz(b []byte, i int) bool { //return is_blank(b, i) || is_breakz(b, i) - return ( // is_blank: - b[i] == ' ' || b[i] == '\t' || + return ( + // is_blank: + b[i] == ' ' || b[i] == '\t' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) diff --git a/vendor/modules.txt b/vendor/modules.txt index 6a481e59f..65dffcfac 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -17,6 +17,7 @@ github.com/cloudfoundry/jibber_jabber ## explicit github.com/creack/pty # github.com/davecgh/go-spew v1.1.1 +## explicit github.com/davecgh/go-spew/spew # github.com/emirpasic/gods v1.12.0 github.com/emirpasic/gods/containers @@ -33,8 +34,7 @@ github.com/fatih/color github.com/fsnotify/fsnotify # github.com/gdamore/encoding v1.0.0 github.com/gdamore/encoding -# github.com/gdamore/tcell/v2 v2.3.11 -## explicit +# github.com/gdamore/tcell/v2 v2.4.0 github.com/gdamore/tcell/v2 github.com/gdamore/tcell/v2/terminfo github.com/gdamore/tcell/v2/terminfo/a/aixterm @@ -74,7 +74,7 @@ github.com/gdamore/tcell/v2/terminfo/x/xfce github.com/gdamore/tcell/v2/terminfo/x/xterm github.com/gdamore/tcell/v2/terminfo/x/xterm_kitty github.com/gdamore/tcell/v2/terminfo/x/xterm_termite -# github.com/go-errors/errors v1.4.0 +# github.com/go-errors/errors v1.4.1 ## explicit github.com/go-errors/errors # github.com/go-git/gcfg v1.5.0 @@ -91,6 +91,15 @@ github.com/go-git/go-billy/v5/util # github.com/go-logfmt/logfmt v0.5.0 ## explicit github.com/go-logfmt/logfmt +# github.com/gobwas/glob v0.2.3 +github.com/gobwas/glob +github.com/gobwas/glob/compiler +github.com/gobwas/glob/match +github.com/gobwas/glob/syntax +github.com/gobwas/glob/syntax/ast +github.com/gobwas/glob/syntax/lexer +github.com/gobwas/glob/util/runes +github.com/gobwas/glob/util/strings # github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 ## explicit github.com/golang-collections/collections/stack @@ -98,12 +107,17 @@ github.com/golang-collections/collections/stack ## explicit # github.com/google/go-cmp v0.3.1 ## explicit +# github.com/gookit/color v1.4.2 +## explicit +github.com/gookit/color # github.com/imdario/mergo v0.3.11 ## explicit github.com/imdario/mergo # github.com/integrii/flaggy v1.4.0 ## explicit github.com/integrii/flaggy +# github.com/iriri/minimal/gitignore v0.3.2 +## explicit # github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 github.com/jbenet/go-context/io # github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4 @@ -150,9 +164,12 @@ github.com/jesseduffield/go-git/v5/utils/merkletrie/filesystem github.com/jesseduffield/go-git/v5/utils/merkletrie/index github.com/jesseduffield/go-git/v5/utils/merkletrie/internal/frame github.com/jesseduffield/go-git/v5/utils/merkletrie/noder -# github.com/jesseduffield/gocui v0.3.1-0.20210614081440-74b42ecad52b +# github.com/jesseduffield/gocui v0.3.1-0.20211017220056-b2fc03c74a6f ## explicit github.com/jesseduffield/gocui +# github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e +## explicit +github.com/jesseduffield/minimal/gitignore # github.com/jesseduffield/yaml v2.1.0+incompatible ## explicit github.com/jesseduffield/yaml @@ -191,6 +208,8 @@ github.com/mitchellh/go-homedir ## explicit # github.com/onsi/gomega v1.7.1 ## explicit +# github.com/ozeidan/fuzzy-patricia v3.0.0+incompatible +## explicit # github.com/pmezard/go-difflib v1.0.0 github.com/pmezard/go-difflib/difflib # github.com/rivo/uniseg v0.2.0 @@ -206,11 +225,14 @@ github.com/sirupsen/logrus # github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad ## explicit github.com/spkg/bom -# github.com/stretchr/testify v1.4.0 +# github.com/stretchr/testify v1.7.0 ## explicit github.com/stretchr/testify/assert # github.com/xanzy/ssh-agent v0.2.1 github.com/xanzy/ssh-agent +# github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 +## explicit +github.com/xo/terminfo # golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 ## explicit golang.org/x/crypto/blowfish @@ -236,23 +258,25 @@ golang.org/x/crypto/ssh/knownhosts golang.org/x/net/context golang.org/x/net/internal/socks golang.org/x/net/proxy -# golang.org/x/sys v0.0.0-20210611083646-a4fc73990273 +# golang.org/x/sys v0.0.0-20211015200801-69063c4bb744 ## explicit golang.org/x/sys/cpu golang.org/x/sys/internal/unsafeheader golang.org/x/sys/plan9 golang.org/x/sys/unix golang.org/x/sys/windows -# golang.org/x/term v0.0.0-20210503060354-a79de5458b56 +# golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 ## explicit golang.org/x/term -# golang.org/x/text v0.3.6 +# golang.org/x/text v0.3.7 ## explicit golang.org/x/text/encoding golang.org/x/text/encoding/internal/identifier golang.org/x/text/transform +# gopkg.in/ozeidan/fuzzy-patricia.v3 v3.0.0 +## explicit +gopkg.in/ozeidan/fuzzy-patricia.v3/patricia # gopkg.in/warnings.v0 v0.1.2 gopkg.in/warnings.v0 -# gopkg.in/yaml.v2 v2.3.0 -gopkg.in/yaml.v2 -# github.com/go-git/go-git/v5 => github.com/jesseduffield/go-git/v5 v5.1.1 +# gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c +gopkg.in/yaml.v3