Commit graph

66 commits

Author SHA1 Message Date
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
Chris Apple 656087369f Fixed git add for fish shell 2021-12-01 09:03:24 -08:00
Chinmay Dalal b1c4c11959
use fish to interpret preview command
fixes #168
2021-11-30 09:03:41 +05:30
Peter Tri Ho ed51746687 fix: restore setting FORGIT_INSTALL_DIR in fish #165 2021-10-26 13:32:05 +11:00
Wenxuan Zhang a047bae35a
Revert "support fish shell" #164
This reverts commit 950a7352db.
2021-10-25 10:27:32 +08:00
Wenxuan eb6db722cd
Merge pull request #164 from wren/git-forgit-147 2021-10-22 10:41:00 +08:00
Wenxuan Zhang 05ab1c5864
Revert "fix: gcb can switch to an existed branch"
This reverts commit 8107352941.
2021-10-20 10:55:53 +08:00
Wenxuan Zhang 950a7352db
support fish shell 2021-10-20 10:17:03 +08:00
Wenxuan Zhang 8107352941
fix: gcb can switch to an existed branch 2021-09-23 10:17:23 +08:00
Chris Apple 9f3a423920
Fix issue where gitignore cache was not being properly set up
fix #161
2021-08-02 09:15:02 -07:00
Milan Vit da234f6947
Fix gcb alias in Fish 2021-07-19 13:27:52 +09:00