-
Notifications
You must be signed in to change notification settings - Fork 0
History Reunion
The project was started back in 2016. The initial commit was aa80c202, which was unfortunately performed exactly as that: An initial commit on an empty respository instead of a modifying commit on a forked repository. So we have had no real connection to our ancestor projects, from which our project was forked content wise.
To fix this we performed some changes on the project structure, which will be explained here. All these steps were done on 2021-04-14.
The initial commit on the Alias repository, which was named Spectrecoin at that time, was this one:
commit aa80c2023c2ab37a38722267f399e30bc3e516aa
Author: lulworm <[email protected]>
Date: Sun Oct 30 21:28:58 2016 +0000
Initial Commit
To find the connecting point in time with our ancestor project ShadowCash, we need to find the last commit in time on their repository before the first commit on our repository. As the whole refactoring from Shadow to Spectrecoin might took some time it is possible, that the last Shadow commit in the timeline is not the state which was used as the base for the initial Spectrecoin commit.
So we checked the last commits on the ShadowCash master branch backwards in time before 2016-10-30. In a graphical view it looks like this:
The highlighted commit on top, 27ce3db0 from 2016-10-28 08:24 is the last commit before our initial commit time wise. But this commit already contains changes, which are not on our initial commit by lulworm. A source comparison backwards in time showed, that the commit a623878a from 2016-10-17 12:44 was the first one, which introduced changes, which are not on our initial commit. The conclusion is, that the previous commit 436f3329 from 2016-10-08 10:08 must be the code base lulworm has used for the initial commit.
The reconnect of our history with the ShadowCash history requires some special Git steps. Beside default Git functionality one extension is used: git-filter-repo. This extension is exactly for operations on the Git history. For more details see the linked webpage.
As a result of this reunion all Git hashes of our own history will change! How we handle this organizationally will be explained later.
The following tasks were performed:
git clone --bare https://github.com/aliascash/alias-wallet.git
cd alias-wallet.git
git remote add shadowcash https://github.com/shadowproject/shadow.git
git fetch shadowcash
git replace aa80c2023c2ab37a38722267f399e30bc3e516aa --graft 436f3329497a9badc5dd22ed746a8a42bfbc44ce
git filter-repo \
--refs \
436f3329497a9badc5dd22ed746a8a42bfbc44ce..HEAD \
$(for i in $(git branch | sed 's/[*]//g') ; do echo 436f3329497a9badc5dd22ed746a8a42bfbc44ce..${i} ; done) \
$(git tag -l) \
--force
The first four steps are streight forward:
- Clone Alias repo as a bare repo
- Add 2nd remote shadowcash and fetch it
Now the tricky part starts:
git replace aa80c2023c2ab37a38722267f399e30bc3e516aa --graft 436f3329497a9badc5dd22ed746a8a42bfbc44ce
This cmd will advise Git to replace commit aa80c202, our first commit in 2016, by a graft commit based on 436f3329 as we determined above. At this point we have connected our first commit to the determined previous commit of the ShadowCash code base. See git replace documentation for further details. Now the recalculation of all following hashes must be done. Additionally all existing branches and tags must be handled properly. So the next step was the usage of git filter-repo
:
git filter-repo \
--refs \
436f3329497a9badc5dd22ed746a8a42bfbc44ce..HEAD \
$(for i in $(git branch | sed 's/[*]//g') ; do echo 436f3329497a9badc5dd22ed746a8a42bfbc44ce..${i} ; done) \
$(git tag -l) \
--force
git filter-repo --refs
expects revision ranges and tags to handle:
- The first entry is the the range starting at 436f3329 up to HEAD.
- The second step is a shell oneliner, which extracts all branch names and creates an entry for each of them in the form
436f3329..<branch-name>
. The sed statement in there is used to remove the marker of the current branch. - The third entry creates the list of all tags
After these steps were done, the new reunited history looks like this:
The technical part of the history reunion is finished at this point. The next chapter explains the performed organizational changes on Github.
A dedicated Github functionality is the handling of release artifacts. They are attached or "pinned" to a tag on the Git repository and in our case this step is fully automated out of the continuous integration builds. But if a tag is removed a/o recreated on a different hash, the attached artifacts get lost. Additionally our build artifacts contain a Git hash in their name. This is the hash from which the artifacts were build but after the history reunion they will no longer match to a Git hash.
To handle this as least invasive as possible we renamed and archived the original Alias repository as alias-wallet-archive. So this repository is readonly but still has the "old" history including the original hashes, tags and released artifacts at their release tags.
Github can't setup a fork relationship on a repository, which wasn't created using Github's fork functionality. To handle this we created a real fork of ShadowCash and removed all branches except master
on that fork. After that we finalized the history reunion with the following steps:
git clone [email protected]:aliascash/shadow.git
cd shadow
git reset --hard 436f3329
git push --force
After these steps the HEAD of the repository is at the last commit before our development starts back in 2016.
Now we added the fork repo as a new remote to the repository with the reunited history and pushed all branches to the new remote:
cd <repo-clone-with-reunited-history>
git remote add shadow-fork [email protected]:aliascash/shadow.git
git checkout master
git push --all shadow-fork
git checkout develop
git push --all shadow-fork
git checkout develop_android
git push --all shadow-fork
git checkout master_android
git push --all shadow-fork
...
After the rename of the original repository to alias-wallet-archive
, the forked Shadow repository was renamed to alias-wallet
. With this all external references to the main repository stay intact. Now the new main repository contains the full history back to the real initial commit:
commit 4405b78d6059e536c36974088a8ed4d9f0f29898
Author: sirius-m <sirius-m@1a98c847-1fd6-4fd8-948a-caf3550aa51b>
Date: Sun Aug 30 03:46:39 2009 +0000
First commit
All the tags still exist but they have changed hashes because of the rewritten history and they contain no release artifacts as it's a "new" repository, even if the content is dated way back. The last step to do was to point from the now empty releases on the new repository to the releases on the archived repository. For this we put a link on all 3.x and 4.x releases, which point to the corresponding release on the archived repository.
The first release based on the reunited repository was 4.4.0 from 2021-08-25 and the artifacts of this release are located on the corresponding release tag as usual.
All open issues were moved from the old repository to the new one. The only drawback with this is the re-numbering of them on the new repository. So we migrated the issues starting by the oldest open issue up to the newest. On the new repository they are now renumbered starting from scratch. Because of this we modified the links on the release notes to point on all mentioned tickets to the archive repository.
If you have a fork of the original repository, we suggest to rename the fork too. After that you should create a new fork from the new and history-reunited repository.