From 032b52f6d53826a81dfca716d59e634ce60c0983 Mon Sep 17 00:00:00 2001 From: sandr01d <88739791+sandr01d@users.noreply.github.com> Date: Sun, 31 Mar 2024 00:31:48 +0100 Subject: [PATCH] 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. --- bin/git-forgit | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/git-forgit b/bin/git-forgit index 4991781..12200be 100755 --- a/bin/git-forgit +++ b/bin/git-forgit @@ -742,7 +742,9 @@ _forgit_checkout_commit() { } _forgit_branch_preview() { - git log "$1" "${_forgit_log_preview_options[@]}" + # the trailing '--' ensures that this works for branches that have a name + # that is identical to a file + git log "$1" "${_forgit_log_preview_options[@]}" -- } _forgit_git_branch_delete() {