Skip to content

Commit 33cf510

Browse files
Add --all flag to fetch method
The fix for CVE-2022-25648 broke a workflow for us by removing the ability to fetch all remotes. This adds --all to the list of available flags for the #fetch method. It does not add :a as an alternative flag, as git fetch -a and git fetch --all are not the same thing. Signed-off-by: Matthew Riedel matthew.riedel@fluxfederation.com
1 parent 45b467c commit 33cf510

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/git/lib.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -877,15 +877,16 @@ def tag(name, *opts)
877877

878878
def fetch(remote, opts)
879879
arr_opts = []
880+
arr_opts << '--all' if opts[:all]
880881
arr_opts << '--tags' if opts[:t] || opts[:tags]
881882
arr_opts << '--prune' if opts[:p] || opts[:prune]
882883
arr_opts << '--prune-tags' if opts[:P] || opts[:'prune-tags']
883884
arr_opts << '--force' if opts[:f] || opts[:force]
884885
arr_opts << '--unshallow' if opts[:unshallow]
885886
arr_opts << '--depth' << opts[:depth] if opts[:depth]
886-
arr_opts << '--'
887-
arr_opts << remote
888-
arr_opts << opts[:ref] if opts[:ref]
887+
arr_opts << '--' unless opts[:all]
888+
arr_opts << remote unless opts[:all]
889+
arr_opts << opts[:ref] if opts[:ref] unless opts[:all]
889890

890891
command('fetch', arr_opts)
891892
end

0 commit comments

Comments
 (0)