试图理解一行代码是如何被添加到git中的

dy1byipe  于 2023-09-29  发布在  Git
关注(0)|答案(1)|浏览(127)

https://github.com/phpseclib/phpseclib的1.0分支中有一个文件-phpseclib/Crypt/Rijndael.php
Commit bfba3db从该文件中删除了setKey()方法。该方法在the next commitd91158f)中仍然被删除,但在此之后,该方法在提交(19229ed)中又回到了文件中,即使该提交似乎没有重新添加该方法。
那么,setKey()方法是如何被添加回该文件的呢?
我想也许github.com在查看文件历史记录时没有显示合并提交,但那里有are no commits, merge or otherwise, between the commit d91158f and 19229ed,所以这个理论显然是胡说八道。
有什么想法吗?

6kkfgxo0

6kkfgxo01#

GitHub接口是关于分支的。Commit bfba3db位于不同的分支上。d91158f不是下一个,下一个是86910352。分支在提交666092c8时合并到1.0中。但是提交19229ed2又在另一个分支上,该分支是从666092c8之前的1.0分支出来的,因此该分支包含setKey()的代码。
我的建议是使用git clone -b 1.0 https://github.com/phpseclib/phpseclib.git克隆分支,并使用git log --decorate --graph查看分支和提交。这是图表中有趣的部分:

  1. | * commit 19229ed2
  2. | | Author: terrafrost <[email protected]>
  3. | | Date: Mon Oct 5 10:08:46 2015 -0500
  4. | |
  5. | | phpDoc changes
  6. | |
  7. * | commit 666092c8
  8. |\ \ Merge: c0e42ad7 5f1ff099
  9. | |/ Author: terrafrost <[email protected]>
  10. |/| Date: Mon Oct 12 22:59:46 2015 -0500
  11. | |
  12. | | Merge branch 'getkeylength' into 1.0
  13. | |
  14. | * commit 5f1ff099
  15. | | Author: terrafrost <[email protected]>
  16. | | Date: Mon Oct 12 22:52:56 2015 -0500
  17. | |
  18. | | Crypt/Base: one more cs update
  19. | |
  20. | * commit d91158f6
  21. | | Author: terrafrost <[email protected]>
  22. | | Date: Sun Oct 4 21:06:17 2015 -0500
  23. | |
  24. | | rename key_size -> key_length
  25. | |
  26. | * commit 27034825
  27. | | Author: terrafrost <[email protected]>
  28. | | Date: Sun Oct 4 16:29:48 2015 -0500
  29. | |
  30. | | cs changes per bantu
  31. | |
  32. | * commit 86910352
  33. | | Author: terrafrost <[email protected]>
  34. | | Date: Thu Sep 24 09:29:00 2015 -0500
  35. | |
  36. | | Crypt/Base: add getBlockLength() method
  37. | |
  38. | * commit bfba3db1
  39. | | Author: terrafrost <[email protected]>
  40. | | Date: Thu Sep 17 10:46:45 2015 -0500
  41. | |
  42. | | Crypt: make it so the key length can be explicitly set for all ciphers
展开查看全部

相关问题