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

Re: git-mergetool: wrap tools with 3 files only to use the BASE file instead of MERGED

From
TOTanguy Ortolo <tanguy+debian@ortolo.eu>
Date
Aug 10, 2011, 17:24 UTC
Message-ID
<20110810172458.GA18167@ortolo.eu>
In-Reply-To
<20110810161211.GC4076@elie.gateway.2wire.net>
Jonathan Nieder, 2011-08-10 11:12 UTC-0500:
> I think you forgot to include the example.
Yes, sorry. Here it is.
-- 
Tanguy Ortolo


#! /bin/sh

BASE="$1"
LOCAL="$2"
REMOTE="$3"
MERGED="$4"

MTIME_BEFORE="$(stat --format='%Y' "$BASE")"
meld "$LOCAL" "$BASE" "$REMOTE"
MTIME_AFTER="$(stat --format="%Y" "$BASE")"

if [ "$MTIME_BEFORE" != "$MTIME_AFTER" ]
then
    # The base file was modified, which means the user saved it
    cp "$BASE" "$MERGED"
else
    # The user did not save the file: merge failed
    exit 1
fi
Previous: Jonathan NiederNext: Sebastian Schuberth
Message 2 of 7 in “Re: git-mergetool: wrap tools with 3 files only to use the BASE file instead of MERGED”
  1. Jonathan NiederAug 10, 2011
  2. Tanguy OrtoloAug 10, 2011
  3. Sebastian SchuberthAug 10, 2011
  4. David AguilarAug 11, 2011
  5. Jonathan NiederAug 11, 2011
  6. David AguilarAug 11, 2011
  7. Sebastian SchuberthAug 11, 2011

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.