跟踪子目录中的更改时 "git show" 和 "git log --" 之间的不一致
Inconsistency between "git show" and "git log --" when tracking changes in a subdirectory
我想在一个系统的历史上找到一个子目录的变化。为此,我使用
git log -- $subdirectory
根据 this,这就足够了。有一些提交 没有出现 在 "git log -- $subdirectory" 的结果中;然而根据
git show $sha
,他们更改了子目录。
例如,在 apache-accumulo when I look at this 中使用
提交
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, so we are not talking about git submodules中根本没有.gitmodules
文件。
相反,您可能会考虑为子文件夹或子目录记录日志。不是子模块。
第二个:
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
参见“Why might git log
not show history for a moved file, and what can I do about it?”
我想在一个系统的历史上找到一个子目录的变化。为此,我使用
git log -- $subdirectory
根据 this,这就足够了。有一些提交 没有出现 在 "git log -- $subdirectory" 的结果中;然而根据
git show $sha
,他们更改了子目录。
例如,在 apache-accumulo when I look at this 中使用
提交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, so we are not talking about git submodules中根本没有.gitmodules
文件。
相反,您可能会考虑为子文件夹或子目录记录日志。不是子模块。
第二个:
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
参见“Why might git log
not show history for a moved file, and what can I do about it?”