Advertisement
Guest User

git-subtree error example

a guest
Apr 22nd, 2011
661
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.64 KB | None | 0 0
  1. echo ""
  2. echo "-- Create the "library" repository."
  3. echo ""
  4. mkdir repoLib
  5. cd repoLib
  6. git init
  7. echo test > test.txt
  8. git add .
  9. git commit -m "Adding test.txt"
  10. cd ..
  11.  
  12. echo ""
  13. echo "-- Create a bare repository that we can push into (emulating what we're doing in gitolite)."
  14. echo ""
  15. mkdir repoMain_Server
  16. cd repoMain_Server
  17. git init --bare
  18. cd ..
  19.  
  20. echo ""
  21. echo "-- Close the server repository."
  22. echo ""
  23. git clone repoMain_Server repoMain
  24. cd repoMain
  25.  
  26. echo ""
  27. echo "-- Write a file and push to the server repo."
  28. echo ""
  29. echo test > test2.txt
  30. git add .
  31. git commit -m "Adding test2.txt"
  32. git push origin master
  33.  
  34. echo ""
  35. echo "-- subtree add the library repository and push the results to the server.  If --squash is removed everything will work."
  36. echo ""
  37. git subtree add -P Subtree/librepoLib --squash ../repoLib master
  38. git push
  39. cd ..
  40.  
  41. echo ""
  42. echo "-- clone the main repo and attempt to split out Subtree/librepoLib, should succeed"
  43. echo ""
  44. git clone repoMain repoMainClone
  45. cd repoMainClone
  46. git subtree split -P Subtree/librepoLib -b libABranch
  47. cd ..
  48.  
  49. echo ""
  50. echo "-- pull the main repo and attempt to split out Subtree/librepoLib, should error (fatal: bad object ...)"
  51. echo ""
  52. mkdir repoMainPull
  53. cd repoMainPull
  54. git init
  55. git pull ../repoMain
  56. git subtree split -P Subtree/librepoLib -b libABranch
  57. cd ..
  58.  
  59. echo ""
  60. echo "-- clone the server repository as if we were a separate user on a separate computer."
  61. echo ""
  62. git clone repoMain_Server repo_working
  63. cd repo_working
  64.  
  65. echo ""
  66. echo "-- attempt to split out Subtree/librepoLib, should error (fatal: bad object ...)"
  67. echo ""
  68. git subtree split -P Subtree/librepoLib -b libABranch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement