{"action":"created","issue":{"url":"https://api.github.com/repos/ingydotnet/git-subrepo/issues/142","repository_url":"https://api.github.com/repos/ingydotnet/git-subrepo","labels_url":"https://api.github.com/repos/ingydotnet/git-subrepo/issues/142/labels{/name}","comments_url":"https://api.github.com/repos/ingydotnet/git-subrepo/issues/142/comments","events_url":"https://api.github.com/repos/ingydotnet/git-subrepo/issues/142/events","html_url":"https://github.com/ingydotnet/git-subrepo/issues/142","id":132705686,"number":142,"title":"Redesign questions","user":{"login":"grimmySwe","id":6480514,"avatar_url":"https://avatars.githubusercontent.com/u/6480514?v=3","gravatar_id":"","url":"https://api.github.com/users/grimmySwe","html_url":"https://github.com/grimmySwe","followers_url":"https://api.github.com/users/grimmySwe/followers","following_url":"https://api.github.com/users/grimmySwe/following{/other_user}","gists_url":"https://api.github.com/users/grimmySwe/gists{/gist_id}","starred_url":"https://api.github.com/users/grimmySwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grimmySwe/subscriptions","organizations_url":"https://api.github.com/users/grimmySwe/orgs","repos_url":"https://api.github.com/users/grimmySwe/repos","events_url":"https://api.github.com/users/grimmySwe/events{/privacy}","received_events_url":"https://api.github.com/users/grimmySwe/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ingydotnet/git-subrepo/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"grimmySwe","id":6480514,"avatar_url":"https://avatars.githubusercontent.com/u/6480514?v=3","gravatar_id":"","url":"https://api.github.com/users/grimmySwe","html_url":"https://github.com/grimmySwe","followers_url":"https://api.github.com/users/grimmySwe/followers","following_url":"https://api.github.com/users/grimmySwe/following{/other_user}","gists_url":"https://api.github.com/users/grimmySwe/gists{/gist_id}","starred_url":"https://api.github.com/users/grimmySwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grimmySwe/subscriptions","organizations_url":"https://api.github.com/users/grimmySwe/orgs","repos_url":"https://api.github.com/users/grimmySwe/repos","events_url":"https://api.github.com/users/grimmySwe/events{/privacy}","received_events_url":"https://api.github.com/users/grimmySwe/received_events","type":"User","site_admin":false},"milestone":null,"comments":29,"created_at":"2016-02-10T13:53:44Z","updated_at":"2016-03-08T21:32:34Z","closed_at":null,"body":"@ingydotnet  When I started to write some documentation and tried to explain how git-subrepo works I came to some insights. (I have discussed this a lot with @jrosdahl )\r\n\r\nThe main reason for these thoughts are that the most common use case where you repeatedly pull things and have some minor local change would be increasingly more difficult. Every time you pull you would find the common ancestor further back in history and you would have to solve the same conflicts over and over again. We already discussed in other issues that it would be nice if you could avoid having an extra branch if you want local changes.\r\n\r\n- When performing a pull, it should be possible to use the pull reference in .gitrepo instead of the merge-base command. And instead of rebasing onto the new branch you should be able to simply apply the diff between the current state and the rebase parent. As the commits get squashed anyway.\r\n   - Replace subrepo merge-base with simple use of .gitrepo.commit\r\n   - Replace rebase with merge\r\n   - Simplify subrepo branch\r\n```\r\nD(a) - E(a) - F(a) project   (commit(.gitrepo.commit))\r\na - b - c subrepo\r\n$ git subrepo pull\r\n* fetch\r\na - b - c subrepo/fetch\r\n* branch\r\nd - e - f subrepo/branch\r\n* reparent f on a (see further down for reparenting tool)\r\na - b - c subrepo/fetch\r\n  \\\r\n    f subrepo/branch\r\n* merge, solve conflicts\r\na - b - c - g subrepo/fetch\r\n \\         /\r\n     f            subrepo/branch\r\n* return to project\r\n* write contents from g into subrepodir\r\n* Update .gitrepo file\r\n* commit\r\nD(a) - E(a) - F(a) - G(g) project\r\n```\r\nNote that you if you really want to use rebase instead of merge you can do the reparenting on e instead and rebase the entire branch step by step. It will though add a little complexity as you would need to find out the first commit with the last .gitrepo.commit. I guess that one way would be to iterate from the HEAD and find the first one.\r\n\r\n- For the push case it's a little bit trickier, in our use case it might be better to squash the push commit as well. Then you have the freedom of simply using the same simple logic of comparing the changes from the latest pull point and apply them to subrepo. If you keep the condition that you need to pull before you push it might even be simpler as all you need to do is create a new commit with the content of project/subrepo\r\n   - Squash subrepo upstream \r\n   - Simplify subrepo branch\r\n```\r\nD(a) - E(a) - F(a) project   (commit(.gitrepo.commit))\r\na subrepo\r\n* fetch\r\na subrepo/fetch\r\n* branch\r\nd - e - f subrepo/branch\r\n* checkout subrepo/fetch\r\n* write contents of f \r\n* commit (it will though get a new commit hash)\r\na - f subrepo/fetch\r\n* push\r\na - f subrepo\r\n```\r\n\r\n- If you really want to push all commits into the subrepo there are some strange things occuring. The commit sequence that appears in the subrepo is not linear, as the changes will occur in a rebased order including possible \"pull\" commits that reintroduces the changes already existing in the subrepo.\r\n\r\nI found a tool for reparenting:\r\nhttps://github.com/MarkLodato/git-reparent\r\n\r\nWhen I think about it I guess that you could make the branch command work on only the last commit. That way you have constant speed. Current design will increase the time for each commit.\r\n```\r\n$ git checkout -b subrepo/branch\r\n$ git filter-branch --subdirectory-filter subrepo -- HEAD^..HEAD\r\n```\r\n\r\nI haven't done any coding yet, all of this came up when I tried to describe how git-subrepo works."},"comment":{"url":"https://api.github.com/repos/ingydotnet/git-subrepo/issues/comments/193977626","html_url":"https://github.com/ingydotnet/git-subrepo/issues/142#issuecomment-193977626","issue_url":"https://api.github.com/repos/ingydotnet/git-subrepo/issues/142","id":193977626,"user":{"login":"grimmySwe","id":6480514,"avatar_url":"https://avatars.githubusercontent.com/u/6480514?v=3","gravatar_id":"","url":"https://api.github.com/users/grimmySwe","html_url":"https://github.com/grimmySwe","followers_url":"https://api.github.com/users/grimmySwe/followers","following_url":"https://api.github.com/users/grimmySwe/following{/other_user}","gists_url":"https://api.github.com/users/grimmySwe/gists{/gist_id}","starred_url":"https://api.github.com/users/grimmySwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grimmySwe/subscriptions","organizations_url":"https://api.github.com/users/grimmySwe/orgs","repos_url":"https://api.github.com/users/grimmySwe/repos","events_url":"https://api.github.com/users/grimmySwe/events{/privacy}","received_events_url":"https://api.github.com/users/grimmySwe/received_events","type":"User","site_admin":false},"created_at":"2016-03-08T21:32:34Z","updated_at":"2016-03-08T21:32:34Z","body":"Pushed  6fe27bf where all tests go green but...\r\n\r\nCurrent status:\r\n\r\n- init then push will currently squash everything into one single subrepo commit\r\n- there will be some pull/commit messages in the subrepo if you merge changes\r\n\r\nMy todo list right now:\r\n\r\n1. init - push should work (not squashing)\r\n2. Add a --squash to push so if you want to you can actually squash (both after init and in general)\r\n\r\nThings to think about:\r\n\r\n- Commit messages for the auto generated commits, should it be possible to enter more of them manually to get a better history.\r\n\r\nUnfortunately the me time is out for today... "}}