- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的存储库中,git diff
和 git stash
都运行得很快,不到一秒。然而 git stash -p 花了整整 20 秒才显示第一个 block 。为什么会这样?
最佳答案
Git 2.25.2(2020 年 3 月)应该会改进这一点,它会简化代码。
请参阅discussion .
参见commit 26f924d (2020 年 1 月 7 日)作者:Elijah Newren (newren
) .
(由 Junio C Hamano -- gitster
-- 于 commit a3648c0 merge ,2020 年 1 月 22 日)
unpack-trees
: exitcheck_updates()
early if updates are not wantedSigned-off-by: Elijah Newren
check_updates()
has a lot of code that repeatedly checks whethero->update
oro->dry_run
are set.(Note that
o->dry_run
is a near-synonym for!o->update,
but not quite as per commit 2c9078d05bf2 ("unpack-trees
: add thedry_run
flag tounpack_trees_options
", 2011-05-25, Git v1.7.6-rc0).)
In fact, this function almost turns into a no-op whenever the condition!o->update || o->dry_run
is met.
Simplify the code by checking this condition at the beginning of the function, and when it is true, do the few things that are relevant and return early.
There are a few things that make the conversion not quite obvious:
- The fact that check_updates() does not actually turn into a no-op when updates are not wanted may be slightly surprising.
However, commit 33ecf7eb61 (Discard "deleted
" cache entries after using them to update the working tree, 2008-02-07, Git v1.5.5-rc0) put the discarding of unused cache entries incheck_updates()
so we still need to keep the call toremove_marked_cache_entries()
.
It's possible this call belongs in another function, but it is certainly needed as tests will fail if it is removed.- The original called
remove_scheduled_dirs()
unconditionally.
Technically, commit 7847892716 (unlink_entry()
: introduceschedule_dir_for_removal()
, 2009-02-09, Git v1.6.3-rc0) should have made that call conditional, but it didn't matter in practice becauseremove_scheduled_dirs()
becomes a no-op when all the calls to unlink_entry() are skipped.
As such, we do not need to call it.- When
(o->dry_run && o->update)
, the original would have two calls togit_attr_set_direction()
surrounding a bunch of skipped updates.
These two calls togit_attr_set_direction()
cancel each other out and thus can be omitted wheno->dry_run
is true just as they already are when!o->update
.- The code would previously call
setup_collided_checkout_detection()
andreport_collided_checkout()
even wheno->dry_run
.
However, this was just an expensive no-op becausesetup_collided_checkout_detection()
merely cleared theCE_MATCHED
flag for each cache entry, andreport_collided_checkout()
reported which ones had it set.
Since a dry-run would skip all thecheckout_entry()
calls,CE_MATCHED
would never get set and thus no collisions would be reported.
Since we can't detect the collisions anyway without doing updates, skipping the collisions detection setup and reporting is an optimization.- The code previously would call
get_progress()
anddisplay_progress()
even when(!o->update || o->dry_run)
.
This served to show how long it took to skip all the updates, which is somewhat useless.
Since we are skipping the updates, we can skip showing how long it takes to skip them.
关于git - 为什么 git stash -p 需要很长时间才能启动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49149297/
这个问题在这里已经有了答案: Isn't an Int64 equal to a long in C#? (2 个答案) 关闭 9 年前。 它不应该是一个整数类型吗? 这样,一些使用 int 的函数
当我遇到一些我想知道的事情时,我正忙着解析一个二进制文件。 Stream.Position属性的类型为Int64或long。为什么是这样?因为流中的位置不能为负,所以使用 UInt64 不是更有意义吗
所以第一部分是我从用户那里获得输入,在本例中,输入是“1”作为从另一个函数接收的字符值。 printf ("\nPlease enter 1, 2, 3 or q: "); option =
我正在尝试使用以下代码从 REST 服务返回 JSON: $categories = $categoriesController->listAll(); if($categories){ hea
我阅读了文档,它说 long 是 %li,但打印输出返回为 -2147024891。是什么赋予了? 最佳答案 您甚至没有提供要打印的号码,但我猜您已经无意中发现了签名打印和未签名打印之间的区别。 使用
我正在创建自定义购物车,我正在构建一个查询,该查询从检索我刚刚保存到购物车表中的 session_id 开始。我知道这个值被保存了,我在 mysql 命令行运行这个查询,它返回我需要的但我没有将值放入
我有一个包含 textView 的 scrollView。如果文本很长并且不适合屏幕,我想增加 textView 高度(我想我可以通过添加 NSLayoutConstraint outlet 并修改它
我有一个基本的数据库处理程序类,其中有一个使用 PDO::FETCH_ASSOC 参数返回结果集的公共(public)方法: public function resultSet() { $th
在后台线程中,我调用 PublishSubject.onNext(); 并在主线程中通过 subscribe(PublishSubject.filter(message -> message.getI
我想知道为什么 Amazon Web Services 控制台登录页面有这么长的 url?为什么不只发布数据而不显示其中包含大量数据的冗长 url。以这种方式实现有什么充分的理由吗? 最佳答案 我认为
这个问题在这里已经有了答案: Can I mix MySQL APIs in PHP? (4 个答案) 关闭 6 年前。 希望我犯了一个快速而明显的错误,我浏览了 previous question
我得到了答案:如果我禁用了cookie,那么使用URL重定向我可以传递JSESSIONID,但我的URL已经很长,因为我使用它有约束的GET方法。那怎么办我应该使用我的 session 吗?我希望我的
目前,当我使用 DOMDocument 对象并调用 saveHTML() 时,它会自动添加一些我不需要的 html 标签。我尝试了此处建议的解决方案 ( https://stackoverflow.c
我是一名优秀的程序员,十分优秀!