THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
944B

  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. # The first parameters up to -- are merge bases; the rest are heads.
  8. bases= head= remotes= sep_seen=
  9. for arg
  10. do
  11. case ",$sep_seen,$head,$arg," in
  12. *,--,)
  13. sep_seen=yes
  14. ;;
  15. ,yes,,*)
  16. head=$arg
  17. ;;
  18. ,yes,*)
  19. remotes="$remotes$arg "
  20. ;;
  21. *)
  22. bases="$bases$arg "
  23. ;;
  24. esac
  25. done
  26. # Give up if we are given two or more remotes -- not handling octopus.
  27. case "$remotes" in
  28. ?*' '?*)
  29. exit 2 ;;
  30. esac
  31. # Give up if this is a baseless merge.
  32. if test '' = "$bases"
  33. then
  34. exit 2
  35. fi
  36. git update-index -q --refresh
  37. git read-tree -u -m --aggressive $bases $head $remotes || exit 2
  38. echo "Trying simple merge."
  39. if result_tree=$(git write-tree 2>/dev/null)
  40. then
  41. exit 0
  42. else
  43. echo "Simple merge failed, trying Automatic merge."
  44. if git merge-index -o git-merge-one-file -a
  45. then
  46. exit 0
  47. else
  48. exit 1
  49. fi
  50. fi