锁定git存储库(如果已在使用中) [英] lock git repository if it is already in use

查看:148
本文介绍了锁定git存储库(如果已在使用中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个本地存储库,也有子模块存储库。如果我尝试从两个不同的eclipse第三方工具实例访问该存储库,如果该eclipse存储库正在被git阻止访问第二个第三方工具由第三个日蚀方工具使用?如果git不限制第二个第三方工具,该限制的方法。所有第三方工具的用户都是相同的

I am having a local repository ,Which has sub module repository also.If i try to access the repository from two different instance of eclipse third party tool.Will git prevent the access for second third party tool if that eclipse repository is being by used by first third eclipse party tool? if git does not restrict the second third party tool how to do that restriction.User is same for all third party tool

推荐答案

Git 2.25(2020年第1季度), git rev-parse --git-path HEAD.lock ; (控制并发访问权限的方法之一)在辅助 工作树中运行时,没有给出正确的路径

With Git 2.25 (Q1 2020), "git rev-parse --git-path HEAD.lock" (one of the way to control concurrent acces) did not give the right path when run in a secondary worktree.

请参见提交76a53d6 提交3ce4721 (2019年10月28日)通过 Johannes Schindelin( dscho

(由合并 Junio C Hamano-gitster - href = https://github.com/git/git/commit/a2b0451434db903975cb1dfda0eafef939ebc6db rel = nofollow noreferrer>提交a2b0451 ,2019年12月1日)

See commit 76a53d6, commit 3ce4721 (28 Oct 2019) by Johannes Schindelin (dscho).
(Merged by Junio C Hamano -- gitster -- in commit a2b0451, 01 Dec 2019)

签名人:Johannes Schindelin

自引入工作树以来( Git 2.5,2015年7月),需要 git_path()函数 _really _被称为获得 logs / HEAD 的路径( HEAD 特定于工作树,因此它的reflog也是如此) 。但是,对于 logs / HEAD.lock ,返回错误的路径。

Ever since worktrees were introduced (Git 2.5, July 2015) , the git_path() function _really_ needed to be called e.g. to get at the path to logs/HEAD (HEAD is specific to the worktree, and therefore so is its reflog). However, the wrong path is returned for logs/HEAD.lock.

这无关紧要,只要Git可执行文件正在执行询问,因为该 logs / HEAD.lock 文件的路径是由 git_path( logs / HEAD)通过添加 .lock 后缀。

This does not matter as long as the Git executable is doing the asking, as the path for that logs/HEAD.lock file is constructed from git_path("logs/HEAD") by appending the .lock suffix.

但是,Git GUI刚刚学会了使用-git -path 而不是将相对路径附加到 git rev-parse --git-dir 返回的内容上(因此,不仅要使用正确的钩子,目录,但在主树以外的工作树中也要使用正确的路径)。虽然看起来特别不是Git GUI要求输入 logs / HEAD.lock ,但为了安全起见,不要后悔。

However, Git GUI just learned to use --git-path instead of appending relative paths to what git rev-parse --git-dir returns (and as a consequence not only using the correct hooks directory, but also using the correct paths in worktrees other than the main one). While it does not seem as if Git GUI in particular is asking for logs/HEAD.lock, let's be safe rather than sorry.

旁注:Git GUI _does _要求提供 index.lock ,但是由于 update_common_dir()倾向于将未知路径保留在(特定于工作树的)git目录中。

Side note: Git GUI _does_ ask for index.lock, but that is already resolved correctly, due to update_common_dir() preferring to leave unknown paths in the (worktree-specific) git directory.

这篇关于锁定git存储库(如果已在使用中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆