From: Jānis Rūcis Date: Mon, 16 Aug 2010 12:32:45 +0000 (+0300) Subject: import-pk3: init index with merge base, not always master X-Git-Tag: xonotic-v0.1.0preview~292^2~4 X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fxonotic.git;a=commitdiff_plain;h=d02bc3355f977ab4a70edbca58b38e81098848b8 import-pk3: init index with merge base, not always master Otherwise the commit history gets lost. --- 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