Even more aggressive commit trimming.
Now we cut out a commit if any of its parents had the same tree; just use that parent in its place. This makes the history look nice, but I don't think it's quite right...
This commit is contained in:
parent
210d083904
commit
d691265880
@ -202,6 +202,29 @@ tree_changed()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copy_or_skip()
|
||||||
|
{
|
||||||
|
rev="$1"
|
||||||
|
tree="$2"
|
||||||
|
newparents="$3"
|
||||||
|
assert [ -n "$tree" ]
|
||||||
|
|
||||||
|
p=""
|
||||||
|
for parent in $newparents; do
|
||||||
|
ptree=$(toptree_for_commit $parent) || exit $?
|
||||||
|
if [ "$ptree" = "$tree" ]; then
|
||||||
|
# any identical parent means this commit is unnecessary
|
||||||
|
echo $parent
|
||||||
|
return 0
|
||||||
|
elif [ -n "$ptree" ]; then
|
||||||
|
# an existing, non-identical parent is important
|
||||||
|
p="$p -p $parent"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
copy_commit $rev $tree "$p" || exit $?
|
||||||
|
}
|
||||||
|
|
||||||
cmd_split()
|
cmd_split()
|
||||||
{
|
{
|
||||||
debug "Splitting $dir..."
|
debug "Splitting $dir..."
|
||||||
@ -238,16 +261,7 @@ cmd_split()
|
|||||||
debug " tree is: $tree"
|
debug " tree is: $tree"
|
||||||
[ -z $tree ] && continue
|
[ -z $tree ] && continue
|
||||||
|
|
||||||
p=""
|
newrev=$(copy_or_skip "$rev" "$tree" "$newparents") || exit $?
|
||||||
for parent in $newparents; do
|
|
||||||
p="$p -p $parent"
|
|
||||||
done
|
|
||||||
|
|
||||||
if tree_changed $tree $newparents; then
|
|
||||||
newrev=$(copy_commit $rev $tree "$p") || exit $?
|
|
||||||
else
|
|
||||||
newrev="$newparents"
|
|
||||||
fi
|
|
||||||
debug " newrev is: $newrev"
|
debug " newrev is: $newrev"
|
||||||
cache_set $rev $newrev
|
cache_set $rev $newrev
|
||||||
cache_set latest_new $newrev
|
cache_set latest_new $newrev
|
||||||
|
2
test.sh
2
test.sh
@ -93,4 +93,4 @@ git branch subproj-merge-split3
|
|||||||
cd ../mainline
|
cd ../mainline
|
||||||
git fetch ../subproj subproj-merge-split3
|
git fetch ../subproj subproj-merge-split3
|
||||||
git branch subproj-merge-split3 FETCH_HEAD
|
git branch subproj-merge-split3 FETCH_HEAD
|
||||||
git merge subproj-merge-split3
|
git merge -s subtree subproj-merge-split3
|
||||||
|
Loading…
Reference in New Issue
Block a user