X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fxonotic.git;a=blobdiff_plain;f=misc%2Ftools%2Fgit-import-pk3;h=a2c243a4ba8e3c5b043e60c247757f0d86150508;hp=54c8593e48030a8bb0c40f73334bdd06596cc725;hb=d02bc3355f977ab4a70edbca58b38e81098848b8;hpb=508096a6856476daabb76212f67e2e723132b488 diff --git a/misc/tools/git-import-pk3 b/misc/tools/git-import-pk3 index 54c8593e..a2c243a4 100755 --- a/misc/tools/git-import-pk3 +++ b/misc/tools/git-import-pk3 @@ -72,17 +72,19 @@ unzip -n -qq "$pk3path" -d "$GIT_WORK_TREE" || die "couldn't extract PK3 contents" trap 'find "$GIT_WORK_TREE" -mindepth 1 -delete' EXIT -# Note the refs +# Note the refs and the common ancestor master=refs/heads/master ref=refs/heads/$branch +base=$(git merge-base $master $ref 2> /dev/null) || +base=$master # Figure out the parent commit parent=\ -$(git rev-parse --verify -q $ref || git rev-parse --verify -q $master) || +$(git rev-parse --verify -q $ref || git rev-parse --verify -q $base) || die "couldn't determine parent commit" -# Read the tree at master into index -git read-tree $master || +# Read the tree at base into index +git read-tree $base || die "couldn't initialize index" # Reject any modified files, the mapper should create a branch instead