Skip to content

Commit f3cbcab

Browse files
committed
fetch: add 'refs/bundle/' to log.excludeDecoration
When fetching from a bundle URI, the branches of that bundle are stored in a different ref namespace: refs/bundles/. This namespace is intended to assist with later 'git fetch' negotiations with a Git server, allowing the client to advertise which data it already has from a bundle URI. These references can be confusing for a user when they appear as a decoration in 'git log' output. Add "refs/bundles/" to the multi-valued log.excludeDecoration config value. This is similar to the way "refs/prefetch/" is hidden by background prefetch operations in 'git maintenance' as added by 96eaffe (maintenance: set log.excludeDecoration durin prefetch, 2021-01-19). Signed-off-by: Derrick Stolee <[email protected]>
1 parent 4eee303 commit f3cbcab

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

Documentation/fetch-options.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,4 +321,5 @@ endif::git-pull[]
321321
--bundle-uri=<uri>::
322322
Instead of fetching from a remote, fetch a bundle from the given
323323
`<uri>` and unbundle the data into the local repository. The refs
324-
in the bundle will be stored under the `refs/bundle/*` namespace.
324+
in the bundle will be stored under the hidden `refs/bundle/*`
325+
namespace.

bundle-uri.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "cache.h"
22
#include "bundle-uri.h"
33
#include "bundle.h"
4+
#include "config.h"
45
#include "object-store.h"
56
#include "refs.h"
67
#include "run-command.h"
@@ -153,6 +154,12 @@ int fetch_bundle_uri(struct repository *r, const char *uri)
153154
if ((result = unbundle_from_file(r, filename.buf)))
154155
goto cleanup;
155156

157+
git_config_set_multivar_gently("log.excludedecoration",
158+
"refs/bundle/",
159+
"refs/bundle/",
160+
CONFIG_FLAGS_FIXED_VALUE |
161+
CONFIG_FLAGS_MULTI_REPLACE);
162+
156163
cleanup:
157164
unlink(filename.buf);
158165
strbuf_release(&filename);

t/t5558-fetch-bundle-uri.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,19 @@ test_expect_success 'fetch file bundle' '
2828
git -C fetch-to fetch --bundle-uri="$(pwd)/fetch-from/B.bundle" &&
2929
git -C fetch-to rev-parse refs/bundles/topic >actual &&
3030
git -C fetch-from rev-parse topic >expect &&
31-
test_cmp expect actual
31+
test_cmp expect actual &&
32+
33+
test_config -C fetch-to log.excludedecoration refs/bundle/
3234
'
3335

3436
test_expect_success 'fetch file:// bundle' '
3537
git init fetch-file &&
3638
git -C fetch-file fetch --bundle-uri="file://$(pwd)/fetch-from/B.bundle" &&
3739
git -C fetch-file rev-parse refs/bundles/topic >actual &&
3840
git -C fetch-from rev-parse topic >expect &&
39-
test_cmp expect actual
41+
test_cmp expect actual &&
42+
43+
test_config -C fetch-file log.excludedecoration refs/bundle/
4044
'
4145

4246
#########################################################################
@@ -62,7 +66,9 @@ test_expect_success 'fetch HTTP bundle' '
6266
git -C fetch-http fetch --bundle-uri="$HTTPD_URL/B.bundle" &&
6367
git -C fetch-http rev-parse refs/bundles/topic >actual &&
6468
git -C fetch-from rev-parse topic >expect &&
65-
test_cmp expect actual
69+
test_cmp expect actual &&
70+
71+
test_config log.excludedecoration refs/bundle/
6672
'
6773

6874
# Do not add tests here unless they use the HTTP server, as they will

0 commit comments

Comments
 (0)