Re: [PATCH v2 4/4] mergetool: fix running in subdir when rerere enabled
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Jan 6, 2017, 09:42 UTC
- Message-ID
- <199807ae-844c-57cd-28cf-2c10b3aee7a9@kdbg.org>
- In-Reply-To
- <20170106010945.79382-5-hansenr@google.com>
Am 06.01.2017 um 02:09 schrieb Richard Hansen:
Show 29 quoted lines
> If rerere is enabled and no pathnames are given, run cd_to_toplevel
> before running 'git diff --name-only' so that 'git diff --name-only'
> sees the pathnames emitted by 'git rerere remaining'.
>
> Also run cd_to_toplevel before running 'git rerere remaining' in case
> 'git rerere remaining' is ever changed to print pathnames relative to
> the current directory rather than to $GIT_WORK_TREE.
>
> This fixes a regression introduced in
> 57937f70a09c12ef484c290865dac4066d207c9c (v2.11.0).
>
> Signed-off-by: Richard Hansen <hansenr@google.com>
> ---
> git-mergetool.sh | 1 +
> t/t7610-mergetool.sh | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/git-mergetool.sh b/git-mergetool.sh
> index e52b4e4f2..67ea0d6db 100755
> --- a/git-mergetool.sh
> +++ b/git-mergetool.sh
> @@ -456,6 +456,7 @@ main () {
>
> if test $# -eq 0 && test -e "$GIT_DIR/MERGE_RR"
> then
> + cd_to_toplevel
> set -- $(git rerere remaining)
> if test $# -eq 0
> thenThis cannot be a complete solution. Why do we have another cd_to_toplevel later, after `git diff --name-only -- "$@"`?
Maybe it is necessary to revert back to the flow control that we had before 57937f70a09c ("mergetool: honor diff.orderFile", 2016-10-07)? It did not have `test $# -eq 0` and `test -e "$GIT_DIR/MERGE_RR"` in a single condition.
-- Hannes