- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
据我所知,所有分布式版本控制系统都要求您克隆整个存储库。出于这个原因,将大量内容放在一个单一的存储库中是不明智的(感谢 this answer)。我知道这不是错误而是功能,但我想知道这是否是所有分布式修订控制系统的要求。
在分布式 rcs 中,文件(或内容块)的历史记录是一个有向无环图,那么为什么不能克隆这个单个 DAG 而不是存储库中所有图的集合?也许我错过了一些东西,但以下用例很难做到:
最佳答案
从 Git 2.17(2018 年第二季度,10 年后)开始,可以实现 Mercurial 计划实现的功能:“narrow clone ”,即您只检索特定子目录数据的克隆。
这也称为“部分克隆”。
这与现在的不同
jeffhostetler
)(2017 年 12 月 8 日)。
jhowtan
) (2017 年 12 月 8 日)。
gitster
-- 在
commit 6bed209 中 merge ,2018 年 2 月 13 日)
git clone --no-checkout --filter=blob:none "file://$(pwd)/srv.bare" pc1
sha1_file: support lazily fetching missing objects
Teach
sha1_file
to fetch objects from the remote configured inextensions.partialclone
whenever an object is requested but missing.
extensions.partialclone
也没有定义部分克隆过滤器。
jhowtan
)(2018 年 6 月 11 日)。
gitster
-- 在
commit 92e1bbc 中 merge ,2018 年 6 月 28 日)
upload-pack
: disable object filtering when disabled by config
When
upload-pack
gained partial clone support (v2.17.0-rc0~132^2~12,2017-12-08), it was guarded by theuploadpack.allowFilter
config itemto allow server operators to control when they start supporting it.That config item didn't go far enough, though: it controls whether the'
filter
' capability is advertised, but if a (custom) client ignoresthe capability advertisement and passes a filter specification anyway,the server would handle that despite allowFilter being false.This is particularly significant if a security bug is discovered inthis new experimental partial clone code.
Installations withoutuploadpack.allowFilter
ought not to be affected since they don't intend to support partial clone, but they would be swept up into beingvulnerable.
git fetch $repo $object
”没有正确获取由 promise 包文件中的对象引用的请求对象,该对象已修复。
jhowtan
)(2018 年 9 月 21 日)。
gitster
-- 在
commit a1e9dff 中 merge ,2018 年 10 月 19 日)
fetch
: in partial clone, check presence of targets
When fetching an object that is known as a promisor object to the localrepository, the connectivity check in
quickfetch()
inbuiltin/fetch.c
succeeds, causing object transfer to be bypassed.
However, this should not happen if that object is merely promised and not actually present.Because this happens, when a user invokes "
git fetch origin <sha-1>
" onthe command-line, the<sha-1>
object may not actually be fetched eventhough the command returns an exit code of 0. This is a similar issue(but with a different cause) to the one fixed by a0c9016("upload-pack: send refs' objects despite "filter"", 2018-07-09, Git v2.19.0-rc0).Therefore, update
quickfetch()
to also directly check for the presenceof all objects to be fetched.
git rev-list --exclude-promisor-objects
列出部分克隆的对象,不包括“promisor”对象
(For internal use only.) Prefilter object traversal at promisor boundary.
This is used with partial clone.
This is stronger than--missing=allow-promisor
because it limits the traversal, rather than just silencing errors about missing objects.
matvore
)(2018 年 12 月 5 日)。
gitster
-- 在
commit c333fe7 中 merge ,2019 年 1 月 14 日)
"
git rev-list --exclude-promisor-objects
" had to take an object that does not exist locally (and is lazily available) from the command line without barfing, but the code dereferenced NULL.
list-objects.c
:不要为缺少的 cmdline 对象设置段错误
When a command is invoked with both
--exclude-promisor-objects
,--objects-edge-aggressive
, and a missing object on the command line, therev_info.cmdline
array could get a NULL pointer for the value of an 'item
' field.
Prevent dereferencing of aNULL
pointer in that situation.
matvore
)(2018 年 12 月 3 日)。
gitster
-- 在
commit 6e5be1f 中 merge ,2019 年 1 月 14 日)
exclude-promisor-objects
: declare when option is allowed
The
--exclude-promisor-objects
option causes some funny behavior in atleast two commands:log
andblame
.
It causes a BUG crash:$ git log --exclude-promisor-objects
BUG: revision.c:2143: exclude_promisor_objects can only be used
when fetch_if_missing is 0
Aborted
[134]Fix this such that the option is treated like any other unknown option.
The commands that must support it are limited, so declare in those commands that the flag is supported.
In particular:pack-objects
prune
rev-listThe commands were found by searching for logic which parses
--exclude-promisor-objects
outside ofrevision.c
.
Extra logic outside ofrevision.c
is needed becausefetch_if_missing
must be turned on beforerevision.c
sees the option or it will BUG-crash. The above list is supported by the fact that no other command is introspectively invoked by another command passing--exclude-promisor-object
.
git diff
”时,我们可以预先知道哪个
jhowtan
)。
gitster
-- 在
commit 32dc15d 中 merge ,2019 年 4 月 25 日)
diff
: batch fetching of missing blobs
When running a command like "
git show
" or "git diff
" in a partial clone,batch all missing blobs to be fetched as one request.This is similar to c0c578b ("
unpack-trees
: batch fetching of missingblobs", 2017-12-08, Git v2.17.0-rc0), but for another command.
derrickstolee
)(2019 年 5 月 28 日)。
gitster
-- merge 于
commit 5d5c46b ,2019 年 6 月 17 日)
sha1-file
: splitOBJECT_INFO_FOR_PREFETCH
The
OBJECT_INFO_FOR_PREFETCH
bitflag was added tosha1-file.c
in 0f4a4fb (sha1-file
: supportOBJECT_INFO_FOR_PREFETCH
, 2019-03-29, Git v2.22.0-rc0) and is used to prevent thefetch_objects()
method when enabled.However, there is a problem with the current use.
The definition ofOBJECT_INFO_FOR_PREFETCH
is given by adding 32 toOBJECT_INFO_QUICK
.
This is clearly stated above the definition (in a comment) that this is soOBJECT_INFO_FOR_PREFETCH
impliesOBJECT_INFO_QUICK
.
The problem is that using "flag & OBJECT_INFO_FOR_PREFETCH
" means thatOBJECT_INFO_QUICK
also impliesOBJECT_INFO_FOR_PREFETCH
.Split out the single bit from
OBJECT_INFO_FOR_PREFETCH
into a newOBJECT_INFO_SKIP_FETCH_OBJECT
as the single bit and keepOBJECT_INFO_FOR_PREFETCH
as the union of two flags.
git fetch
”变成了一个懒惰的克隆忘记获取基础对象
jhowtan
)(2019 年 5 月 14 日)。
gitster
-- 在
commit 8867aa8 中 merge ,2019 年 6 月 21 日)
index-pack
: prefetch missingREF_DELTA
bases
When fetching, the client sends "
have
" commit IDs indicating that theserver does not need to send any object referenced by those commits,reducing network I/O.
When the client is a partial clone, the client still sends "have
"s in this way, even if it does not have every object referenced by a commit it sent as "have
".If a server omits such an object, it is fine: the client could lazily fetch that object before this fetch, and it can still do so after.
The issue is when the server sends a thin pack containing an object that is a
REF_DELTA
against such a missing object:index-pack
fails to fixthe thin pack.
When support for lazily fetching missing objects was added in 8b4c010 ("sha1_file
: support lazily fetching missing objects", 2017-12-08, Git v2.17.0-rc0), support inindex-pack
was turned off in the belief that it accesses the repo only to do hash collision checks.
However, this is not true: it also needs to access the repo to resolveREF_DELTA
bases.Support for lazy fetching should still generally be turned off in index-pack because it is used as part of the lazy fetching process itself (if not, infinite loops may occur), but we do need to fetch the
REF_DELTA
bases.
(When fetchingREF_DELTA
bases, it is unlikely that those areREF_DELTA
themselves, because we do not send "have
" when making such fetches.)To resolve this, prefetch all missing
REF_DELTA
bases before attemptingto resolve them.
This both ensures that all bases are attempted to be fetched, and ensures that we make only one request per index-pack invocation, and not one request per missing object.
jhowtan
)(2019 年 8 月 20 日)。
gitster
-- 在
commit d8b1ce7 中 merge ,2019 年 9 月 9 日)
diff
: skipGITLINK
when lazy fetching missing objs
In 7fbbcb2 ("
diff
: batch fetching of missing blobs", 2019-04-08, Git v2.22.0-rc0),diff
was taught to batch the fetching of missing objects when operating on a partial clone, but was not taught to refrain from fetchingGITLINKs.
Teach diff to check if an object is aGITLINK
before including it in the set to be fetched.
chriscool
),
Junio C Hamano -- gitster
--, _jit_a, _jit_a, _jit_a, _jit_a,
commit b9ac6c5, _jit_a,
partial-clone
documentation , _20
A remote that can later provide the missing objects is called apromisor remote, as it promises to send the objects whenrequested.
Initialy Git supported only one promisor remote, the originremote from which the user cloned and that was configured in the"
extensions.partialClone
" config option.
Later support for more than one promisor remote has been implemented.Many promisor remotes can be configured and used.
This allows for example a user to have multiple geographically-closecache servers for fetching missing blobs while continuing to dofiltered
git-fetch
commands from the central server.Remotes that are considered "
promisor
" remotes are those specified bythe following configuration variables:
extensions.partialClone = <name>
remote.<name>.promisor = true
remote.<name>.partialCloneFilter = ...
Only one promisor remote can be configured using the
extensions.partialClone
config variable. This promisor remote will be the last one tried when fetching objects.
matvore
) 、
Junio C Hamano -- gitster
-- 、
commit 627b826 (2019 年 6 月 27 日)作者
commit 95acf11。
- combining filters such that only objects accepted by all filters are shown.
The motivation for this is to allow getting directory listings without also fetching blobs. This can be done by combiningblob:none
withtree:<depth>
.
There are massive repositories that have larger-than-expected trees - even if you include only a single commit.A combined filter supports any number of subfilters, and is written inthe following form:
combine:<filter 1>+<filter 2>+<filter 3>
- combining of multiple filters by simply repeating the
--filter
flag.
Before, the user had to combine them in a single flag somewhat awkwardly (e.g.--filter=combine:FOO+BAR
), including URL-encoding the individual filters.
git diff
”学会了在更多不需要 blob 对象的情况下避免延迟加载它们。
jhowtan
) 、
Junio C Hamano -- gitster
-- 、
commit 8f5dc5a(2020 年 4 月 7 日)和
commit 23547c4(2020 年 4 月 2 日)。
jhowtan
) merge ,2020 年 4 月 28 日)
diff
: restrict when prefetching occursHelped-by: Jeff King
Signed-off-by: Jonathan Tan
Commit 7fbbcb21b1 ("
diff
: batch fetching of missing blobs", 2019-04-08, Git v2.22.0-rc0 -- merge listed in batch #7) optimized "diff
" by prefetching blobs in a partial clone, but there are some cases wherein blobs do not need to be prefetched.
In these cases, any command that uses the diff machinery will unnecessarily fetch blobs.
diffcore_std()
may read blobs when it calls the following functions:
diffcore_skip_stat_unmatch()
(controlled by the config variable diff.autorefreshindex)diffcore_break()
anddiffcore_merge_broken()
(for break-rewrite detection)diffcore_rename()
(for rename detection)diffcore_pickaxe()
(for detecting addition/deletion of specified string)Instead of always prefetching blobs, teach
diffcore_skip_stat_unmatch()
,diffcore_break()
, anddiffcore_rename()
to prefetch blobs upon the first read of a missing object.
This covers (1), (2), and (3): to cover the rest, teachdiffcore_std()
to prefetch if the output type is one that includes blob data (and hence blob data will be required later anyway), or if it knows that (4) will be run.
gitster
-- 的
commit e68f0a4(2020 年 9 月 28 日)和 ojit_a(2020 年 9 月 21 日)。
fetch
: do not override partial clone filterSigned-off-by: Jonathan Tan
When a fetch with the
--filter
argument is made, the configured default filter is set even if one already exists. This change was made in 5e46139376 ("builtin/fetch
: remove unique promisor remote limitation", 2019-06-25, Git v2.24.0-rc0 -- merge listed in batch #3) - in particular, changing from:
- If this is the FIRST partial-fetch request, we enable partial
- on this repo and remember the given filter-spec as the default
- for subsequent fetches to this remote.
to:
- If this is a partial-fetch request, we enable partial on
- this repo if not already enabled and remember the given
- filter-spec as the default for subsequent fetches to this
- remote.
(The given filter-spec is "remembered" even if there is already an existing one.)
This is problematic whenever a lazy fetch is made, because lazy fetches are made using "
git fetch --filter=blob:none
(man), but this will also happen if the user invokes "git fetch --filter=<filter>
(man)" manually. Therefore, restore the behavior prior to 5e46139376, which writes a filter-spec only if the current fetch request is the first partial-fetch one (for that remote).
关于git - 是否有任何支持部分 checkout /克隆的分布式修订控制系统?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3098029/
我有 jquery Draggable/droppable 来处理包含和帮助器选项集。我想做的是将放置的项目的顶部和左侧参数存储在两个变量中。 我在下面的示例中实现了这一点(将新文档图标拖到框中),但
我有一个带有两个链接下拉列表的表单,我需要制作许多克隆,但保留链接。 这是一个示例,链接组合在我的应用程序中带有 json。 链式代码:
我在使用少量 jQuery 时遇到了一些逻辑问题。 我很确定我需要一个循环设置,但我很难将其组合在一起。我引用了 tuts、视频、工作示例、幻灯片,甚至是原始 javascript,但仍然难以将逻辑端
我有一个对象,它是一个基本的树。我需要对其进行深度复制,并发现自己实现了 __clone 方法。成功的代码是: function __clone() { $object = new Custo
我可以克隆一个没有内容的文本框吗?意味着如果我在克隆后在文本框中输入一些值,我想要一个空文本框。这可能吗?或者jquery克隆将其返回为innerHtml? 最佳答案 默认情况下,克隆会复制 的值目
我想复制或克隆我自己编写的类的对象。但如果我调用复制函数,则仅复制指针。因此,如果我更改复制的对象,原始对象也会更改。 有没有一种方法/功能可以真正克隆一个对象? 最诚挚的问候梅兰妮 最佳答案 如果一
我有一些 javascripc 代码: $(this).parent().siblings().find('.year-dropdown').find('.date, .time, .details'
我们有一个包含三个命名分支的存储库,我想克隆其中一个分支。有一个善变的命令可以做到这一点吗?如果我使用 hg clone 提供(分支)路径,则会收到 404 错误。 最佳答案 hg clone htt
我有带有 ObservableCollection 和其他属性的类。所以它看起来有点像这样: public class A { public int Id { get; set; } ..
我正在尝试下载一个大型开源项目的源代码,以便我可以查看它。 它说要做: hg clone http://server/path 但是,这需要很长时间(我假设是因为这是一个大项目)。我并不真正关心变更集
我发现这段代码随处可见,用于复制列表或克隆列表。 代码随处可见: clone([],[]). clone([H|T],[H|Z]):- clone(T,Z). ?-clone([1,2,3],Z).
我正在打印一个JFrame。在此之前,我隐藏菜单栏并将 JFrame 设置为未修饰。这工作得很好,但可见的 JFrame 发生了变化,以反射(reflect)我稍后必须恢复的已删除的控件。 我想克隆
我正在尝试复制一个 div 并将其附加到它的克隆之上。不幸的是,它似乎正在创建额外的重复项。这是怎么回事? 这是一个示例:http://jsfiddle.net/QEN5N/ 最佳答案 live 会将
为什么我不能克隆 ConcurrentHashMap ? ConcurrentHashMap test = new ConcurrentHashMap(); test.put("hello",
我有这个代码: openPopup.hide(); var substr = popupId.split('-'); var clone = $("#po
这段代码几乎可以正常工作假设我的表中有 10 行,我单击顶行,它会被克隆,然后添加到表的底部,而原始数据被删除,重复这些步骤 5 次。现在,我以克隆在底部的五行结束。 现在,如果我单击第一个克隆行,它
我已经设置了JSFiddle来展示我的问题。 我改变了克隆方式,使其更加通用,因此我不需要为不同的表重用代码。通常,对于 select2 元素,我会这样做 $(".campaignType", $tr
1 2 3 $('#things').after($('#things').clone()); 克隆时如何在这两个元素之间插入中断?有没有一种巧妙的方法可以用一行代码来完成
我正在从现有类型动态装配中创建新类型,但只包含选定的属性: public class EmitTest { public Type Create(Type prototype, Type dy
在我的游戏引擎中实现对象克隆的过程中,我遇到了一些绊脚石。我的目标是拥有一个克隆系统,我不必逐个类地维护它,除非该类需要特殊处理。 我的游戏引擎的设置围绕着一个基类 Object2D,它包含一些 Te
我是一名优秀的程序员,十分优秀!