1. 24 Feb, 2012 1 commit
    • Jeff King's avatar
      teach convert_to_git a "dry run" mode · 92ac3197
      Jeff King authored
      Some callers may want to know whether convert_to_git will
      actually do anything before performing the conversion
      itself (e.g., to decide whether to stream or handle blobs
      in-core). This patch lets callers specify the dry run mode
      by passing a NULL destination buffer. The return value,
      instead of indicating whether conversion happened, will
      indicate whether conversion would occur.
      
      For readability, we also include a wrapper function which
      makes it more obvious we are not actually performing the
      conversion.
      Signed-off-by: default avatarJeff King <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      92ac3197
  2. 26 May, 2011 3 commits
    • Junio C Hamano's avatar
      Add streaming filter API · b6691092
      Junio C Hamano authored
      This introduces an API to plug custom filters to an input stream.
      
      The caller gets get_stream_filter("path") to obtain an appropriate
      filter for the path, and then uses it when opening an input stream
      via open_istream().  After that, the caller can read from the stream
      with read_istream(), and close it with close_istream(), just like an
      unfiltered stream.
      
      This only adds a "null" filter that is a pass-thru filter, but later
      changes can add LF-to-CRLF and other filters, and the callers of the
      streaming API do not have to change.
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      b6691092
    • Junio C Hamano's avatar
      convert.h: move declarations for conversion from cache.h · d1bf0e08
      Junio C Hamano authored
      Before adding the streaming filter API to the conversion layer,
      move the existing declarations related to the conversion to its
      own header file.
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      d1bf0e08
    • Junio C Hamano's avatar
      stream filter: add "no more input" to the filters · 4ae66704
      Junio C Hamano authored
      Some filters may need to buffer the input and look-ahead inside it
      to decide what to output, and they may consume more than zero bytes
      of input and still not produce any output. After feeding all the
      input, pass NULL as input as keep calling stream_filter() to let
      such filters know there is no more input coming, and it is time for
      them to produce the remaining output based on the buffered input.
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      4ae66704