forgit

A utility tool powered by fzf for using git interactively.

MIT License

Downloads
175
Stars
4.2K
Committers
61

Bot releases are visible (Hide)

forgit - 24.04.0 Latest Release

Published by github-actions[bot] 7 months ago

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)
forgit - 24.03.2

Published by cjappl 7 months ago

What's Changed

Full Changelog: https://github.com/wfxr/forgit/compare/24.03.1...24.03.2

forgit - 24.03.1

Published by cjappl 8 months ago

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).
forgit - 24.03.0

Published by github-actions[bot] 8 months ago

Changes since 24.02.0:

forgit - 24.02.0

Published by github-actions[bot] 9 months ago

Changes since 24.01.0:

forgit - 24.01.0

Published by github-actions[bot] 10 months ago

Changes since 23.09.0:

forgit - 23.09.0

Published by github-actions[bot] about 1 year ago

Changes since 23.08.1:

  • checkout_branch: support "-" argument (#322)
    git natively supports `-` as an argument to `git switch` and `git
    checkout`. It is shorthand for `@{-1}`, which is a way to refer to the
    last branch you were on.
    forgit used to interpret `-` as a branch name, detect that it does not
    exist yet and create a new one with this name, which does not work.
    Add a check whether `-` is passed on the command line and do not create
    a new branch in this case
  • Fixed opening files in the editor when a path contains spaces or a file was renamed (#323)
    Fixed two issues that occurred when trying to open files in the editor (ctrl+e). In both cases the wrong files were opened.
    1. Files that have spaces in their path. I fixed this by properly escaping the variables used in _forgit_diff() and forgit_add().
    2. When a tracked file was renamed and added, trying to open it in the editor from the diff view, would open a file with a name that consists of both, the old and the new name. I added a separate sed command that can handle this special case.
forgit - 23.08.1

Published by github-actions[bot] about 1 year ago

Changes since 23.08.0:

  • Do not hide error messages when trying to return early (#318)
    Most of forgits functions allow to invoke git directly when arguments were passed. In most of these functions we only return early when the git command that is executed returns successfully. This hides error messages from the user. As discussed with @carlfriedrich in #316, I've modified this behavior to also return early when the git command was not successful, so we're transparent about gits error messages and return values. This also fixes an infinite loop printing an error message when invalid arguments were passed to gsp. Because gbl and gclean allow passing arguments to the git command that is invoked when we don't return early, I've modified their behavior to only invoke git directly (and return early) in the case that non flag arguments were passed.
    I've also modified gclean to use the -q flag instead of piping it's output to /dev/null.
  • Removed the note about using forgit as a git subcommand from the 'tips' section (#321)
    The note was redundant because it is explained in more detail in the 'git integration' section.
  • Trigger AUR action on workflow_run instead of release (#320)
    Turns out that GitHub actions do not trigger other actions by default. Using workflow_run instead of release as a trigger should solve this.
forgit - 23.07.0

Published by github-actions[bot] over 1 year ago

forgit - 23.06.0

Published by github-actions[bot] over 1 year ago

Changes since 23.05.0:

forgit - 23.05.0

Published by github-actions[bot] over 1 year ago

forgit - 23.04.0

Published by github-actions[bot] over 1 year ago

Changes since 23.03.0:

  • Detect unexported variables in fish correctly (#290)
    Fixes #289
  • Only show available cherry picks in preview (#293)
    This is a follow-up to #266, which already switched to showing only
    available commits during cherry-picking. This patch does the same for
    the branch preview in _forgit_cherry_pick_from_branch.
  • Fix broken cherry picking (#294)
    With the changes of #261 and #266 we accidentally broke the return value
    of `_forgit_cherry_pick`, which led to the loop in
    `_forgit_cherry_pick_from_branch` being terminated in the wrong cases.
    Fix this by moving all the post processing after fzf to a later call.
    Also simplify the array population using a single line instead of a
    loop.
    This should also fix #286 ("fatal: bad revision ''").
  • Add git options for each forgit command (#292)
    The git behavior within forgit can now be customized with a dedicated
    variable for each forgit command, e.g. `FORGIT_ADD_GIT_OPTS` is passed
    to the `git add` call within `ga`.
    Also renaming `FORGIT_STASH_PUSH_OPTS` to `FORGIT_STASH_PUSH_FZF_OPTS`
    and `FORGIT_REVERT_COMMIT_OPTS` to `FORGIT_REVERT_COMMIT_FZF_OPTS`
    for consistency.
  • Fix git options (#296)
    Adding options to a command in a quoted variable as introduced in #292
    causes problems in several cases unfortunately (e.g. git rebase
    interpreting an empty string argument as a remote, which leads to an
    error "unknown upstream ''").
    Change the implementation in a way that each git command is stored in a
    shell variable, including the options, which is then evaluated.
    This also makes the code more DRY because each git options variable is
    evaluated only once.
    Furthermore, fix temporary IFS settings. When setting the IFS for a
    certain command only, the command must not be an assignment, otherwise
    both assignments are evaluated permanently
    (see https://unix.stackexchange.com/a/458901/317320).
  • Fix temporary IFS settings (#297)
    When setting the IFS for a certain command only, the command must not be
    an assignment, otherwise both assignments are evaluated permanently
    (see https://unix.stackexchange.com/a/458901/317320).
  • Add keybinding ctrl+y for copying stash ID in gss (#295)
forgit - 23.03.0

Published by github-actions[bot] over 1 year ago

Changes since 23.02.0:

  • Fix empty diff preview on renames (#282)
    This had been fixed before in #189, but obviously the patch broke
    support for whitespaces in file names. That was fixed in #204, which
    in turn broke support for renames again.
    Prepare the list of file names with the null-character \0 as a delimiter,
    so that we can use "xargs -0" to read it. This makes renames as well
    as filenames with spaces work correctly.
forgit - 23.02.0

Published by github-actions[bot] over 1 year ago

Changes since 23.01.0:

forgit - 23.01.0

Published by github-actions[bot] almost 2 years ago

Changes since 22.12.0:

forgit - 22.12.0

Published by github-actions[bot] almost 2 years ago

Important for fish users: If you have installed forgit via fisher, please update it to v4.4.3 or higher before installing this forgit release.

Changes since 22.11.0:

forgit - 22.11.0

Published by github-actions[bot] almost 2 years ago

Initial release! 🚀