logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

git-merge-resolve (1226B)


  1. #!/bin/sh
  2. #
  3. # Copyright (c) 2005 Linus Torvalds
  4. # Copyright (c) 2005 Junio C Hamano
  5. #
  6. # Resolve two trees, using enhanced multi-base read-tree.
  7. . git-sh-setup
  8. # Abort if index does not match HEAD
  9. if ! git diff-index --quiet --cached HEAD --
  10. then
  11. gettextln "Error: Your local changes to the following files would be overwritten by merge"
  12. git diff-index --cached --name-only HEAD -- | sed -e 's/^/ /'
  13. exit 2
  14. fi
  15. # The first parameters up to -- are merge bases; the rest are heads.
  16. bases= head= remotes= sep_seen=
  17. for arg
  18. do
  19. case ",$sep_seen,$head,$arg," in
  20. *,--,)
  21. sep_seen=yes
  22. ;;
  23. ,yes,,*)
  24. head=$arg
  25. ;;
  26. ,yes,*)
  27. remotes="$remotes$arg "
  28. ;;
  29. *)
  30. bases="$bases$arg "
  31. ;;
  32. esac
  33. done
  34. # Give up if we are given two or more remotes -- not handling octopus.
  35. case "$remotes" in
  36. ?*' '?*)
  37. exit 2 ;;
  38. esac
  39. # Give up if this is a baseless merge.
  40. if test '' = "$bases"
  41. then
  42. exit 2
  43. fi
  44. git update-index -q --refresh
  45. git read-tree -u -m --aggressive $bases $head $remotes || exit 2
  46. echo "Trying simple merge."
  47. if result_tree=$(git write-tree 2>/dev/null)
  48. then
  49. exit 0
  50. else
  51. echo "Simple merge failed, trying Automatic merge."
  52. if git merge-index -o git-merge-one-file -a
  53. then
  54. exit 0
  55. else
  56. exit 1
  57. fi
  58. fi