Skip to content
  • Stefan Beller's avatar
    hash-object: replace stdin parsing OPT_BOOLEAN by OPT_COUNTUP · c83e8c17
    Stefan Beller authored and Junio C Hamano's avatar Junio C Hamano committed
    This task emerged from b04ba2bb
    
     (parse-options: deprecate OPT_BOOLEAN,
    2011-09-27). hash-object is a plumbing layer command, so better
    not change the input/output behavior for now.
    
    Unfortunately we have these lines relying on the count up mechanism of
    OPT_BOOLEAN:
    
    	if (hashstdin > 1)
    		errstr = "Multiple --stdin arguments are not supported";
    
    Using OPT_BOOL will make "git hash-object --stdin --stdin" the same
    as "git hash-object --stdin", resulting in just one object, which
    will surprise users with an expectation to see two objects hashed.
    
    Because it is not good to silently succeed and give an unexpected
    result, even when the expectation is unrealistic, we use COUNTUP to
    explicitly catch such an error.
    
    Signed-off-by: default avatarStefan Beller <stefanbeller@googlemail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    c83e8c17