From: Andreas Ericsson <ae@op5.se>
To: Radoslaw Szkodzinski <astralstorm@o2.pl>
Cc: git@vger.kernel.org
Subject: Re: Question about possible git races
Date: Thu, 23 Mar 2006 00:28:30 +0100 [thread overview]
Message-ID: <4421DD9E.7030201@op5.se> (raw)
In-Reply-To: <200603201724.12442.astralstorm@o2.pl>
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@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
next prev parent reply other threads:[~2006-03-22 23:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-20 16:24 Question about possible git races Radoslaw Szkodzinski
2006-03-22 20:46 ` Radoslaw Szkodzinski
2006-03-22 23:55 ` Andreas Ericsson
2006-03-22 23:28 ` Andreas Ericsson [this message]
2006-03-23 1:24 ` Radoslaw Szkodzinski
2006-03-23 2:55 ` Andreas Ericsson
2006-03-23 20:51 ` Radoslaw Szkodzinski
2006-03-23 0:24 ` Junio C Hamano
2006-03-23 1:22 ` Radoslaw Szkodzinski
2006-03-23 1:46 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4421DD9E.7030201@op5.se \
--to=ae@op5.se \
--cc=astralstorm@o2.pl \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).