git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-mergetool reverse file ordering

From
David Aguilar <davvid@gmail.com>
Date
Aug 17, 2016, 01:25 UTC
Message-ID
<20160817012554.GA12991@gmail.com>
In-Reply-To
<CAD8hE_xR2mB3=_oot9cWxmFy7z4oBhjABNOo3aJKN=bOw5ybzQ@mail.gmail.com>
On Mon, Aug 15, 2016 at 09:19:35PM +0100, Luis Gutierrez wrote:
Show 19 quoted lines
> > Thoughts?  Would you be interested in helping work up a patch
> > for this idea?  At a minimum we should also write a test case in
> > t/t7610-mergetool.sh to verify that it works as advertised.
> ....
> > Why not reuse the existing diff.orderFile config variable?  (Also
> > supported by the -O option to git-diff).
> 
> 
> I'll be happy to write a testcase, and to re-use the -O
> (diff.orderFile config var) option to git-diff as sugguested by John
> Keeping.
> 
> Is this the final spec?
> 
> 
> 
> I'll be happy to do that.
> 
> Luis

Hmm, I do like the idea of reusing the diff orderFile, but a mechanism for sorting arbitrary inputs based on the orderFile isn't currently exposed in a way that mergetool could use it.

Looking at the code in mergetool, we basically need something that has the same spec as "sort" itself, namely that it can take arbitrary arbitrary input on stdin and sort it.

Implementing the orderFile support would probably be best done in C. Would we want to expose it as an internal helper?

e.g.
	git diff--order-helper <order-file>
could be used to perform the sorting.

But, that sort is honestly kinda crude. It can't implement the interesting case where we want bar.h to sort before bar.c but not foo.h.

If we did the sort option, we could have both.
Thoughts?
-- 
David
Previous: Luis GutierrezNext: Johannes Sixt
Message 5 of 10 in “git-mergetool reverse file ordering”
  1. Luis GutierrezJul 27, 2016
  2. David AguilarAug 14, 2016
  3. John KeepingAug 14, 2016
  4. Luis GutierrezAug 15, 2016
  5. David AguilarAug 17, 2016
  6. Johannes SixtAug 17, 2016
  7. Johannes SixtAug 17, 2016
  8. David AguilarAug 17, 2016
  9. Johannes SixtAug 17, 2016
  10. David AguilarAug 17, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.