Commit 6dbd5cca authored by Jérome Perrin's avatar Jérome Perrin Committed by Rafael Monnerat

tools: a simple git.mergetool for working with buildout.hash.cfg

Rewriting commit history with `git rebase -i` always caused some
conflicts on md5sum of modified files. `update-hash` made all this
easier, because we could just revert buildout.hash.cfg, re-run
`update-hash` and commit the changes.

This tool makes this scenario a bit more user friendly by automating the
steps by running as a git mergetool.

An interactive rebase session can be initiated by running this command
from software/*/ directory:

`git rebase -i --exec "$(pwd)/../../update-hash $(pwd)/buildout.hash.cfg" origin/master`

and if conflict occur, run:

`git mergetool --tool update-hash-mergetool && EDITOR=cat git rebase --continue`

This way, rebase session can be almost non interactive (still have to
run the above mergetool command) when conflicts are only on md5sum
updates.

/reviewed-on nexedi/slapos!273
parent f5fc6d6d
#!/bin/bash -e
# simple mergetool for buildout.hash.cfg - just update hash
# suggested installation:
# git config merge.tool update-hash-mergetool
# git config mergetool.update-hash-mergetool.cmd './update-hash-mergetool "$BASE" "$LOCAL" "$REMOTE" "$MERGED"'
# git config mergetool.update-hash-mergetool.trustExitCode true
BASE=$1
LOCAL=$2
REMOTE=$3
MERGED=$4
if echo "$MERGED" | grep -q "buildout.hash.cfg"; then
cp $REMOTE $MERGED
exec ./update-hash $MERGED
else
echo "this mergetool only supports buildout.hash.cfg" 1>&2
exit 1
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment