I have a repo where it looks like there is a cherry-picked commit (C) in an arrangement something like this:
A---B---C topic
/
D---E---F---G---C'---H master
The commit messages of C and C' were identical, and the resulting diffs from git show C
and git show C'
were also identical (contents, timestamp, author, etc.) other than the hash.
Surprisingly git diff C C'
results in a huge diff. Not surprisingly, diff <(git show C) <(git show C')
shows no difference. Under what circumstances can this occur? I was under the impression that git diff C C'
should return empty.
Below I've copied the actual outputs (but removed any potentially sensitive info with XXX
or XXX...
Also note that C in the example above is hash 37a78fd9 below and C' is 5b5aa9b5:
git show C
~/foo$ git show 37a78fd9
commit 37a78fd9XXX...
Author: XXX XXX <XXX+XXX@users.noreply.github.com>
Date: Thu Jun 9 15:05:14 2022 +0900
May have fixed synchronization issue
diff --git a/Trial.java b/Trial.java
index 3e662af7..5dedcf37 100644
--- a/Trial.java
+++ b/Trial.java
@@ -11,6 +11,8 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
@@ -138,15 +140,17 @@ public class Trial implements Runnable, ActionSelector, SocketListener {
Log.d("Episode", "End of episode:" + getEpisodeCount());
// Waits for all image compression to finish prior to finishing flatbuffer
long start = System.nanoTime();
- for (Collection<Future<?>> timestepFutures: timeStepDataBuffer.imgCompFuturesEpisode){
- for (Future<?> future:timestepFutures){
+ synchronized (timeStepDataBuffer.imgCompFuturesTimeStep){
+ for (Collection<Future<?>> timestepFutures: timeStepDataBuffer.imgCompFuturesEpisode){
+ for (Future<?> future:timestepFutures){
+ future.get();
+ }
+ }
+ // Waits for all timestep flatbuffer writes to finish prior to finishing flatbuffer
+ for (Future<?> future:flatbufferAssembler.flatbufferWriteFutures){
future.get();
}
}
- // Waits for all timestep flatbuffer writes to finish prior to finishing flatbuffer
- for (Future<?> future:flatbufferAssembler.flatbufferWriteFutures){
- future.get();
- }
long stop = System.nanoTime();
long timediff = stop - start;
flatbufferAssembler.endEpisode();
git show C'
~/foo$ git show 5b5aa9b5
commit 5b5aa9b5XXX... (threadingIssue)
Author: XXX XXX <XXX+XXX@users.noreply.github.com>
Date: Thu Jun 9 15:05:14 2022 +0900
May have fixed synchronization issue
diff --git a/Trial.java b/Trial.java
index 3e662af7..5dedcf37 100644
--- a/Trial.java
+++ b/Trial.java
@@ -11,6 +11,8 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
@@ -138,15 +140,17 @@ public class Trial implements Runnable, ActionSelector, SocketListener {
Log.d("Episode", "End of episode:" + getEpisodeCount());
// Waits for all image compression to finish prior to finishing flatbuffer
long start = System.nanoTime();
- for (Collection<Future<?>> timestepFutures: timeStepDataBuffer.imgCompFuturesEpisode){
- for (Future<?> future:timestepFutures){
+ synchronized (timeStepDataBuffer.imgCompFuturesTimeStep){
+ for (Collection<Future<?>> timestepFutures: timeStepDataBuffer.imgCompFuturesEpisode){
+ for (Future<?> future:timestepFutures){
+ future.get();
+ }
+ }
+ // Waits for all timestep flatbuffer writes to finish prior to finishing flatbuffer
+ for (Future<?> future:flatbufferAssembler.flatbufferWriteFutures){
future.get();
}
}
- // Waits for all timestep flatbuffer writes to finish prior to finishing flatbuffer
- for (Future<?> future:flatbufferAssembler.flatbufferWriteFutures){
- future.get();
- }
long stop = System.nanoTime();
long timediff = stop - start;
flatbufferAssembler.endEpisode();
diff <(git show C) <(git show C')
~/foo$ diff <(git show 37a78fd9) <(git show 5b5aa9b5)
1c1
< commit 37a78fd9XXX...
---
> commit 5b5aa9b5XXX...
git diff 37a78fd9 5b5aa9b5
diff --git a/MainActivity.java b/MainActivity.java
index a72a91f4..aa83e306 100644
--- a/MainActivity.java
+++ b/MainActivity.java
@@ -49,9 +49,9 @@ public class MainActivity extends AbcvlibActivity implements IOReadyListener {
------------------------------ Set MetaParameters ------------------------------
--------------------------------------------------------------------------------
*/
- TimeStepDataBuffer timeStepDataBuffer = new TimeStepDataBuffer(2);
- MetaParameters metaParameters = new MetaParameters(this, 50, 1,
- 100000, 10000, inetSocketAddress, timeStepDataBuffer, getOutputs(), 1);
+ TimeStepDataBuffer timeStepDataBuffer = new TimeStepDataBuffer(200);
+ MetaParameters metaParameters = new MetaParameters(this, 50, 200,
+ 100000, 1000, inetSocketAddress, timeStepDataBuffer, getOutputs(), 1);
/*------------------------------------------------------------------------------
------------------------------ Define Action Space -----------------------------
diff --git a/MyTrial.java b/MyTrial.java
index b21efc73..148669b3 100644
--- a/MyTrial.java
+++ b/MyTrial.java
@@ -2,13 +2,7 @@ package xxx.serverlearning;
import android.util.Log;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.ExecutionException;
...
Note the above is truncated for brevity, as I believe the rest should be irrelevant to this question.