2017-02-04 2 views
1

システムの履歴に関するサブディレクトリの変更を探したいと思います。その目的のために、私はサブディレクトリの変更を追跡するときに "git show"と "git log - "の間に不一致がある

git log -- $subdirectory 

thisに従えば十分です。 が表示されないコミットがいくつかあります。 "git log - $ subdirectory"の結果でです。しかし、

git show $sha 

に従って、それらはサブディレクトリを変更します。私はthisを見たとき

は例えば、apache-accumuloに私はそれが"コア/ srcに/メイン" に変更していることがわかり、

git show 31ee26b8ac41844f2a647a5d1484f47da731872a 

使用してコミットします。より具体的には、私は以下の応答を得る。

commit 31ee26b8ac41844f2a647a5d1484f47da731872a 
Author: Eric C. Newton <[email protected]> 
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 

はコミットを示していません。

その回答は見つかりませんでした。私はどんな洞察にも感謝します!ありがとう!

+0

最初の質問では、私は、 "サブモジュール" を述べました。混乱のために申し訳ありません –

答えて

2

まず、apache/accumuloには.gitmodulesファイルが存在しないので、我々は、すべてについてgit submodulesに話をされていません。
代わりに、サブフォルダまたはサブディレクトリのログを考慮する必要があります。サブモジュールではありません。

第二は:

C:\Users\vonc\prog\git\accumulo>git show --name-only 31ee26b8a 
commit 31ee26b8ac41844f2a647a5d1484f47da731872a 
Author: Eric C. Newton <[email protected]> 
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 

これは、他の言葉ではsrc/main/java/org/apache/accumulo/server/replication

に今あるStatusUtil.java、を意味し、そのファイルがはそのコミット以来を移動された、とgit logはリストだけはしてファイルの名前を変更しますデフォルト

git log--followを追加します。

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 

を参照してください "Why might git log not show history for a moved file, and what can I do about it?"

+0

あなたの有益な説明をありがとう! git-logドキュメントを考慮すると、--followは単一のファイルに対してのみ機能します。 gitをディレクトリ内のすべてのファイルに使用する方法はありますか? –

+0

@PooyanBehnamghader Gitはフォルダーを追跡しません。フォルダーの 'log --follow'は、以前に移動/名前変更されたファイルであっても、フォルダー内のファイルの変更を伴うコミットを含みます。そういう意味で、フォルダを使うのは、 "Gitを使ってディレクトリ内のすべてのファイルを追跡する"方法です。 – VonC

+0

情報のために@VonCに感謝します。私は[リンク](http://stackoverflow.com/questions/38870925/is-there-a-trick-to-git-log-follow-a-directory-which-has-been-renamed)で次の情報を見つけました。 "--followオプションは1つのファイルにしか追従できないので、何らかの方法でそれをディレクトリに適用することができれば、まずGitはそのディレクトリを一連のファイルに変換し、そのファイルの1つを選んでそれに従います1。" –

関連する問題