Commit graph

447 commits

Author SHA1 Message Date
Chris Apple 98637db1b0
Only show available cherry picks (#266)
Only shows changes that are eligible for cherry-pick to the branch, not every commit. Also adds nice color to the output
2023-01-11 10:50:41 -08:00
Tim 73aea65778
Add bash completions for git-forgit (#235)
When using forgit as a subcommand of git, put 'git-forgit.bash' in one
of the following places and it will be loaded automatically on tab
completion of 'git forgit' or any configured git aliases of it:

- /usr/share/bash-completion/completions
- ~/.local/share/bash-completion/completions
2023-01-11 10:57:16 +01:00
Tim 548af731f0
Fix command list in help output (#274)
'rebase' and 'fixup' were accidentally displayed on the same line.
2023-01-11 10:22:53 +01:00
sandr01d 329523bd0d
Fixed: Untracked files with spaces in the path do not show a preview in 'ga' (#271) 2023-01-11 08:47:40 +01:00
sandr01d d1a5530042
Add alias gbl for forgit::blame in fish (#273)
Added the alias gbl for forgit::blame to the fish wrapper, so the behavior in fish is the same as in bash/zsh. I've also deleted an empty line where there were two in a row.
2023-01-10 13:37:35 -08:00
sandr01d 92ce3007c0
Fish: assume forgit in vendor_conf.d in case it can not be found in conf.d (#272)
In the fish wrapper, assume forgit-git to be in vendor_conf.d/bin in case it can not be found in conf.d/bin. This fixes forgit not working with fish when located in /usr/share/fish/vendor_conf.d, as is the case with the forgit and forgit-git AUR packages. The location at conf.d is kept (and stays the default), so forgit does not break compatibility with fish plugin managers, such as fisher.

Closes #270
2023-01-10 11:41:32 -08:00
Chris Apple ffda73bac3
Adding the ability to grh from a subdirectory (#262)
grh didn't work if you were in a subdirectory. See #254 for more details
2022-12-19 10:57:58 -08:00
Chris Apple 5a117b63cd
Ensure that grc and gcp always have the correct ordering, regardless of how they were input (#261) (#253)
Closes #253. Essentially the idea is this:

    When cherry picking a group of commits, most of the time you want to cherry pick oldest to newest. This means you have the lowest chance of having a conflict or error
    when reverting a commit. You most often want to revert from newest to oldest. Similarly prevents errors

This commit does that, based on the wonderful suggestion on how to do that from @carlfriedrich in the linked ticket (#253).
2022-12-16 06:50:28 -08:00
Changsheng Wu 8ca463b5c6
Do not hardcode $SHELL path for bash (#260)
Some systems do not have /bin/bash. e.g., Alpine and NixOS. This change reads
the path dynamically via `which`. It solves the error `fork/exec /bin/bash`.
2022-12-15 09:34:11 +01:00
sandr01d f8c0edfc17
Added git stash push selector 'gsp' (#251)
A message can be passed via named argument (-m or --message). All other
arguments (e.g. file paths) will cause git stash push to be run directly without
invoking fzf.
2022-12-14 15:53:52 +01:00
Chris Apple 62cc8abde1
Provide an input branch with gcp again (#252)
Noticed there was a change recently that broke the ability to pass in an input branch to gcp.

This change is the following:

    Fix faulty logic that just led to a git checkout -b being called when you pass in an argument to gcp
    If an argument was passed in, check if it is a valid branch, if so, set the input_branch var
    If input_branch is set, use it to do the cherry pick, as opposed to the first FZF selection.
2022-12-13 16:42:07 -07:00
Markus Meier bfea8cf485
fix: compatibility check not working in bash (#258)
Fix: backwards compatibility check not working reliably in bash
2022-12-09 09:54:58 +01:00
Tim 4b251aab22
Meta: GitHub tag action: add commit key (#248)
The COMMIT_KEY secret contains a private SSH key. The associated public
key has been added as a deploy key in the GitHub project. See:
https://docs.github.com/en/developers/overview/managing-deploy-keys#deploy-keys

This is necessary to make commits done by github-actions able to trigger
further github-actions. See:
https://stackoverflow.com/q/60418323/3018229.
2022-12-06 11:14:32 +08:00
Tim 59dd63be77
Fix forgit diff displaying renames on MacOS (#250)
MacOS's 'sed' variant obviously does not parse '\t' as a tabstop per
default. Replacing it with a literal tabstop to make this work.
2022-12-02 08:33:07 +01:00
Chris Apple d0959eb001
Adding a wraps to get fish to autopopulate branches (#255) 2022-11-29 11:01:33 -08:00
Tim 42c8e005fe
glo: use forgit::diff when entering a commit (#219)
When using glo (forgit log) we can press Enter to show the changeset of
the selected commit. The presentation, however, was rendered using the
basic git diff command. We have a much more user friendly diff command
gd (forgit diff) right in forgit, though. Use this instead.
2022-11-26 13:28:25 +01:00
Tim 43f5f1c58e
Merge pull request #241 from carlfriedrich/move-implementation-to-standalone-forgit
Move implementation to standalone forgit
2022-11-26 13:10:26 +01:00
Tim 98321ef05a
Merge pull request #247 from carlfriedrich/improve-release-actions
Improve release actions
2022-11-24 15:31:01 +01:00
carlfriedrich 402de02eea Meta: GitHub release: update to checkout@v3
checkout@v2 uses deprecated Node.js 12. See:
https://discourse.julialang.org/t/node-js-12-actions-deprecation-warning-on-github/88718
2022-11-24 15:08:30 +01:00
carlfriedrich e6e3ba4ce5 Meta: GitHub tag action: add git log to output for debugging purposes 2022-11-24 15:00:59 +01:00
carlfriedrich 8e292f710b Meta: GitHub tag action: improve regex for version matching 2022-11-24 15:00:12 +01:00
carlfriedrich fb0b22890d Meta: GitHub tag action: fix getting of HEAD tag 2022-11-24 14:59:06 +01:00
carlfriedrich f3d9d62776 Meta: GitHub tag action: pass GitLab URL as an env variable
GitHub action variables are not available in called shell scripts. They
have to be explicitly passed from the YAML file. See:
https://github.com/orgs/community/discussions/27027
2022-11-24 14:55:49 +01:00
carlfriedrich 37f21753ae Meta: change line-endings from CRLF to LF 2022-11-24 14:54:00 +01:00
Wenxuan a1d1d990ec
Merge pull request #246 from carlfriedrich/add-release-action
Automatic releases
2022-11-24 09:05:51 +08:00
carlfriedrich f0e9e4f748 Meta: Add GitHub tag action
The action is executed on every first day of a month. It checks whether
the current master is already tagged and, if not, creates a new release
tag.
2022-11-23 19:02:01 +01:00
carlfriedrich eedf3ae890 Meta: Add GitHub release action
The action is executed on every tag and creates a GitHub release. The
release contains a .tar.gz asset and a changelog consisting of all
commit messages since the previous tag. Commits with a commit message
starting with "Meta" are excluded from the changelog.
2022-11-23 17:42:42 +01:00
carlfriedrich 785c3f9774 Display useful error message if no or wrong command given 2022-11-21 10:56:58 +01:00
carlfriedrich da9210e972 Meta: update documentation 2022-11-17 10:19:32 +01:00
carlfriedrich 372239fd37 Export user-defined FORGIT variables for backwards compatibility
Before forgit became a standalone script, users defined their FORGIT
variables (e.g. FORGIT_FZF_DEFAULT_OPTS) in the shell environment before
sourcing the forgit shell plugin. This worked because the forgit code
was executed within the currently running shell.
With forgit being an executable script, these variables are only
available to forgit when being exported. This patch adds an automatism
for this so that users do not have to change their configuration.
A warning is issued in this case so that users get notified to update
their configuration.
2022-11-17 10:19:32 +01:00
carlfriedrich 49def1fe91 Fish plugin: do not quote passing of $argv
Fish stores command line arguments in $argv, which is an array. Unlike
in bash, when passing this array to a function, we must not enclose it
in double-quotes. This made an empty argument list (i.e. no arguments
passed) to an actual empty string argument (i.e. one argument passed),
which is not what we want.

See https://stackoverflow.com/a/42379014/3018229
2022-11-17 10:19:32 +01:00
carlfriedrich 26f0f5c1e1 Ensure that fzf preview commands are executed in bash
All preview commands are written in bash now. fzf, however, uses the
shell defined in $SHELL to run the preview commands. We have to force
this to bash within forgit in order to not get any errors on different
default shells.
2022-11-17 10:19:29 +01:00
Wenxuan Zhang fe4ac0f9f2
ci: update stale config
Signed-off-by: Wenxuan Zhang <wenxuangm@gmail.com>
2022-11-15 15:46:34 +08:00
carlfriedrich 0820811862 Add variable for forgit binary 2022-11-14 17:53:00 +01:00
carlfriedrich b2d24138df zsh plugin: exit with an error if bin path cannot be determined 2022-11-14 17:53:00 +01:00
carlfriedrich 58882fd6ba fish plugin: move function order to match zsh version
Also add checkout::tag and blame, which were missing.
2022-11-14 17:53:00 +01:00
carlfriedrich 9471f292bb zsh plugin: use standardized $0 handling
See https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html#zero-handling
2022-11-14 17:53:00 +01:00
carlfriedrich 4995c614e4 Move implementation to standalone forgit
Previously we had two different forgit implementations: one for zsh/bash
and one for fish. In this commit we move the bash implementation of the
forgit functions to the git-forgit script in order to have them in the
form of an executable script. This makes using forgit possible without
any shell plugin at all and furthermore removes the need to maintain a
separate implementation for the fish shell.

The simplest way of using forgit from now on is to put git-forgit
somewhere in your PATH and call it via "git forgit", without the need
for any other files.

We keep the shell plugins, though, and maintain backwards compatibility
by retaining the plugin functions as simple wrappers around the
git-forgit script, making the plugins mainly a collection of aliases
only.
2022-11-14 17:52:58 +01:00
Tim 2872548075
GitHub actions: update to Ubuntu 22.04 (#240)
The Ubuntu 18.04 CI image is deprecated:
https://github.com/actions/runner-images/issues/6002

Switch to the new 22.04 image instead.
2022-10-14 16:05:53 +02:00
Tim 089853173e
Do not "set -e" in standalone forgit (#238)
Setting the error option in bash bypasses error handling in the forgit
functions, because the script immediatley exits in case of an error.
Remove the option to make error handling possible.
Bash scripts automatically return the exit code of the last statement,
so standalone forgit will still return useful error codes.
2022-10-08 00:43:47 +02:00
Tim 25789d2198
Fix function call in standalone forgit (#239)
From the standalone forgit command we call the according forgit function
by replacing a '_' with '::'. Since we have more complex function names
like 'forgit::cherry:⛏️:from::branch' we have to replace ALL
instances of '_' instead of just the first one.
2022-10-04 12:47:23 +02:00
Tim 49579b2d1f
Do not return an error in log, diff and stash show (#236)
fzf has the following exit codes:
0      Normal exit
1      No match
2      Error
130    Interrupted with CTRL-C or ESC

The forgit functions "log", "diff" and "stash show" are designed to
display information, not to perform any action. Hence the fzf exit code
130 should not be interpreted as an error, it is normal exit behavior.
Exclude this error value and return 0 in this case.
2022-09-17 18:16:30 +02:00
Tim e0ca1f4045
Add ability to checkout existing branch with gcb (#234)
Port @cjappl 's changes of #232 / d4b4ce3 to zsh/bash.

gcb can now be called with an existing branch as an argument.
2022-09-13 07:38:32 -07:00
Wenxuan 2a96f287a9
Merge pull request #228 from carlfriedrich/interactively-select-branch-in-gcp
Interactively select branch in gcp
2022-09-13 10:32:18 +08:00
Chris Apple 3f50933f04
Add ability to checkout existing branch with gcb in fish (#232) 2022-08-16 09:56:33 -07:00
Chris Apple bdef69083c
Adding wraps to fish - adding way to gcb an existing branch (#231)
I added a bunch of "wraps" commands to our functions. This is basically a quick and easy way to get function completion for free. Users can now tab complete most commands that take an argument
2022-08-16 09:49:22 -07:00
Wenxuan 85bc57a15c
Merge pull request #226 from carlfriedrich/support-stashes-in-gd
Support stashes in forgit::diff
2022-08-15 10:13:34 +08:00
Wenxuan e78562250f
Merge pull request #225 from carlfriedrich/add-forgit-enter-pager
Add variable FORGIT_ENTER_PAGER
2022-08-15 10:06:43 +08:00
ccoVeille f6040b21a0
fix typo in comments and README files (#230) 2022-08-09 19:07:59 -07:00
carlfriedrich b9c0e7b58f gcp: interactively select target branch
When we want to perform a cherry pick, we had to pass the target branch
as an argument to gcp. Forgit, however, aims to make git selections
interactive where possible. Hence it seems natural to select the target
branch interactively as well.
2022-08-06 19:30:49 +02:00