[英]`git -S` doesn't find all commits
考慮以下打字稿:
$ git clone git@github.com:laravel/framework.git
$ cd framework
$ git log --all --oneline --graph --decorate
...
| * | | | | | 07bb4d7 fix
| * | | | | | 0c2b7da Use the current timestamp as a default.
| * | | | | | 26cd65e (tag: v5.2.7) increment version
$ git show 0c2b7da
commit 0c2b7da2635f7bbbaf63d1b93fa817232bdd9d65
Author: Taylor Otwell <taylorotwell@gmail.com>
Date: Thu Jan 7 08:01:39 2016 -0600
Use the current timestamp as a default.
diff --git a/src/Illuminate/Database/Schema/Blueprint.php b/src/Illuminate/Database/Schema/Blueprint.php
index fca8e89..7e179aa 100755
--- a/src/Illuminate/Database/Schema/Blueprint.php
+++ b/src/Illuminate/Database/Schema/Blueprint.php
@@ -791,9 +791,9 @@ class Blueprint
*/
public function timestamps()
{
- $this->timestamp('created_at');
+ $this->timestamp('created_at')->useCurrent();
- $this->timestamp('updated_at');
+ $this->timestamp('updated_at')->useCurrent();
}
/**
$ git log -p -m --full-history 07bb4d7 -Stimestamp src/Illuminate/Database/Schema/Blueprint.php
您不會在最后一條命令的輸出中看到此提交。 但是,如果您這樣做:
$ git log -p origin/master -Stimestamp src/Illuminate/Database/Schema/Blueprint.php
您會看到以下內容:
commit 720a116897a4cc6780fa22f34d30c5986eafc581
Author: Taylor Otwell <taylorotwell@gmail.com>
Date: Wed Feb 3 08:13:22 2016 -0600
make timestamps nullable by default
diff --git a/src/Illuminate/Database/Schema/Blueprint.php b/src/Illuminate/Database/Schema/Blueprint.php
index fca8e89..6cfab6f 100755
--- a/src/Illuminate/Database/Schema/Blueprint.php
+++ b/src/Illuminate/Database/Schema/Blueprint.php
@@ -779,9 +779,7 @@ class Blueprint
*/
public function nullableTimestamps()
{
- $this->timestamp('created_at')->nullable();
-
- $this->timestamp('updated_at')->nullable();
+ return $this->timestamps();
}
/**
@@ -791,9 +789,9 @@ class Blueprint
*/
public function timestamps()
{
- $this->timestamp('created_at');
+ $this->timestamp('created_at')->nullable();
- $this->timestamp('updated_at');
+ $this->timestamp('updated_at')->nullable();
}
/**
@@ -803,9 +801,9 @@ class Blueprint
*/
public function timestampsTz()
{
- $this->timestampTz('created_at');
+ $this->timestampTz('created_at')->nullable();
- $this->timestampTz('updated_at');
+ $this->timestampTz('updated_at')->nullable();
}
/**
我究竟做錯了什么? 如何找到更改方法timestamps
提交?
從git log
的文檔中 (但增加了我的重點):
-S<string>
尋找差異來改變文件中指定字符串出現的次數 (即添加/刪除)。 供腳本編寫者使用。
在兩個版本中(更改之前和之后),未顯示的提交在單詞timestamp
中出現的次數相同。 這個詞的實際用法是不同的,但是出現的次數是相同的。
第一DIFF-大塊替換字的兩個副本:所顯示改變出現的次數提交timestamp
只用一個字的副本timestamp
(2個字面timestamp
字被替換為一個timestamp
-內最字處理timestamps
) 。
相反,幾乎可以肯定,您需要-G
標志,該標志在-S
標志的正下方。 請注意, -G
接受一個正則表達式,而不是一個簡單的字符串,盡管單詞timestamp
中沒有正則表達式字符,因此在這種情況下沒有區別。 (但您可能想使用--perl-regexp
來獲取完整的Perl樣式正則表達式,以便可以搜索\\btimestamp\\b
,意思是“單詞時間戳,但被非單詞字符包圍”,即不要匹配timestamps
或thetimestamp
或twotimestamps
,所有這些都包含 timestamp
。)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.