* How to install and use a custom merge driver
@ 2009-01-28 3:10 Alec Clews
2009-01-28 6:18 ` Jeff King
0 siblings, 1 reply; 9+ messages in thread
From: Alec Clews @ 2009-01-28 3:10 UTC (permalink / raw)
To: git
Background:
I want to use git to track the delivery of patch files into existing
file trees. This means that new files will need to be copied over
existing files (especially in the case of binary files or textual conflicts)
To this end I want to use a custom merge driver (actually the cp command)
Setup:
I have set up my ..git/info/gitattributes as follows
* merge=overwrite
I have defined in .git/config
[merge "overwrite"]
name = overwrite using cp
driver = cp %B %A
Problem:
However when I perform a git merge the default merge is being called. Is
there something else needed to make git perform the copy operation?
Many thanks
--
Alec Clews
Personal <alec.clews@gmail.com> Melbourne, Australia.
Jabber: alecclews@jabber.org.au PGPKey ID: 0x9BBBFC7C
Blog http://alecthegeek.wordpress.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to install and use a custom merge driver
2009-01-28 3:10 How to install and use a custom merge driver Alec Clews
@ 2009-01-28 6:18 ` Jeff King
2009-01-28 23:04 ` Alec Clews
0 siblings, 1 reply; 9+ messages in thread
From: Jeff King @ 2009-01-28 6:18 UTC (permalink / raw)
To: Alec Clews; +Cc: git
On Wed, Jan 28, 2009 at 02:10:18PM +1100, Alec Clews wrote:
> Setup:
>
> I have set up my ..git/info/gitattributes as follows
>
> * merge=overwrite
Your setup looks right, except that the correct file is
".git/info/attributes".
-Peff
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to install and use a custom merge driver
2009-01-28 6:18 ` Jeff King
@ 2009-01-28 23:04 ` Alec Clews
2009-01-28 23:31 ` Alec Clews
2009-01-29 3:25 ` Jeff King
0 siblings, 2 replies; 9+ messages in thread
From: Alec Clews @ 2009-01-28 23:04 UTC (permalink / raw)
To: git
Jeff King <peff <at> peff.net> writes:
> On Wed, Jan 28, 2009 at 02:10:18PM +1100, Alec Clews wrote:
>
> > Setup:
> >
> > I have set up my ..git/info/gitattributes as follows
> >
> > * merge=overwrite
>
> Your setup looks right, except that the correct file is
> ".git/info/attributes".
Thanks Jeff
I fixed that problem -- however it did not make any difference.
Is there someway to enable logging to see how git is making this choice?
- Alec
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to install and use a custom merge driver
2009-01-28 23:04 ` Alec Clews
@ 2009-01-28 23:31 ` Alec Clews
2009-01-29 3:25 ` Jeff King
1 sibling, 0 replies; 9+ messages in thread
From: Alec Clews @ 2009-01-28 23:31 UTC (permalink / raw)
To: git
Alec Clews <alecclews <at> gmail.com> writes:
> Is there someway to enable logging to see how git is making this choice?
Found the answer to my question.
GIT_MERGE_VERBOSITY=5
GIT_TRACE=true
Which results in
+ git merge --stat del2
trace: built-in: git 'merge' '--stat' 'del2'
Merging:
38f3eb9 Accepting delivery del1
virtual del2
found 1 common ancestor(s):
af9dc93 Creating empty staging repo
Auto-merging src/main.c
CONFLICT (add/add): Merge conflict in src/main.c
Automatic merge failed; fix conflicts and then commit the result.
So I'm none the wiser :-(. Any suggestions from wiser people than I?
Thanks
-Alec
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to install and use a custom merge driver
2009-01-28 23:04 ` Alec Clews
2009-01-28 23:31 ` Alec Clews
@ 2009-01-29 3:25 ` Jeff King
2009-01-29 4:47 ` Alec Clews
1 sibling, 1 reply; 9+ messages in thread
From: Jeff King @ 2009-01-29 3:25 UTC (permalink / raw)
To: Alec Clews; +Cc: git
On Wed, Jan 28, 2009 at 11:04:02PM +0000, Alec Clews wrote:
> I fixed that problem -- however it did not make any difference.
Can you post an exact recipe for recreating the problem? It works just
fine here, using:
-- >8 --
commit() {
echo $1 >file && git add file && git commit -m $1
}
mkdir repo && cd repo && git init
commit base
commit branch-master
git checkout -b other HEAD^
commit branch-other
echo '* merge=overwrite' >.git/info/attributes
cat >>.git/config <<'EOF'
[merge "overwrite"]
name = overwrite using cp
driver= cp %B %A
EOF
git merge master
-- 8< --
I get an automatic merge with the contents from "master" (and without
the merge config, there is obviously a conflict).
> Is there someway to enable logging to see how git is making this choice?
You can try "git check-attr merge file" to be sure that it is picking up
the attribute.
-Peff
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to install and use a custom merge driver
2009-01-29 3:25 ` Jeff King
@ 2009-01-29 4:47 ` Alec Clews
2009-01-29 5:03 ` Jeff King
0 siblings, 1 reply; 9+ messages in thread
From: Alec Clews @ 2009-01-29 4:47 UTC (permalink / raw)
To: git
Problem solved.
It appears that TAB is not supported as white space in either attributes or
config files? I removed all the tabs and it works as described on the box
Many many thanks for the help Jeff
- Alec
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to install and use a custom merge driver
2009-01-29 4:47 ` Alec Clews
@ 2009-01-29 5:03 ` Jeff King
2009-01-29 7:00 ` Alec Clews
0 siblings, 1 reply; 9+ messages in thread
From: Jeff King @ 2009-01-29 5:03 UTC (permalink / raw)
To: Alec Clews; +Cc: git
On Thu, Jan 29, 2009 at 04:47:19AM +0000, Alec Clews wrote:
> It appears that TAB is not supported as white space in either attributes or
> config files? I removed all the tabs and it works as described on the box
That's odd. It should be fine. And if I repeat the test I posted with:
printf '*\tmerge=overwrite\n' >.git/info/attributes
(printf '[merge "overwrite"]\n'
printf '\tname = overwrite using cp\n'
printf '\tdriver = cp %%B %%A\n'
) >>.git/config
it works as before.
What git version are you using? Can you post a shell snippet that breaks
reliably?
-Peff
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to install and use a custom merge driver
2009-01-29 5:03 ` Jeff King
@ 2009-01-29 7:00 ` Alec Clews
2009-01-29 7:11 ` Jeff King
0 siblings, 1 reply; 9+ messages in thread
From: Alec Clews @ 2009-01-29 7:00 UTC (permalink / raw)
To: Jeff King; +Cc: git
Jeff King wrote:
> On Thu, Jan 29, 2009 at 04:47:19AM +0000, Alec Clews wrote:
>
>
> What git version are you using? Can you post a shell snippet that breaks
> reliably?
>
I used 1.5.6.3 on Ubuntu and 1.6.1.1 on Cygwin.
The problem appears to be spaces around '=' in the attributes file. This
fails for me
----------8<----------------------------------
commit() {
echo $1 >file && git add file && git commit -m $1
}
rm -rf repo
mkdir repo && cd repo && git init
commit base
commit branch-master
git checkout -b other HEAD^
commit branch-other
echo '* merge = overwrite' >.git/info/attributes
cat >>.git/config <<'EOF'
[merge "overwrite"]
name = overwrite using cp
driver= cp %B %A
EOF
git merge master
----------8<---------------------------------
--
Alec Clews
Personal <alec.clews@gmail.com> Melbourne, Australia.
Jabber: alecclews@jabber.org.au PGPKey ID: 0x9BBBFC7C
Blog http://alecthegeek.wordpress.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to install and use a custom merge driver
2009-01-29 7:00 ` Alec Clews
@ 2009-01-29 7:11 ` Jeff King
0 siblings, 0 replies; 9+ messages in thread
From: Jeff King @ 2009-01-29 7:11 UTC (permalink / raw)
To: Alec Clews; +Cc: git
On Thu, Jan 29, 2009 at 06:00:51PM +1100, Alec Clews wrote:
> The problem appears to be spaces around '=' in the attributes file. This
> fails for me
> [...]
> echo '* merge = overwrite' >.git/info/attributes
Ah, OK. That isn't supposed to work. The attributes are whitespace
separated, and some don't even have an equals at all (e.g., "merge",
"-merge", and "merge=foo" are all valid). So that parses to "please use
the ordinary text merge driver", and some attributes that nobody uses
called "=" and "overwrite".
-Peff
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-01-29 7:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-28 3:10 How to install and use a custom merge driver Alec Clews
2009-01-28 6:18 ` Jeff King
2009-01-28 23:04 ` Alec Clews
2009-01-28 23:31 ` Alec Clews
2009-01-29 3:25 ` Jeff King
2009-01-29 4:47 ` Alec Clews
2009-01-29 5:03 ` Jeff King
2009-01-29 7:00 ` Alec Clews
2009-01-29 7:11 ` Jeff King
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).