Note: It was a mistake from my side. I cherry-picked the parent hash. Please see the update
section.
Original Question:
I have a file vmu_hw_test
in a branch "test_imu" which has a change similar to seen below
if( g_imu_spi.readFromFifo() == 0)
{
//Find local maxima and minima event
g_imu_spi.compute_event();
//compute the euler
g_imu_spi.compute_euler();
//From the average values compute the max
//g_imu_spi.compute_Max();
g_imu_spi.compute_Max(buffer);
}
The if
statement and the removal of comment were introduced on this commit.
And master
branch had
//Find local maxima and minima event
g_imu_spi.compute_event();
//compute the euler
g_imu_spi.compute_euler();
//From the average values compute the max
g_imu_spi.compute_Max(buffer);
Question
1. As I've read cherry-pick
takes a single commit change and applies it. Is there a problem if the branches are different (in commit history)
2. A Microsoft document says not to cherry pick. Is it a bad practice to cherry pick?
3. Why would have cherry pick failed? (Update: It did not.)
Git Diff
For the latest commit on test_imu.c
diff --git a/Src/vmu_hw_test.c b/Src/vmu_hw_test.c
index 14b0a67..1954d64 100644
--- a/Src/vmu_hw_test.c
+++ b/Src/vmu_hw_test.c
@@ -2694,14 +2694,16 @@ unsigned short IMU_sendData(void)
}
}
//Regular run
- g_imu_spi.readFromFifo();
- //Find local maxima and minima event
- g_imu_spi.compute_event();
- //compute the euler
- g_imu_spi.compute_euler();
- //From the average values compute the max
-// g_imu_spi.compute_Max();
- g_imu_spi.compute_Max(buffer);
+ if( g_imu_spi.readFromFifo() == 0)
+ {
+ //Find local maxima and minima event
+ g_imu_spi.compute_event();
+ //compute the euler
+ g_imu_spi.compute_euler();
+ //From the average values compute the max
+ g_imu_spi.compute_Max(buffer);
+ }
+
Update
Git cherry-pick did not fail. I tried looking into the diffs as suggested by torek
and found that the diffs do state that a cherry pick should have included the if
statement.
Here's the git diff --find-renames <hash-of-B> <hash-of-C>
(please refer to torek's answer)
unsigned short IMU_sendData(void)
{
@@ -2703,7 +2731,6 @@ unsigned short IMU_sendData(void)
//compute the euler
g_imu_spi.compute_euler();
//From the average values compute the max
-// g_imu_spi.compute_Max();
g_imu_spi.compute_Max(buffer);
//Low pass filter for each axis
@@ -2741,28 +2768,8 @@ unsigned short IMU_sendData(void)
}
}
And the git diff --find-renames <hash-of-B> <hash-of-A>
is already provided in the Git Diff
section. From this we can see that the if
statement should be cherry picked.
What went wrong was that I cherry picked the wrong hash (I picked the parent hash).