{"thread":{"id":"55107","subject":"[PATCH] subtree : fix split output containing unrelated history","startedAt":"2021-02-04T18:28:23Z","lastAt":"2021-02-04T18:28:23Z","messageCount":1,"participants":["Taylor Jones via GitGitGadget"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"416160","messageId":"pull.867.git.1612463137244.gitgitgadget@gmail.com","threadId":"55107","inReplyTo":null,"subject":"[PATCH] subtree : fix split output containing unrelated history","fromName":"Taylor Jones via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-02-04T18:25:36Z","receivedAt":"2021-02-04T18:28:23Z","isPatch":true,"sender":{"key":"name:Taylor Jones","avatar":null},"body":"From: tjones629 <tjones629@gmail.com>\n\nWhen a subtree is deleted and re-added at the same location with the\n--squash arguement the history created by \"git subtree split\" will\ncontain commits that do not affect the files in the given prefix\nresulting in an incorrect history for the subtree.\n\nThis commit fixes the issue by removing lines that create cache files for\ncommits that did not contain the given prefix after new parent commits have\nbeen created. The history created by \"git subtree split\" with this change\nno longer contains unrelated commits or commits that occured before the\nsubtree was removed and re-added.\n\nSigned-off-by: Taylor Jones <tjones629@gmail.com>\n---\n    Bugfix for subtree split function\n    \n    This patch fixes a bug in the subtree split command. The bug can be\n    reproduced by adding a squashed subtree to a repository then removing it\n    and squash adding it again with the same prefix. This will result in the\n    subtree split history containing every commit from the main repository\n    instead of just the commits that affect the subtree.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-867%2Ftjones629%2Fbugfix-subtree_removal-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-867/tjones629/bugfix-subtree_removal-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/867\n\n contrib/subtree/git-subtree.sh | 4 ----\n 1 file changed, 4 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 868e18b9a1ab..f1b8a3b2e74c 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -667,10 +667,6 @@ process_split_commit () {\n \tif test -z \"$tree\"\n \tthen\n \t\tset_notree \"$rev\"\n-\t\tif test -n \"$newparents\"\n-\t\tthen\n-\t\t\tcache_set \"$rev\" \"$rev\"\n-\t\tfi\n \t\treturn\n \tfi\n \n\nbase-commit: 71ca53e8125e36efbda17293c50027d31681a41f\n-- \ngitgitgadget\n"}]}