Skip to content
  • Jens Lehmann's avatar
    submodule: use argv_array instead of hand-building arrays · 50d89ad6
    Jens Lehmann authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    fetch_populated_submodules() allocates the full argv array it uses to
    recurse into the submodules from the number of given options plus the six
    argv values it is going to add. It then initializes it with those values
    which won't change during the iteration and copies the given options into
    it. Inside the loop the two argv values different for each submodule get
    replaced with those currently valid.
    
    However, this technique is brittle and error-prone (as the comment to
    explain the magic number 6 indicates), so let's replace it with an
    argv_array. Instead of replacing the argv values, push them to the
    argv_array just before the run_command() call (including the option
    separating them) and pop them from the argv_array right after that.
    
    Signed-off-by: default avatarJens Lehmann <Jens.Lehmann@web.de>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    50d89ad6