Skip to content
  • Jeff King's avatar
    fast-import: refactor parsing of spaces · e814c39c
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    When we see a file change in a commit, we expect one of:
    
      1. A mark.
    
      2. An "inline" keyword.
    
      3. An object sha1.
    
    The handling of spaces is inconsistent between the three
    options. Option 1 calls a sub-function which checks for the
    space, but doesn't parse past it. Option 2 parses the space,
    then deliberately avoids moving the pointer past it. Option
    3 detects the space locally but doesn't move past it.
    
    This is confusing, because it looks like option 1 forgets to
    check for the space (it's just buried). And option 2 checks
    for "inline ", but only moves strlen("inline") characters
    forward, which looks like a bug but isn't.
    
    We can make this more clear by just having each branch move
    past the space as it is checked (and we can replace the
    doubled use of "inline" with a call to skip_prefix).
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    e814c39c