簡體   English   中英

跟蹤子目錄中的更改時,“ git show”和“ git log-”之間不一致

[英]Inconsistency between “git show” and “git log --” when tracking changes in a subdirectory

我想在系統歷史記錄的子目錄中找到更改。 為此,我使用

git log -- $subdirectory

根據這個 ,這就夠了。 有一些提交未出現在“ git log-$ subdirectory”的結果中; 但是根據

git show $sha

,它們會更改子目錄。

例如,在Apache的accumulo當我在看這個承諾使用

git show 31ee26b8ac41844f2a647a5d1484f47da731872a

,我看到它更改了“ core / src / main” 具體來說,我得到以下回應

commit 31ee26b8ac41844f2a647a5d1484f47da731872a
Author: Eric C. Newton <eric.newton@gmail.com>
Date:   Wed Mar 11 14:37:39 2015 -0400

    ACCUMULO-3423 fixed replication bugs with recent refactorings in StatusUtil

diff --git a/core/src/main/java/org/apache/accumulo/core/replication/StatusUtil.java b/core/src/main/java/org/apache/accumulo/core/replication/StatusUtil.java
index d8ec403..cdb6963 100644
--- a/core/src/main/java/org/apache/accumulo/core/replication/StatusUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/replication/StatusUtil.java
@@ -155,7 +155,7 @@ public class StatusUtil {
   /**
    * @return A {@link Status} for an open file of unspecified length, all of which needs replicating.
    */
-  public static Status openWithUnknownLength(long timeCreated) {
+  public static synchronized Status openWithUnknownLength(long timeCreated) {
     return INF_END_REPLICATION_STATUS_BUILDER.setCreatedTime(timeCreated).build();
   }

diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
index 46101c1..498cbdd 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
@@ -319,7 +319,7 @@ public class TabletServerLogger {
               // Need to release
               KeyExtent extent = commitSession.getExtent();
               if (ReplicationConfigurationUtil.isEnabled(extent, tserver.getTableConfiguration(extent))) {
-                Status status = StatusUtil.fileCreated(System.currentTimeMillis());
+                Status status = StatusUtil.openWithUnknownLength(System.currentTimeMillis());
                 log.debug("Writing " + ProtobufUtil.toString(status) + " to metadata table for " + copy.getFileName());
                 // Got some new WALs, note this in the metadata table
                 ReplicationTableUtil.updateFiles(tserver, commitSession.getExtent(), copy.getFileName(), status);

;

git log -- core/src/main | grep 31ee26b8ac41844f2a647a5d1484f47da731872a

不顯示該提交。

我找不到任何答案! 我將不勝感激! 謝謝!

首先, apache / accumulo中沒有.gitmodules文件,因此我們根本不在談論git子模塊
相反,您可以考慮為子文件夾或子目錄添加日志。 不是子模塊。

第二:

C:\Users\vonc\prog\git\accumulo>git show --name-only 31ee26b8a
commit 31ee26b8ac41844f2a647a5d1484f47da731872a
Author: Eric C. Newton <eric.newton@gmail.com>
Date:   Wed Mar 11 14:37:39 2015 -0400

    ACCUMULO-3423 fixed replication bugs with recent refactorings in StatusUtil

core/src/main/java/org/apache/accumulo/core/replication/StatusUtil.java
server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java

這是指StatusUtil.java ,它現在位於src/main/java/org/apache/accumulo/server/replication

換句話說,該文件自提交以來就被移動了,並且git log只會默認列出重命名的文件

--follow添加到git log

C:\Users\vonc\prog\git\accumulo>git log --graph --all --oneline --decorate  --follow -- core\src\main |grep 31ee26
| * | | | | | | | | | | | | | | | | | 31ee26b8a ACCUMULO-3423 fixed replication bugs with recent refactorings in StatusUtil

要么:

C:\Users\vonc\prog\git\accumulo>git log --follow -- core\src\main|grep 31ee26
commit 31ee26b8ac41844f2a647a5d1484f47da731872a

請參閱“ 為什么git log可能不顯示已移動文件的歷史記錄,我該怎么辦?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM