Skip to content
  • Jeff King's avatar
    cherry-pick: detect bogus arguments to --mainline · b16a991c
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    The cherry-pick and revert commands use OPT_INTEGER() to
    parse --mainline. The stock parser is smart enough to reject
    non-numeric nonsense, but it doesn't know that parent
    counting starts at 1.
    
    Worse, the value "0" is indistinguishable from the unset
    case, so a user who assumes the counting is 0-based will get
    a confusing message:
    
      $ git cherry-pick -m 0 $merge
      error: commit ... is a merge but no -m option was given.
    
    Let's use a custom callback that enforces our range.
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    b16a991c