Skip over empty commits.
But we still need to get rid of unnecessary merge commits somehow...
This commit is contained in:
@ -167,6 +167,32 @@ merge_msg()
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tree_for_commit()
|
||||||
|
{
|
||||||
|
git ls-tree "$1" -- "$dir" |
|
||||||
|
while read mode type tree name; do
|
||||||
|
assert [ "$name" = "$dir" ]
|
||||||
|
echo $tree
|
||||||
|
break
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
tree_changed()
|
||||||
|
{
|
||||||
|
tree=$1
|
||||||
|
shift
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
return 0 # weird parents, consider it changed
|
||||||
|
else
|
||||||
|
ptree=$(tree_for_commit $1)
|
||||||
|
if [ "$ptree" != "$tree" ]; then
|
||||||
|
return 0 # changed
|
||||||
|
else
|
||||||
|
return 1 # not changed
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
cmd_split()
|
cmd_split()
|
||||||
{
|
{
|
||||||
debug "Splitting $dir..."
|
debug "Splitting $dir..."
|
||||||
@ -199,22 +225,25 @@ cmd_split()
|
|||||||
newparents=$(cache_get $parents)
|
newparents=$(cache_get $parents)
|
||||||
debug " newparents: $newparents"
|
debug " newparents: $newparents"
|
||||||
|
|
||||||
git ls-tree $rev -- "$dir" |
|
tree=$(tree_for_commit $rev)
|
||||||
while read mode type tree name; do
|
|
||||||
assert [ "$name" = "$dir" ]
|
|
||||||
debug " tree is: $tree"
|
debug " tree is: $tree"
|
||||||
|
[ -z $tree ] && continue
|
||||||
|
|
||||||
p=""
|
p=""
|
||||||
for parent in $newparents; do
|
for parent in $newparents; do
|
||||||
p="$p -p $parent"
|
p="$p -p $parent"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if tree_changed $tree $parents; then
|
||||||
newrev=$(copy_commit $rev $tree "$p") || exit $?
|
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
|
||||||
cache_set latest_old $rev
|
cache_set latest_old $rev
|
||||||
done || exit $?
|
done || exit $?
|
||||||
done || exit $?
|
|
||||||
latest_new=$(cache_get latest_new)
|
latest_new=$(cache_get latest_new)
|
||||||
if [ -z "$latest_new" ]; then
|
if [ -z "$latest_new" ]; then
|
||||||
die "No new revisions were found"
|
die "No new revisions were found"
|
||||||
|
Reference in New Issue
Block a user