Commit graph

544 commits

Author SHA1 Message Date
sandr01d cf9e15edab
Fix: add fish completions for forgit diff and forgit show (#434) 2025-04-23 18:39:35 +02:00
sandr01d 79c4e5a4c4
Fix: create branch when checking non origin remote (#430) 2025-04-22 18:08:37 +02:00
sandr01d 8c0355ca9e
Meta: use latest ubuntu image for ci (#433) 2025-04-22 18:06:55 +02:00
Swastik Acharyya 72b8d6feb2
fix: Use "ga" alias for "forgit attributes" in fish shell (#432) 2025-04-21 14:16:58 +02:00
carlfriedrich aec8b1f2b5
Meta: Do not tag release without public changes (#427)
This is mostly a refactoring of our GitHub actions. The tag workflow and
script have been removed completely, since the release action will
implicitly create the release tag if it does not exit, yet. This makes
sure that we do not create a tag when there will be no release.

We have only one workflow now, which contains two jobs: one for
generating the changelog and one for creating the release.

The changelog job will generate the changelog and upload it as an
artifact if there are public changes. The release version, which
previously was determined in the tag script, is now determined within
this job, so that we can pass it to the release job.

The release job will run only if the changelog job was successful, i.e.
if there are public changes. It will create a tag and a GitHub release
with the given version number.

The workflow will run on the first day of every month for our regular
automatic monthly releases.
It will also run on every tag push, so that we still can create a
release manually if necessary. The release action will implicitly use
the existing tag for the release then.

Fixes #413
Closes #414
2025-03-14 07:01:12 +01:00
carlfriedrich 18f1a1e0c3
Meta: Improve the documentation for overriding aliases (#426)
Some checks failed
ci / build (ubuntu-22.04) (push) Failing after 1s
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-20.04) (push) Has been cancelled
2025-02-24 14:09:06 +01:00
crazy-matt 4dc0f5474a
Update README.md (#425)
Some checks failed
ci / build (ubuntu-22.04) (push) Failing after 1s
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-20.04) (push) Has been cancelled
Adding sheldon.cli configuration for zsh as an example.
2025-02-23 13:09:51 +01:00
carlfriedrich 09f17c9032
Allow passing arguments to git rebase (#422)
Some checks failed
ci / build (ubuntu-22.04) (push) Failing after 1s
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-20.04) (push) Has been cancelled
If non-option arguments are passed to `git forgit rebase`, pass them
through directly to `git rebase`, without launching the interactive
selector, just like we do for other forgit commands.

Along with this, remove possibility to pass files to rebase, as there is
no need for that. I assume this was a copy-paste error when the
rebase function was introduced in the first place.
2025-02-15 14:57:57 +01:00
sandroid 0d65efc769 Feature: Add interactive git attributes generator
Some checks failed
ci / build (macos-latest) (push) Waiting to run
ci / build (ubuntu-20.04) (push) Waiting to run
ci / build (ubuntu-22.04) (push) Failing after 1s
2025-02-14 20:29:33 +01:00
sandroid 408fe6033a Refactor: Make functions interacting with repositories reusable 2025-02-14 20:29:33 +01:00
sandr01d e07b353b94
Refactor: Remove _forgit_ignore_clean (#421)
Some checks failed
ci / build (ubuntu-22.04) (push) Failing after 1s
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-20.04) (push) Has been cancelled
2025-02-10 19:36:13 +01:00
carlfriedrich bb83b3cba0
Feature: add forgit show command (#417)
Some checks failed
ci / build (ubuntu-22.04) (push) Failing after 1s
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-20.04) (push) Has been cancelled
Introducing `show` as a new subcommand of `forgit`, an interactive
version of `git show`. The configured default alias is `gso`.

Alt-T can be used to toggle between showing the diff and the commit
message in the fzf preview window.

The new command in used instead of `forgit diff` when pressing enter
in `forgit log`. This fixes the display of diffs for merge commits.

**Note**: we have a requirement for the `fzf` version now. The minimum
required `fzf` version is 0.49.0. If the installed version is lower,
forgit will exit with an error message.

Fixes #416.
2025-01-29 07:04:07 +01:00
sandr01d fdae9cb235
Meta: add tree as an optional dependency (#420)
Some checks failed
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-20.04) (push) Has been cancelled
ci / build (ubuntu-22.04) (push) Failing after 1s
2025-01-22 20:28:56 +01:00
Wenxuan df5191157f
fix: fix edit file key binding (alt-e) in diff and add (#415)
Some checks failed
ci / build (ubuntu-22.04) (push) Failing after 1s
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-20.04) (push) Has been cancelled
The key binding for editing a file in diff and add was not working
properly on recent versions of fzf. As its documentation suggests, we
should replace `execute-silent` with `execute` since we need to switch
to a new screen and handle both input and output.

> fzf switches to the alternate screen when executing a command.
> However, if the command is expected to complete quickly, and you are
> not interested in its output, you might want to use execute-silent
> instead, which silently executes the command without the switching.
2024-12-22 09:18:39 +08:00
Wenxuan Zhang 755b3dd9f8
chore: rename default branch (#410) 2024-12-16 22:35:07 +08:00
Sufien Tout 7a40a11e79
Meta: add an .editorconfig and apply it to the codebase (#404)
Some checks failed
ci / build (ubuntu-22.04) (push) Failing after 0s
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-20.04) (push) Has been cancelled
2024-11-06 10:10:27 +01:00
Tim 2d5f8f48f5
Meta: do not create release when there are no public changes (#401)
Some checks failed
ci / build (ubuntu-22.04) (push) Failing after 1s
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-20.04) (push) Has been cancelled
2024-11-04 10:17:59 +01:00
Ondřej Súkup 60b651de7e
Meta: remove mention of Fig from docs (#400)
Some checks failed
ci / build (ubuntu-22.04) (push) Failing after 0s
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-20.04) (push) Has been cancelled
Fig was effectively sunset by Amazon from 1. September 2024
2024-10-18 11:37:52 +02:00
sandr01d be82c47ceb
Feature: Add interactive git reflog (#398)
Some checks failed
ci / build (ubuntu-22.04) (push) Failing after 1s
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-20.04) (push) Has been cancelled
2024-09-04 22:02:27 +02:00
Wenxuan 8b60a899f4
refactor: remove -u option from git status in forgit add (#397)
Some checks failed
ci / build (ubuntu-22.04) (push) Failing after 1s
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-20.04) (push) Has been cancelled
Signed-off-by: Wenxuan Zhang <wenxuangm@gmail.com>
2024-08-15 10:06:11 +08:00
sandr01d 17394d1056
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.
2024-05-12 02:00:08 +02:00
dependabot[bot] 1157d7bac3
Meta: Bump softprops/action-gh-release from 1 to 2 (#395)
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-04 16:36:24 +02:00
Raphael Boidol 4b711d2159
Meta: add dependabot update for GitHub actions (#394) 2024-05-03 10:59:00 +02:00
sandr01d b35b309ce5
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.
2024-04-27 16:42:37 +08:00
sandr01d 6f212fd2b2
Fix: gsp does not work outside the root directory (#386) 2024-04-26 23:03:42 +02:00
sandr01d 2ae84d3326
Allow disabling --graph with FORGIT_LOG_GRAPH_ENABLE=false in grc (#387) 2024-04-26 23:02:50 +02:00
sandr01d c76b00bcef
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.
2024-04-25 22:57:02 +02:00
ccoVeille f3616b00cf
Fix typos in README.md (#390)
* Fix some typos and wordings
* Fix headers style: no double spaces
* Fix "e.g." usage (Latin)
2024-04-24 19:50:11 +02:00
sandr01d 2903fef2af
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.
2024-04-23 23:08:35 +02:00
sandr01d bc408f155c
Add a preview to _forgit_clean (#383) 2024-04-19 21:12:16 +02:00
sandr01d a6efc540ba
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.
2024-04-19 21:11:05 +02:00
sandr01d d240263f42
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.
2024-04-13 20:57:00 +02:00
sandr01d 1c34d0d54d
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.
2024-04-09 22:43:24 +02:00
sandr01d 131f2c1f66
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.
2024-04-09 22:37:29 +02:00
sandr01d cac700ebe1
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.
2024-04-05 20:12:32 +02:00
sandr01d 7690364a98
Fix preview for deleted files in _forgit_stash_push (#336) 2024-03-31 00:48:18 +01:00
sandr01d 032b52f6d5
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.
2024-03-31 00:31:48 +01:00
sandr01d 1a1153978f
Refactor: Quote variables in preview of _forgit_diff, _forgit_reset_head & _forgit_cherry_pick_form_branch (#372) 2024-03-31 00:30:00 +01:00
Chris Apple 0a89d21a5e
Fix bug where homebrew replacement wouldn't work (#379) 2024-03-30 13:15:21 -07:00
sandr01d d582f2aa0b
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.
2024-03-27 20:36:07 +01:00
sandroid 0a8a70bc20 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.
2024-03-24 15:50:40 +01:00
sandroid 0c0668f57b Refactor: Replace deferred extract variable in _forgit_add with a call to _forgit_get_single_file_from_add_line 2024-03-24 15:50:40 +01:00
sandroid 0b7f1f47f5 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.
2024-03-24 15:50:40 +01:00
sandroid 67d6d8508f 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.
2024-03-24 15:50:40 +01:00
sandroid d8fe39c893 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.
2024-03-24 15:50:40 +01:00
sandroid 35a4ce33ec 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.
2024-03-24 15:50:40 +01:00
sandroid ab1116da0e 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.
2024-03-24 15:50:40 +01:00
sandroid 61db097bad 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.
2024-03-24 15:50:40 +01:00
sandroid f927c223f3 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.
2024-03-24 15:50:40 +01:00
sandroid bfffda68d8 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.
2024-03-24 15:50:40 +01:00