Releases: wfxr/forgit
Releases · wfxr/forgit
24.11.0
24.10.0
Changes since 24.09.0:
24.09.0
Changes since 24.06.0:
24.06.0
Changes since 24.05.0:
- Fix special characters in file names (#388)
Git escapes special characters in it's output when core.quotePath is
true or unset. Git always expects unquoted file paths as input. This
leads to issues when we consume output from git and use it to build
input for other git commands. This commit ensures we always feed unqoted
paths to git commands.
The _forgit_list_files function is introduced to handle usage of git
ls-files with the -z flag, which ensures unquoted paths.
It replaces the direct calls to git ls-files in _forgit_reset_head,
_forgit_stash_push and _forgit_checkout_file.
In _git_reset_head the -z option is added to the git diff command to
ensure unqoted paths.
Since git clean does not support the -z flag, we disable core.quotePath
by passing a configuration parameter in _forgit_clean. The same is done for
_forgit_add.
24.05.0
Changes since 24.04.0:
- Refactor: Do not ignore shellcheck 2207 (#378)
We sometimes capture multiline output in an array. We used to do so
directly, while setting IFS to "\n" to control splitting. This has the
downside that bashs glob expansion will be invoked.
Use read -r in such cases to add each line into the array without glob
expansion. - Fix: Pager variables are not evaluated (#381)
Reintroduces the usage of eval for evaluating pagers. We removed all usage of eval with #326, which broke code defined by users in the $FORGIT_*_PAGER environment variables and git pagers. In this particular case, eval does exactly what we want, since we do want to execute code that is defined by the user outside of forgit. - Fix ga, gsp & gcf with older git versions (#335)
Removes the usage of --pathspec-file-nul (which is not available in older git versions) in favor of storing the file names passed to the git command in an array instead of a string. - Do not disable shellcheck 2206 and 2068 in _forgit_ignore (#382)
Shellcheck 2206 and 2068 have been disabled in _forgit_ignore for a very long time. The code that triggers the shellchecks was added in ce240ac before the shellcheck action had been added. The shellcheck for the lines in question got disabled in c14ce93. Disabling shellcheck does not seem necessary, instead this commit implements the fixes shellcheck suggest. - Move fzf options into $opts variables (#384)
_forgit_stash_push, _forgit_revert_commit and _forgit_blame passed some
fzf options as arguments directly instead of defining them in the $opts
variable, as we do everywhere else. This change makes these functions
consistent with the rest of the code base and additionally allows
overriding said options with the respective $FORGIT_*_FZF_OPTS
environment variables. - Add a preview to _forgit_clean (#383)
- Fix: Early out from _forgit_stash_push when no files can be stashed (#376)
Previously when using _forgit_stash_push without any local changes an empty file picker would open. Exit early and show a message instead. - Fix typos in README.md (#390)
* Fix some typos and wordings
* Fix headers style: no double spaces
* Fix "e.g." usage (Latin) - Fix: --date option in gbl can not be overridden anymore (#385)
The order of the arguments passed to git blame in _forgit_blame_preview
has been changed in bfffda6, putting --date=short as the last argument
instead of the first. This caused it taking precedence of anything
defined in $FORGIT_BLAME_GIT_OPTS.
This commit restores the order of the arguments to what they were before
bfffda6. - Allow disabling --graph with FORGIT_LOG_GRAPH_ENABLE=false in grc (#387)
- Fix: gsp does not work outside the root directory (#386)
- Fix: Opening files from diff line when not in project root (#393)
When trying to open a file from gd in $EDITOR (alt + e) the wrong file
was being opened when the command wasn't executed from the repository's
root directory.
24.04.0
Changes since 24.03.2:
- Refactor: Parse environment variables into arrays
Forgit allows specifying git options in environment variables that are passed along to the individual git commands. We currently treat those as strings. This commit adds a _forgit_parse_array function and uses it to parse all such environment variables into arrays instead. This will allow us to get rid of deferred code, since we can pass the parsed arrays directly to the git commands and don't have to rely on eval. - Refactor: Replace deferred code used for fzf preview with functions
Removes the deferred code that is used for creating the fzf preview functions and replaces it with _forgit_*_preview functions instead. These functions are exposed as forgit commands so they can be invoked from the fzf subshell. We split the exposed commands into public_commands and private_commands. The only difference between them is that public_commands are mentioned in the help text.
This commit changes the flags variable in _forgit_blame from a string to an array. This is necessary to allow the flags to be passed to _forgit_blame_preview as individual arguments. - Refactor: Move git commands from deferred code into functions
We often used deferred code to encapsulate git commands and make them
reusable.
This change removes deferred code for git commands and replaces it with
functions instead.
Some of the deferred code was used with xargs, which executes it on a
subshell. To avoid having to expose the new git functions the same way
we do with the preview functions, the usage of xargs in these cases is
replaced with either a loop or a single command when possible. - Refactor: Replace _forgit_emojify deferred code variable with a function
We used to have a variable that was either undefined or contained a
piece of deferred code that piped input through emojify when present
on the system. To remove the deferred code here, this commit
replaces the _forgit_emojify variable with a function that either pipes
the input through emojify or through cat, depending on whether emojify
is present. - Refactor: Replace deferred git commands with regular git commands
We were using deferred code in git commands in some places without any
reason. Each of these deferred code snippets was only executed a
single time, so we can replace them with regular git commands.
This commit changes how we handle the FORGIT_LOG_GRAPH_ENABLE
environment variable. We previously used a variable that stored the
--graph flag as a string and unset it, when FORGIT_LOG_GRAPH_ENABLE
was set to anything other than true. We now create an empty array and
add the --graph flag to it when FORGIT_LOG_GRAPH_ENABLE is unset or true.
Doing it this way allows us to build a command line without having to use
eval. The outcome is the same as before. - Refactor: Replace deferred code in enter commands with functions
In _forgit_log and _forgit_enter it is possible to diff a single
commit/file by pressing enter. We used to store the code that executes
the diffs in variables and passed it to fzf as deferred code. This
refactor reduces the amount of deferred code by using functions instead
of variables. - Refactor: Replace deferred code in edit commands with functions
_forgit_diff and _forgit_add allow editing the currently previewed file
in the EDITOR. This used to be handled entirely using deferred code.
This commit replaces the deferred code and binds the commands to functions
instead. - Refactor: Replace deferred code in yank commands with functions
Many commands allow copying the commit hash or stash name of the current
selection to the clipboard. We previously used deferred code to do so.
This commit replaces the deferred code and binds these commands to
functions instead. - Refactor: Replace _forgit_extract_sha variable with function
We used to store code that extracts the commit hash from a line in a
variable. This commit replaces this variable with a function. - Refactor: Replace deferred extract variable in _forgit_add with a call to _forgit_get_single_file_from_add_line
- Refactor: Quote files passed to preview functions
In some cases we need to pass multiple files to preview functions. These
files are treated as a single string that is evaluated by fzf and passed
on to our preview functions as individual arguments.
This commit introduces a _forgit_quote_files function that ensures the
resulting arguments are quoted properly. - Fix _forgit_diff on macOS (#375)
In bash 3.2 uninitialized arrays contain one entry: an empty string,
whereas in modern versions of bash they do not contain any entry. Make
sure the $commits and $files arrays are explicitly initialized as empty
arrays to allow git to fall back to diffing local changes instead of
trying to diff against a revision with a name of an empty string. - Fix bug where homebrew replacement wouldn't work (#379)
- Refactor: Quote variables in preview of _forgit_diff, _forgit_reset_head & _forgit_cherry_pick_form_branch (#372)
- Fix branch preview for branches that have the same name as a file (#374)
The preview for branches (when using gbd or gcb) did not work for branches that have the same name as a file in the repository. This commit fixes this behavior by separating files and revisions with '--' as git suggests, while leaving the files blank to keep matching all files. - Fix preview for deleted files in _forgit_stash_push (#336)
24.03.2
Changes since 24.03.1:
24.03.1
Changes since 24.03.0:
- Fix homebrew update action to run on tag push (#356)
- feat(fish): use abbr instead of alias (#348)
Switch from aliases to abbreviations, as I suggested in
feat(completions): add completion for fish #344 (comment)
string collect returns 1 on empty argument, so it's used here to avoid repeating if else end blocks. Another benefit is that the output of string collect is ensured to be a single string. From string --help:
string collect collects its input into a single output argument, without splitting the output when used in a command substitution. This is useful when trying to collect multiline output from another
command into a variable. Exit status: 0 if any output argument is non-empty, or 1 otherwise.
This PR is marked as breaking change, since abbr behaves differently from alias. It can only be used in the interactive command line (so putting exec glo into your scripts won't work).
24.03.0
Changes since 24.02.0:
- Add new workflow to update homebrew formula on release (#342)
- fix: keep the script compatible with Busybox applets (#345)
Use short flags for sort command
Remove -n flag for nl command. The numbers in the selection list won't be aligned anymore, but no information is lost.
The current arguments are only presented in GNU's coreutils. - fix: avoid polluting the global namespace (#347)
- feat(completions): add completion for fish (#344)
fish's builtin git completion automatically registers git-forgit completions as completions for forgit subcommand of git. Therefore this PR provides completions for both formats git-forgit and git forgit.
Simple subcommands get the completion list from __fish_git_* functions, while others requiring more than 1 __fish_git_* completion sources reuse the completion items from the corresponding git commands. - fix(fish): clean up variables (#350)
* use `status dirname` builtin to save 1 dirname call
* use builtin test function instead of [ command
* use local scoping for INSTALL_DIR variable (and make it lowercase to
indicate such change)
Ref: https://fishshell.com/docs/current/cmds/test.html - Consolidate zsh completions in one file (#340)
Moved the completion definitions for zsh that previously were in completions/git-forgit.zsh and had to be sourced manually on shell startup into completions/_git-forgit, where they are automatically handled by compinit on shell startup. Sourcing a file to get completions is no longer necessary for zsh users.
If you're having issues after updating, and completions for commands such as `forgit::add` or aliases like `ga` aren't working, remove your completions cache (~/.zcompdump) and restart your shell.
Simplified _git-forgit to allow it to be called from within the completion script on the first run of a session. - chore(gha): Update actions/checkout from v3 to v4 (#351)
Resolve deprecation warnings for GitHub actions, see https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/ - Fix diff preview and edit for files with a ']' character in their name (#354)
Our sed command for removing the short status (e.g. [M]) from gits
output to extract the file name with _forgit_diff matched until the
last ']' character in the line due to sed being greedy. This created
issues with file names that contain a ']' character.
To fix this, I made sure that only the short status is removed by sed,
independently of the file name.
24.02.0
Changes since 24.01.0:
- README tweak: decrease level of headers (#337)
- README: Add more explicit instructions for brew, fix headers for AUR, Fig (#339)
Added more explicit instructions, now that I know how our brew installation process works.
While I was there, I moved AUR and Fig to be subheaders of Installation