line-log: extract pathspec parsing from line ranges into a helper function