From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-5.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 20C41207EC for ; Thu, 6 Oct 2016 13:39:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938876AbcJFNjD (ORCPT ); Thu, 6 Oct 2016 09:39:03 -0400 Received: from mx3-phx2.redhat.com ([209.132.183.24]:42235 "EHLO mx3-phx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934049AbcJFNjC (ORCPT ); Thu, 6 Oct 2016 09:39:02 -0400 Received: from zmail26.collab.prod.int.phx2.redhat.com (zmail26.collab.prod.int.phx2.redhat.com [10.5.83.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u96Ch2j3015329 for ; Thu, 6 Oct 2016 08:43:02 -0400 Date: Thu, 6 Oct 2016 08:43:02 -0400 (EDT) From: Josef Ridky To: git@vger.kernel.org Message-ID: <1911899288.2172724.1475757782111.JavaMail.zimbra@redhat.com> In-Reply-To: <1214659824.1976049.1475738509473.JavaMail.zimbra@redhat.com> References: <1329039097.128066.1475476591437.JavaMail.zimbra@redhat.com> <1499287628.1324571.1475653631366.JavaMail.zimbra@redhat.com> <1214659824.1976049.1475738509473.JavaMail.zimbra@redhat.com> Subject: [PATCH 1/2] Feature Request: user defined suffix for temp files created by git-mergetool MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.34.4.141] X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF48 (Linux)/8.0.6_GA_5922) Thread-Topic: Feature Request: user defined suffix for temp files created by git-mergetool Thread-Index: EzKs5iPhG+22gQ06GVmFwHQAiYHtK568p9ca Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This is the first of two variant for request to add option to change suffix of name of temporary files generated by git mergetool. This change is requested for cases, when is git mergetool used for local comparision between two version of same package during package rebase. Signed-off-by: Josef Ridky --- Documentation/git-mergetool.txt | 7 ++++++- git-mergetool.sh | 23 ++++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt index e846c2e..a212cef 100644 --- a/Documentation/git-mergetool.txt +++ b/Documentation/git-mergetool.txt @@ -8,7 +8,7 @@ git-mergetool - Run merge conflict resolution tools to resolve merge conflicts SYNOPSIS -------- [verse] -'git mergetool' [--tool=] [-y | --[no-]prompt] [...] +'git mergetool' [--tool=] [-y | --[no-]prompt] [-l | --local] [...] DESCRIPTION ----------- @@ -79,6 +79,11 @@ success of the resolution after the custom tool has exited. Prompt before each invocation of the merge resolution program to give the user a chance to skip the path. +-l:: +--local:: + Change suffix of name of temporary files generated by git + mergetool from `_REMOTE_` and `_LOCAL_` to `_OLD_` and `_NEW_`. + TEMPORARY FILES --------------- `git mergetool` creates `*.orig` backup files while resolving merges. diff --git a/git-mergetool.sh b/git-mergetool.sh index bf86270..1e04368 100755 --- a/git-mergetool.sh +++ b/git-mergetool.sh @@ -8,10 +8,11 @@ # at the discretion of Junio C Hamano. # -USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [file to merge] ...' +USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-l|--local] [file to merge] ...' SUBDIRECTORY_OK=Yes NONGIT_OK=Yes OPTIONS_SPEC= +LOCAL_MODE=false TOOL_MODE=merge . git-sh-setup . git-mergetool--lib @@ -271,10 +272,19 @@ merge_file () { BASE=${BASE##*/} fi - BACKUP="$MERGETOOL_TMPDIR/${BASE}_BACKUP_$$$ext" - LOCAL="$MERGETOOL_TMPDIR/${BASE}_LOCAL_$$$ext" - REMOTE="$MERGETOOL_TMPDIR/${BASE}_REMOTE_$$$ext" - BASE="$MERGETOOL_TMPDIR/${BASE}_BASE_$$$ext" + if test "$LOCAL_MODE" + then + + BACKUP="$MERGETOOL_TMPDIR/${BASE}_BACKUP_$$$ext" + LOCAL="$MERGETOOL_TMPDIR/${BASE}_NEW_$$$ext" + REMOTE="$MERGETOOL_TMPDIR/${BASE}_OLD_$$$ext" + BASE="$MERGETOOL_TMPDIR/${BASE}_BASE_$$$ext" + else + BACKUP="$MERGETOOL_TMPDIR/${BASE}_BACKUP_$$$ext" + LOCAL="$MERGETOOL_TMPDIR/${BASE}_LOCAL_$$$ext" + REMOTE="$MERGETOOL_TMPDIR/${BASE}_REMOTE_$$$ext" + BASE="$MERGETOOL_TMPDIR/${BASE}_BASE_$$$ext" + fi base_mode=$(git ls-files -u -- "$MERGED" | awk '{if ($3==1) print $1;}') local_mode=$(git ls-files -u -- "$MERGED" | awk '{if ($3==2) print $1;}') @@ -396,6 +406,9 @@ do --prompt) prompt=true ;; + -l|--local) + LOCAL_MODE=true + ;; --) shift break -- 2.7.4