* mergetool local/remote improvements?
@ 2008-02-20 21:40 Jay Soffian
0 siblings, 0 replies; only message in thread
From: Jay Soffian @ 2008-02-20 21:40 UTC (permalink / raw)
To: Git Mailing List
When in branch <mine> and doing "git rebase <upstream>", if there are
any conflicts, the merge tool will come up with the version of the file
from branch <mine> tagged with ".REMOTE" and the version from branch
<upstream> tagged ".LOCAL".
I understand the reason for this, but still, it seems backwards. So I
was going to propose something like the patch below, but I realized that
it might be more useful if mergetool took --local and --remote arguments
so that the caller could provide more meaningful names, e.g. given
--local=mybranch
--remote=theirbranch
mergetool would use mybranch/MYBRANCH in place of local/LOCAL and
similarly theirbranch/THEIRBRANCH in place of remote/REMOTE.
Of course, I then have to wonder if mergetool could use branch names by
default in those cases where branch names can be determined
unambiguously (not sure how to do that though other than for git-merge
and git-rebase to leave a hint about the operation in progress).
Thoughts?
git-mergetool.sh | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/git-mergetool.sh b/git-mergetool.sh
index cbbb707..c688858 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -20,6 +20,10 @@ is_symlink () {
test "$1" = 120000
}
+is_rebase_merge () {
+ test -d "$GIT_DIR/.dotest-merge"
+}
+
local_present () {
test -n "$local_mode"
}
@@ -162,12 +166,19 @@ merge_file () {
cp -- "$BACKUP" "$path"
base_mode=`git ls-files -u -- "$path" | awk '{if ($3==1) print $1;}'`
- local_mode=`git ls-files -u -- "$path" | awk '{if ($3==2) print $1;}'`
- remote_mode=`git ls-files -u -- "$path" | awk '{if ($3==3) print $1;}'`
+ base_present && git cat-file blob ":1:$prefix$path" >"$BASE" 2>/dev/null
- base_present && git cat-file blob ":1:$prefix$path" >"$BASE" 2>/dev/null
- local_present && git cat-file blob ":2:$prefix$path" >"$LOCAL" 2>/dev/null
- remote_present && git cat-file blob ":3:$prefix$path" >"$REMOTE"
2>/dev/null
+ if is_rebase_merge; then
+ local_mode=`git ls-files -u -- "$path" | awk '{if ($3==3) print $1;}'`
+ local_present && git cat-file blob ":3:$prefix$path" >"$LOCAL" 2>/dev/null
+ remote_mode=`git ls-files -u -- "$path" | awk '{if ($3==2) print $1;}'`
+ remote_present && git cat-file blob ":2:$prefix$path" >"$REMOTE" 2>/dev/null
+ else
+ local_mode=`git ls-files -u -- "$path" | awk '{if ($3==2) print $1;}'`
+ local_present && git cat-file blob ":2:$prefix$path" >"$LOCAL" 2>/dev/null
+ remote_mode=`git ls-files -u -- "$path" | awk '{if ($3==3) print $1;}'`
+ remote_present && git cat-file blob ":3:$prefix$path" >"$REMOTE" 2>/dev/null
+ fi
if test -z "$local_mode" -o -z "$remote_mode"; then
echo "Deleted merge conflict for '$path':"
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-02-20 21:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-20 21:40 mergetool local/remote improvements? Jay Soffian
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).