Skip to content

Commit

Permalink
subtree: fix argument handling in check_parents
Browse files Browse the repository at this point in the history
check_parents was taking all of its arguments as a single string,
and erroneously passing them to cache_miss as a single string. For
commits with a single parent this would succeed, but whenever a merge
commit was processed, cache_miss would be passed "parent1 parent2"
instead of "parent1" "parent2" and fail, leading to unecessary rechecks
of the parent commits.

For consistency, take multiple arguments in check_parents,
and pass all of them to cache_miss separately.

Signed-off-by: James Limbouris <james@digitalmatter.com>
  • Loading branch information
jamesl-dm committed Dec 6, 2021
1 parent e9d7761 commit f734ca9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions contrib/subtree/git-subtree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,9 @@ cache_miss () {
done
}

# Usage: check_parents PARENTS_EXPR
# Usage: check_parents [REVS...]
check_parents () {
assert test $# = 1
missed=$(cache_miss "$1") || exit $?
missed=$(cache_miss "$@") || exit $?
local indent=$(($indent + 1))
for miss in $missed
do
Expand Down Expand Up @@ -753,7 +752,7 @@ process_split_commit () {
fi
createcount=$(($createcount + 1))
debug "parents: $parents"
check_parents "$parents"
check_parents $parents
newparents=$(cache_get $parents) || exit $?
debug "newparents: $newparents"

Expand Down

0 comments on commit f734ca9

Please sign in to comment.