gitext-rs / git-stack

Stacked branch management for Git
Apache License 2.0
491 stars 19 forks source link

`git stack amend` breaks signatures of child commits #278

Closed aohoyd closed 1 year ago

aohoyd commented 1 year ago

Please complete the following tasks

Description

Hi! It looks like git stack amend breaks signature of child commits

Version

git-stack 0.10.6

Steps to reproduce

git checkout -b feature1
echo 1 > 1.txt
git add .
git commit -m "#1"
echo 2 > 2.txt
git add .
git commit -m "#2"
echo 3 > 3.txt
git add .
git commit -m "#3"
git stack

git log --graph --all --pretty="format:%C(auto)%h %C(auto)(%G?) %C(auto)%d %C(auto)%s" -3
# Output:
# * dadd798 (G)  (HEAD -> feature1) #3
# * 333f017 (G)  #2
# * d34c712 (G)  #1
# Note: (G) means that the commit is GPG signed. All commits are ok.

# Switch two commits up
git prev
git prev

# Make a change to #1 commit
echo 1 >> 1.txt
git add .
git amend

git log --graph --all --pretty="format:%C(auto)%h %C(auto)(%G?) %C(auto)%d %C(auto)%s" -3
# Output:
# * d97fde4 (N)  (feature1) #3
# * 251d64a (N)  #2
# * 4604f95 (G)  (HEAD) #1
# Note: (N) means that the commit is not GPG signed. Last two commits are not ok.

Actual Behaviour

In the last git log command you can see that commits #2 and #3 are not GPG signed

Expected Behaviour

All commits should stay signed

Debug Output

No response

epage commented 1 year ago

Wait, so the amended commit was signed? #260 worked? That was all untested code as I don't do signing.

So the problem is with the implementation. We are building on top of git2.

The rebase operation allows us to access the index of each step. We could possibly manually create a commit around that so it could be signed.

aohoyd commented 1 year ago

Wow, that was fast:) thank you!