git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luis Gutierrez <luisgutz@gmail.com>
To: git@vger.kernel.org
Subject: git-mergetool reverse file ordering
Date: Wed, 27 Jul 2016 11:14:28 +0100	[thread overview]
Message-ID: <CAD8hE_yzNZDPkxRy8s4Fy2_dZN5ppWzLM_2xc01C-VAdR1Pj_g@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 625 bytes --]

Hi,

Attached is a potential patch for reversing the order on which
git-mergetool presents the files to merge.

Currently, when running git-mergetool, it performs a sort of the files
to merge by alphabetical ordering. When working on C, this has the
annoying effect of presenting the merge for a .c* files before the
header files; which is always a bit harder to do. Reading the header
first to figure out what the other dude changed is usually preferred.

The attach patch reverse the order (-r flag to sort) so *.h* are
merged before  *.c* files

PS, given the simplicity of the patch, I have not tested it.

Regards

Luis

[-- Attachment #2: sort-for-c-files.txt --]
[-- Type: text/plain, Size: 501 bytes --]

diff --git a/git-mergetool.sh b/git-mergetool.sh
index bf86270..cce3b0d 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -453,10 +453,10 @@ then
 	then
 		files=$(git rerere remaining)
 	else
-		files=$(git ls-files -u | sed -e 's/^[^	]*	//' | sort -u)
+		files=$(git ls-files -u | sed -e 's/^[^	]*	//' | sort -u -r)
 	fi
 else
-	files=$(git ls-files -u -- "$@" | sed -e 's/^[^	]*	//' | sort -u)
+	files=$(git ls-files -u -- "$@" | sed -e 's/^[^	]*	//' | sort -u -r)
 fi
 
 if test -z "$files"

             reply	other threads:[~2016-07-27 10:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27 10:14 Luis Gutierrez [this message]
2016-08-14  3:42 ` git-mergetool reverse file ordering David Aguilar
2016-08-14 10:38   ` John Keeping
2016-08-15 20:19     ` Luis Gutierrez
2016-08-17  1:25       ` David Aguilar
2016-08-17  6:05         ` Johannes Sixt
2016-08-17  6:10           ` Johannes Sixt
2016-08-17  6:46             ` David Aguilar
2016-08-17  7:35               ` Johannes Sixt
2016-08-17 21:18                 ` David Aguilar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAD8hE_yzNZDPkxRy8s4Fy2_dZN5ppWzLM_2xc01C-VAdR1Pj_g@mail.gmail.com \
    --to=luisgutz@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).