Re: [PATCH 3/3] completion: fix bugs with slashes in remote names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



phillip.wood123@xxxxxxxxx writes:

>>      local fer_pids=
>>      for ...
>>      do
>>          __git for-each-ref ... &
>>          fer_pids="$fer_pids $!"
>>      done
>>      test -z "$fer_pids" || wait $fer_pids
>> } | sort | uniq -u
>> That might cause spikes in cpu/memory/disk usage that aren't ideal
>> though.
>
> Yes, if there were a 100 remotes that's a bit of a fork-bomb.

And they are all competing for a shared common resource for read
access.

I wonder if a single invocation of for-each-ref for refs/remotes/
hierarchy would be sufficient?  That is, the calling shell script
can set up a shell function "foo" and then

    eval $(for-each-ref --format='foo %(refname)' --shell refs/remotes/)

and "foo" can do its thing avoiding as much forks as possible.  As
you are allowed bash-ism in completion script, you do not have to
limit yourself to POSIX parameter substitution but can use substring
expansion ${parameter:offset:length} and pattern substitution
${parameter/pattern/string} and other kind of bash exotics, as well
as shell arrays (e.g., define an array __git__remote_branches[] for
each remote, which may contain the remote-tracking branches for the
remote).







[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux