You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
multiple concurrent git fetches could override refs each other.
In my experience also not all git operations cope well with concurrency,
so I think it's better to just add a big lock around it.
This is a context manager that provides an advisory write lock on the file specified by `filename` when entering the context, and releases the lock when leaving the context.
695
+
The lock is acquired using the `fcntl` module's `LOCK_EX` flag, which applies an exclusive write lock to the file.
696
+
"""
697
+
withfilename.open(mode) asfd:
698
+
fcntl.flock(fd, fcntl.LOCK_EX)
699
+
yieldfd
700
+
fcntl.flock(fd, fcntl.LOCK_UN)
701
+
702
+
703
+
defresolve_git_dir() ->Path:
704
+
dotgit=Path(".git")
705
+
ifdotgit.is_file():
706
+
actual_git_dir=dotgit.read_text().strip()
707
+
ifnotactual_git_dir.startswith("gitdir: "):
708
+
msg=f"Invalid .git file: {actual_git_dir} found in current directory"
709
+
raiseNixpkgsReviewError(msg)
710
+
returnPath() /actual_git_dir[len("gitdir: ") :]
711
+
712
+
ifdotgit.is_dir():
713
+
returndotgit
714
+
715
+
msg="Cannot find .git file or directory in current directory"
0 commit comments