From 1b7db0fb6e6cba254a9702b51716666c98cb1883 Mon Sep 17 00:00:00 2001 From: carlfriedrich Date: Tue, 12 Jul 2022 15:47:28 +0200 Subject: [PATCH] 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. --- conf.d/forgit.plugin.fish | 4 ++-- forgit.plugin.zsh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf.d/forgit.plugin.fish b/conf.d/forgit.plugin.fish index 266a78e..ba167c8 100644 --- a/conf.d/forgit.plugin.fish +++ b/conf.d/forgit.plugin.fish @@ -344,8 +344,8 @@ function forgit::cherry::pick -d "git cherry-picking" --argument-names 'target' " echo $base echo $target - git cherry "$base" "$target" --abbrev -v | cut -d ' ' -f2- | - env FZF_DEFAULT_OPTS="$opts" fzf | cut -d' ' -f1 | + git cherry "$base" "$target" --abbrev -v | + env FZF_DEFAULT_OPTS="$opts" fzf | cut -d' ' -f2 | xargs -I% git cherry-pick % end diff --git a/forgit.plugin.zsh b/forgit.plugin.zsh index 1541895..3e6210c 100755 --- a/forgit.plugin.zsh +++ b/forgit.plugin.zsh @@ -159,8 +159,8 @@ forgit::cherry::pick() { -m -0 --tiebreak=index $FORGIT_CHERRY_PICK_FZF_OPTS " - git cherry "$base" "$target" --abbrev -v | cut -d ' ' -f2- | - FZF_DEFAULT_OPTS="$opts" fzf | cut -d' ' -f1 | + git cherry "$base" "$target" --abbrev -v | + FZF_DEFAULT_OPTS="$opts" fzf | cut -d' ' -f2 | xargs -I% git cherry-pick % }