Commit graph

76 commits

Author SHA1 Message Date
sandr01d be8c306c18
Add alias gct for forgit::checkout::tag in fish (#278)
Noticed there was another alias missing for fish. This is the last one :)
2023-01-13 14:59:52 -08: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
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 d0959eb001
Adding a wraps to get fish to autopopulate branches (#255) 2022-11-29 11:01:33 -08: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 0820811862 Add variable for forgit binary 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 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 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
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
carlfriedrich 1e080b0e72 Introduce variable "forgit_log_preview_options"
This reduces code duplication.
2022-08-03 18:08:55 +02:00
carlfriedrich c167918098 Support stashes in forgit::diff
Git stashes are named "stash@{x}", which contains the fzf placeholder
"{x}". In order to support passing stashes as arguments to forgit::diff,
we have to prevent fzf from interpreting this substring by escaping the
opening bracket.
2022-08-03 09:24:25 +02:00
carlfriedrich 25e1a2e277 Add variable FORGIT_ENTER_PAGER
The pager used on fzf enter key binding commands was hardcoded to
"LESS='-r' less". Transfer this to a variable in order to reduce code
duplication and make it configurable.
2022-08-01 13:39:47 +02:00
carlfriedrich 126772f08c Add function forgit::previous_commit 2022-07-28 10:16:22 +02:00
carlfriedrich d343300625 grb: rebase on parent of the selected commit
The git rebase command needs to be passed the parent commit of the one
you want to edit. When selecting a commit interactively via fzf, it
makes sense to automatically pass the parent commit of the selected one.
Within fzf it's otherwise quite hard to find the parent commit by hand
if you have found your commit via an fzf search string.
2022-07-28 10:14:37 +02:00
carlfriedrich 7b1ebff09f Add variable "forgit_extract_sha"
This reduces code duplication. We cannot implement this as a function,
because fish and zsh do not support exporting functions, but we need it
in subshells (see https://github.com/fish-shell/fish-shell/issues/6961).
Implement it as a variable in all shells instead.
2022-07-26 09:21:42 +02:00
carlfriedrich 8d3ecb6ccf Add variables for diff context
Introduce FORGIT_DIFF_CONTEXT for the diff context when viewing a diff
and FORGIT_PREVIEW_CONTEXT for the diff context in the preview window.
2022-07-22 14:26:08 +02:00
carlfriedrich bb4514a359 Improve forgit::diff
* Show additional context on enter compared to preview
* Show selected diff range in fzf prompt
2022-07-17 16:42:11 +02:00
Chris Apple bd8fce74a6
Fish didn't like the tac/tail switch. Also removed some print statements (#220) 2022-07-14 19:05:09 -07:00
Chris Apple 6ce2c25490
Fish: Fix GA and GD when there is whitespace in the name (#209) 2022-07-14 09:25:51 -07:00
Tim fdd5632b17
Fix cherry pick preview (#218)
The preview on cherry pick was accidentally broken since we included the
+/- information in the commit list. Fix this by using the correct string
index.
2022-07-14 09:24:56 -07:00
carlfriedrich fe5c4d9881 Reverse order on cherry pick
Git log displays the newest commits on top of the list, while git cherry
pick displays the newest commits at the bottom. Reverse the order of
git cherry pick so that it has the same order like git log.
2022-07-13 12:33:55 +02:00
carlfriedrich 1b7db0fb6e Preserve +/- information on cherry pick
The output of 'git cherry' which is used to build the fzf input list for
forgit::cherry::pick usually prefixes every line with a '-' for commits
that have an equivalent in the target branch, and a '+' for commits that
do not.

Previously forgit removed this information from the list. However, for
the actual cherry-picking process this information is relevant, so we
should keep it.
2022-07-12 16:42:18 +02:00
carlfriedrich 52d79009d1 Preserve commit order on cherry pick
When using a fzf find string which maches multiple lines, the commits
could appear in a wrong order. Add "--tiebreak=index" to ensure that the
correct commit order is preserved.
2022-07-12 16:35:54 +02:00
carlfriedrich 53d0ea2f38 Add FORGIT_CHERRY_PICK_FZF_OPTS
The gcp (git cherry pick) command was the only command which did not
have a variable to set command-specific fzf options. Add the according
variable to source code and documentation.
2022-07-12 16:35:54 +02:00
Wenxuan Zhang 544cf86bc4
docs: update comment 2022-05-20 17:44:51 +08:00
Chris Apple 75e9d12bac
Adding support for git branch delete method (#200)
* Adding support for git branch delete method in fish

* Add new doc to README

* Added options like gcb

* refactor: remove `--all` flag from gbd

* feat: sync forgit::branch::delete to bash and zsh

Co-authored-by: Wenxuan Zhang <wenxuangm@gmail.com>
2022-05-11 09:41:21 -07:00
Wenxuan 0c4a3069ba
Merge pull request #199 from max-ae/fix/gd-spaces
fix: `forgit::diff` not working if repo path contains spaces
2022-05-10 10:02:04 +08:00
Max Eisner 25bb8aee24 fix: forgit::diff not working if repo path contains spaces 2022-05-10 10:00:57 +08:00
Wenxuan 6186ee7e47
Merge pull request #196 from pablombg/fix-checkout-branch
Fix gcb problems with verbosity and collation
2022-05-10 09:45:04 +08:00
Peter Tri Ho 33ad0ea71e fix: forgit::rebase not working in fish 2022-04-10 15:31:00 +10:00
Pablo M. Bermudo Garay 4dd2ca2271 Fix gcb sort
Use LC_ALL=C to avoid potential ordering issues related to the user's
locale configuration. Additionally, add the --stable option to ensure
that just the range defined with --key is used.
2022-04-06 15:48:49 +02:00
Pablo M. Bermudo Garay d32e3c282b Fix gcb verbose output
Delete the verbose option of git checkout, so just the branch names are
displayed.
2022-04-06 15:47:06 +02:00
Christopher Apple 701e3f3a4a Added rename support for fish 2022-03-22 09:06:52 -07:00
Christopher Apple b61df0c206 Added support for FORGIT_GLO_FORMAT 2022-03-21 09:49:00 -07:00
Christopher Apple c096f2bbda Added multi diff support for gd 2022-03-21 09:36:11 -07:00
Christopher Apple b98722008c Revert "Added multi diff support for gd"
This reverts commit 5b31faf7e2.
2022-03-21 09:35:51 -07:00
Christopher Apple 5b31faf7e2 Added multi diff support for gd 2022-03-21 09:33:55 -07:00
Christopher Apple f8514beb26 Adding grc 2022-03-21 08:31:40 -07:00
Christopher Apple 4027bee420 Apparently working preview update 2022-03-21 07:52:58 -07:00
Chris Apple 7b26cd46ac
Merge pull request #173 from cjappl/FixGaProblem
Reverted change b1c4c11959 to fix fish ga
2021-12-05 15:20:53 -08:00
Christopher Apple fe912482b5 Reverted change b1c4c11959 2021-12-05 15:17:05 -08:00