[go: up one dir, main page]

Follow merge commits when finding commits with follow

Fixes File commit history not showing for subtree files (gitlab#421655 - closed)

When using subtrees the history cannot be found. This happens because when you merge the upstream changes into the downstream repo, the files are renamed.

This can also happen with merge commits that include a renamed file.

After this change the RPC will correctly find the history for these files.

Testing

To view this in GDK create a blank project in the root users personal namespace called merge-rename-test without a readme and then run:

mkdir merge-rename-test
cd merge-rename-test
git init

# Create initial file on main branch
echo "Original content" > oldname.txt
git add oldname.txt
git commit -m "Initial commit with oldname.txt"

# Create a feature branch and rename the file there
git checkout -b feature-branch
git mv oldname.txt newname.txt
git commit -m "Rename oldname.txt to newname.txt"

# Go back to main and make a change to the original file
git checkout main
echo "Additional content" >> oldname.txt
git commit -am "Update oldname.txt on main"

# Now merge - this will include the rename
git merge feature-branch

Push this to GDK and then view the history for newfile.txt

Before the change it would show

image

Checkout fix/subtree-history and run make build && gdk restart gitaly it should now show:

image

Merge request reports

Loading