From: brian m. carlson <hidden> Date: 2018-05-29 16:32:59
When writing the todo script for --rebase-merges, we try to find a label
for certain commits. If the label ends up being a valid object ID, such
as when we merge a detached commit, we want to rewrite it so it is no
longer a valid object ID.
However, the code path that does this checks for its length to be
equivalent to GIT_SHA1_RAWSZ, which isn't correct, since what we are
reading is a hex object ID. Instead, check for the length being
equivalent to that of a hex object ID. Use the_hash_algo so this code
works regardless of the hash size.
Signed-off-by: brian m. carlson <redacted>
---
I noticed this while cleaning up a few instances of GIT_SHA1_* constants
and thought I'd send a patch.
sequencer.c | 2 +-
t/t3430-rebase-merges.sh | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
@@ -70,6 +70,7 @@ test_expect_success 'create completely different structure' 'merge-CHsecondmergeonebranch# Merge the topic branch '\''onebranch'\''EOF+cpscript-from-scratchscript-from-scratch-orig&&test_configsequence.editor\""$PWD"/replace-editor.sh\"&&test_tick&&gitrebase-i-rA&&
@@ -241,4 +242,20 @@ test_expect_success 'refuse to merge ancestors of HEAD' 'test_cmp_revHEAD$before'+test_expect_success'labels that are object IDs are rewritten''+gitcheckout-bthirdB&&+test_tick&&+test_commitI&&+third=$(gitrev-parseHEAD)&&+gitcheckout-blabelsmaster&&+gitmerge--no-committhird&&+test_tick&&+gitcommit-m"Merge commit '\''$third'\'' into labels"&&+cpscript-from-scratch-origscript-from-scratch&&+test_configsequence.editor\""$PWD"/replace-editor.sh\"&&+test_tick&&+gitrebase-i-rA&&+!grep"^label $third$".git/ORIGINAL-TODO+'+ test_done
From: Johannes Schindelin <hidden> Date: 2018-05-30 09:54:46
Hi Brian,
On Tue, 29 May 2018, brian m. carlson wrote:
When writing the todo script for --rebase-merges, we try to find a label
for certain commits. If the label ends up being a valid object ID, such
as when we merge a detached commit, we want to rewrite it so it is no
longer a valid object ID.
However, the code path that does this checks for its length to be
equivalent to GIT_SHA1_RAWSZ, which isn't correct, since what we are
reading is a hex object ID. Instead, check for the length being
equivalent to that of a hex object ID. Use the_hash_algo so this code
works regardless of the hash size.
D'oh. Thank you so much for this fix.
I noticed this while cleaning up a few instances of GIT_SHA1_* constants
and thought I'd send a patch.
@@ -70,6 +70,7 @@ test_expect_success 'create completely different structure' 'merge-CHsecondmergeonebranch# Merge the topic branch '\''onebranch'\''EOF+cpscript-from-scratchscript-from-scratch-orig&&test_configsequence.editor\""$PWD"/replace-editor.sh\"&&test_tick&&gitrebase-i-rA&&
@@ -241,4 +242,20 @@ test_expect_success 'refuse to merge ancestors of HEAD' 'test_cmp_revHEAD$before'+test_expect_success'labels that are object IDs are rewritten''
Thanks for writing a test, I had been meaning to, but it slipped from my
mind.
+ git checkout -b third B &&
+ test_tick &&
+ test_commit I &&
Here, the test_tick is required because we commit via `git commit`.
BTW another thing that I had been meaning to address but totally forgot is
this '\'' ugliness. I had been meaning to define SQ="'" before all test
cases and then use $SQ everywhere. Not your problem, though.
There is nothing in that script that you need. Why not simply
echo noop >script-from-scratch
or if you care about the branch,
echo reset $third >script-from-scratch
Here, the test_tick is required because we commit via `git commit`.
BTW another thing that I had been meaning to address but totally forgot is
this '\'' ugliness. I had been meaning to define SQ="'" before all test
cases and then use $SQ everywhere. Not your problem, though.
There is nothing in that script that you need. Why not simply
echo noop >script-from-scratch
or if you care about the branch,
echo reset $third >script-from-scratch
That would be simpler. You read my mind: I needed some script to make
the sequence editor work, but anything would be fine.
Here, the test_tick is required because we commit via `git commit`.
BTW another thing that I had been meaning to address but totally forgot is
this '\'' ugliness. I had been meaning to define SQ="'" before all test
cases and then use $SQ everywhere. Not your problem, though.
There is nothing in that script that you need. Why not simply
echo noop >script-from-scratch
or if you care about the branch,
echo reset $third >script-from-scratch
That would be simpler. You read my mind: I needed some script to make
the sequence editor work, but anything would be fine.
I would not go that far. Sometimes I wish I could read minds. More often,
I am glad that I cannot. I simply guessed correctly in this case ;-)
But yes, I think it would not only be simpler, but would also avoid the
head-scratching why the earlier `cp script-from-scratch
script-from-scratch-orig`, and it would also make it more robust to future
changes (e.g. if somebody decides to move test cases around, or introduce
prereqs that skip some).
Ciao,
Dscho
From: brian m. carlson <hidden> Date: 2018-06-01 17:46:57
When writing the todo script for --rebase-merges, we try to find a label
for certain commits. If the label ends up being a valid object ID, such
as when we merge a detached commit, we want to rewrite it so it is no
longer a valid object ID.
However, the code path that does this checks for its length to be
equivalent to GIT_SHA1_RAWSZ, which isn't correct, since what we are
reading is a hex object ID. Instead, check for the length being
equivalent to that of a hex object ID. Use the_hash_algo so this code
works regardless of the hash size.
Signed-off-by: brian m. carlson <redacted>
---
sequencer.c | 2 +-
t/t3430-rebase-merges.sh | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
@@ -241,4 +241,20 @@ test_expect_success 'refuse to merge ancestors of HEAD' 'test_cmp_revHEAD$before'+test_expect_success'labels that are object IDs are rewritten''+gitcheckout-bthirdB&&+test_commitI&&+third=$(gitrev-parseHEAD)&&+gitcheckout-blabelsmaster&&+gitmerge--no-committhird&&+test_tick&&+gitcommit-m"Merge commit '\''$third'\'' into labels"&&+echonoop>script-from-scratch&&+test_configsequence.editor\""$PWD"/replace-editor.sh\"&&+test_tick&&+gitrebase-i-rA&&+grep"^label $third-".git/ORIGINAL-TODO&&+!grep"^label $third$".git/ORIGINAL-TODO+'+ test_done
From: Johannes Schindelin <hidden> Date: 2018-06-01 19:02:18
Hi Brian,
On Fri, 1 Jun 2018, brian m. carlson wrote:
When writing the todo script for --rebase-merges, we try to find a label
for certain commits. If the label ends up being a valid object ID, such
as when we merge a detached commit, we want to rewrite it so it is no
longer a valid object ID.
However, the code path that does this checks for its length to be
equivalent to GIT_SHA1_RAWSZ, which isn't correct, since what we are
reading is a hex object ID. Instead, check for the length being
equivalent to that of a hex object ID. Use the_hash_algo so this code
works regardless of the hash size.
Signed-off-by: brian m. carlson <redacted>