git-mergetool reverse file ordering

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
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"

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]