| 1 | # Subtree Instructions |
| 2 | |
| 3 | The hdl/ subdirectory is a git subtree. |
| 4 | |
| 5 | ## Creating the subtree |
| 6 | |
| 7 | Clear `hdl/fpga/ip/analogdevicesinc/hdl` to pave the way for the subtree: |
| 8 | |
| 9 | ``` |
| 10 | rm -rf hdl/fpga/ip/analogdevicesinc/hdl |
| 11 | git add hdl/ |
| 12 | git commit -m 'hdl/analogdevicesinc: remove manual adi hdl codebase integration' |
| 13 | ``` |
| 14 | |
| 15 | Fetch vendor master: |
| 16 | |
| 17 | ``` |
| 18 | git remote add adi-hdl https://github.com/analogdevicesinc/hdl.git |
| 19 | git fetch adi-hdl master |
| 20 | ``` |
| 21 | |
| 22 | Add the subtree: |
| 23 | |
| 24 | ``` |
| 25 | git subtree add -P hdl/fpga/ip/analogdevicesinc/hdl adi-hdl/master --squash |
| 26 | ``` |
| 27 | |
| 28 | Prune unneeded subdirectories: |
| 29 | |
| 30 | ``` |
| 31 | cd hdl/fpga/ip/analogdevicesinc/hdl |
| 32 | git rm -r library/* projects/* |
| 33 | git reset HEAD library/axi_ad9361 library/axi_dmac library/common library/scripts \ |
| 34 | library/util_axis_fifo library/util_axis_resize library/util_cpack library/util_upack \ |
| 35 | projects/arradio |
| 36 | git checkout -- library/axi_ad9361 library/axi_dmac library/common library/scripts \ |
| 37 | library/util_axis_fifo library/util_axis_resize library/util_cpack library/util_upack \ |
| 38 | projects/arradio |
| 39 | git commit -m 'hdl/analogdevicesinc: prune unnecessary subdirectories from ADI repo' |
| 40 | ``` |
| 41 | |
| 42 | Replay our modifications to the vendor code, omitting the oldest commit (1ed07b8, a commit |
| 43 | of a copy of the ADI repo) and the three most recent commits (the rm of the hdl tree, and the |
| 44 | two subtree merges): |
| 45 | |
| 46 | ``` |
| 47 | git cherry-pick -X ours \ |
| 48 | $(git rev-list --reverse HEAD~3 ^1ed07b8 hdl/fpga/ip/analogdevicesinc/hdl) |
| 49 | ``` |
| 50 | |
| 51 | ## Updating the subtree |
| 52 | |
| 53 | Fetch new vendor master: |
| 54 | |
| 55 | ``` |
| 56 | git remote add adi-hdl https://github.com/analogdevicesinc/hdl.git |
| 57 | git fetch adi-hdl master |
| 58 | ``` |
| 59 | |
| 60 | Merge the updated subtree: |
| 61 | |
| 62 | ``` |
| 63 | git subtree merge -P hdl/fpga/ip/analogdevicesinc/hdl adi-hdl/master --squash |
| 64 | ``` |