Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When multiple clients push to same remote repository, how does git deal with concurrency issues?

For each http request, a separate process git-http-backend runs on the server side.

When multiple clients push to same remote repository, what does it do to handle concurrency issues?

For example, does it create lock file and what the name is?

Note: Remote repository is bare.

like image 586
linquize Avatar asked Nov 03 '22 01:11

linquize


1 Answers

In the same manner as if invoked via SSH -- see the update_ref function in refs.c. The actual implementation of the locking mechanism lives in the lock_file function in lockfile.c, and yes, it creates a .lock file in there. Under the hood, it's done via the O_EXCL option to open().

like image 89
Jan Kundrát Avatar answered Nov 08 '22 01:11

Jan Kundrát