Radoslaw Szkodzinski wrote:
I'd like to write a multithreaded application using git,
Why on earth? The git tools aren't written to be thread-safe in that
manner, so you'll run into all sorts of problems. Unless you're talking
about managing the code for a multithreaded application with git, in
which case you should just go read the tutorial. However, feeling
slightly tipsy and in a distinctly good mood, I shall try to answer your
questions anyway.
so I'd like to see if
there are any races:
- push vs pull
One thread pushes to the repository while another is pulling from it at the
same time. I should get the older commit.
You will. Git atomizes (atomicizes? atomicifies?) pushes by updating the
branch head being pushed to after all the commit-, tree- and
blob-objects are written. Tags are handled separately but equally
atomically.
- push vs push
Both threads push at the same time. What happens?
Any good way to merge those pushes?
(I have full access to both repos)
Possibly those two aren't fast-forward of each other.
I think one of the pushes should abort in this case unless I force it.
Read the source to find out if it's locking the repo while updating or
not (I think it is, but I'm not sure). If it isn't the last one to
finish pushing wins out since the branch head update from that push will
overwrite the previous one.
- fetch vs fetch
I mean that two threads try to fetch from different repositories to a single
one. Possibly those two aren't fast-forward of each other.
Any good way to merge those fetches?
(I have full access to both repos)
git help octopus
You can fetch those two remote branch heads to local branches
simultaneously and then do the octopus in the master-thread while no
other updates are happening. Doing several simultanous merges to a
single branch is quite frankly so insane I have to go get myself a drink
just from thinking about it.
I'm meaning really bare git there, w/o bash+perl scripts.
I don't think you can do it without Python. The default merge strategy
is written in python, so.
--
Andreas Ericsson andreas.ericsson@xxxxxx
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html