From d02bc3355f977ab4a70edbca58b38e81098848b8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C4=81nis=20R=C5=ABcis?= Date: Mon, 16 Aug 2010 15:32:45 +0300 Subject: [PATCH 1/1] import-pk3: init index with merge base, not always master Otherwise the commit history gets lost. --- misc/tools/git-import-pk3 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 -- 2.39.2