File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,10 @@ ifndef::git-pull[]
139139 specified refspec (can be given more than once) to map the
140140 refs to remote-tracking branches, instead of the values of
141141 `remote.*.fetch` configuration variables for the remote
142- repository. See section on "Configured Remote-tracking
142+ repository. Providing an empty `<refspec>` to the
143+ `--refmap` option causes Git to ignore the configured
144+ refspecs and rely entirely on the refspecs supplied as
145+ command-line arguments. See section on "Configured Remote-tracking
143146 Branches" for details.
144147
145148-t::
Original file line number Diff line number Diff line change @@ -174,6 +174,30 @@ test_expect_success 'fetch --prune --tags with refspec prunes based on refspec'
174174 git rev-parse sometag
175175'
176176
177+ test_expect_success ' --refmap="" ignores configured refspec' '
178+ cd "$TRASH_DIRECTORY" &&
179+ git clone "$D" remote-refs &&
180+ git -C remote-refs rev-parse remotes/origin/master >old &&
181+ git -C remote-refs update-ref refs/remotes/origin/master master~1 &&
182+ git -C remote-refs rev-parse remotes/origin/master >new &&
183+ git -C remote-refs fetch --refmap= origin "+refs/heads/*:refs/hidden/origin/*" &&
184+ git -C remote-refs rev-parse remotes/origin/master >actual &&
185+ test_cmp new actual &&
186+ git -C remote-refs fetch origin &&
187+ git -C remote-refs rev-parse remotes/origin/master >actual &&
188+ test_cmp old actual
189+ '
190+
191+ test_expect_success ' --refmap="" and --prune' '
192+ git -C remote-refs update-ref refs/remotes/origin/foo/otherbranch master &&
193+ git -C remote-refs update-ref refs/hidden/foo/otherbranch master &&
194+ git -C remote-refs fetch --prune --refmap="" origin +refs/heads/*:refs/hidden/* &&
195+ git -C remote-refs rev-parse remotes/origin/foo/otherbranch &&
196+ test_must_fail git -C remote-refs rev-parse refs/hidden/foo/otherbranch &&
197+ git -C remote-refs fetch --prune origin &&
198+ test_must_fail git -C remote-refs rev-parse remotes/origin/foo/otherbranch
199+ '
200+
177201test_expect_success ' fetch tags when there is no tags' '
178202
179203 cd "$D" &&
You can’t perform that action at this time.
0 commit comments