Replace unsetenv() and setenv() with older putenv().
[gitweb.git] / git-resolve-script
index 03c15a98b0527375d34f3369ab1cadb2f6bfc82c..50d5f8336feec0eb9839a2641cb9faf9ab67391d 100755 (executable)
@@ -6,21 +6,25 @@
 #
 . git-sh-setup-script || die "Not a git archive"
 
-head=$(git-rev-parse --revs-only "$1")
-merge=$(git-rev-parse --revs-only "$2")
-merge_repo="$3"
+usage () {
+       die "git-resolve-script <head> <remote> <merge-message>"
+}
 
 dropheads() {
        rm -f -- "$GIT_DIR/MERGE_HEAD" \
                "$GIT_DIR/LAST_MERGE" || exit 1
 }
 
+head=$(git-rev-parse --verify "$1"^0) &&
+merge=$(git-rev-parse --verify "$2"^0) &&
+merge_msg="$3" || usage
+
 #
 # The remote name is just used for the message,
 # but we do want it.
 #
-if [ -z "$head" -o -z "$merge" -o -z "$merge_repo" ]; then
-       die "git-resolve-script <head> <remote> <merge-repo-name>"
+if [ -z "$head" -o -z "$merge" -o -z "$merge_msg" ]; then
+       usage
 fi
 
 dropheads
@@ -47,7 +51,6 @@ if [ "$common" == "$head" ]; then
 fi
 echo "Trying to merge $merge into $head"
 git-read-tree -u -m $common $head $merge || exit 1
-merge_msg="Merge $merge_repo"
 result_tree=$(git-write-tree  2> /dev/null)
 if [ $? -ne 0 ]; then
        echo "Simple merge failed, trying Automatic merge"