Thomas Rast <trast@xxxxxxxxxxxxxxx> writes: >> Reading everything down to the root commit sounds like fun. rev-list >> gives you the output from newer to older so you may want to break out once >> you have found enough candidates. >> >> Anyway, if I were doing this script, I'd write this part like this without >> a shell loop: >> >> _x40="[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]" >> _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" >> >> git rev-list --all --grep="Merge branch '$1'" \ >> --pretty=tformat:"%H %P %s" | >> sed -ne "s/^$_x40 $_x40 \($_x40\) Merge .*/\1/p" > > Nice trick. The same also works for scan_merge_targets() and gives it > a nice speed boost too. Unfortunately my sed-fu is not good enough to > figure out how to only print the first line (for resurrections from > pu, we expect there to be a single match). Do you mean something like this? sed -n -e "/^$_x40 $_x40 \($_x40\) Merge .*/ { s//\1/p q }" -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html