Conditional config includes based on remote URL
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v8 Latest2 patches 1 replyIn review
- v72 patches 9 repliesSuperseded
- v62 patches 8 repliesSuperseded
Earlier versions · 5
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v5 | 2 patches | 6 replies | Superseded | |
| v4 | 2 patches | 4 replies | Superseded | |
| v3 | 2 patches | 9 replies | Superseded | |
| v2 | 2 patches | 5 replies | Superseded | |
| v1 RFC | 2 patches | 21 replies | Superseded |
Patches in v8 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | config: make git_config_include() staticconfig.c config.h | +15 | 0 replies | |
| 2/2 | config: include file if remote URL matches a globDocumentation/ config.c config.h +1 more | +275 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v8 yet.
Cover letter [PATCH v8 0/2] Conditional config includes based on remote URL
Thanks everyone for your review. v8 follows Elijah Newren's comments about making URLs more identifiable in tests, and also including an example in documentation.
Jonathan Tan (2):
config: make git_config_include() static
config: include file if remote URL matches a glob
Documentation/config.txt | 35 +++++++++++ config.c | 132 ++++++++++++++++++++++++++++++++++++--- config.h | 46 ++++---------- t/t1300-config.sh | 118 ++++++++++++++++++++++++++++++++++ 4 files changed, 290 insertions(+), 41 deletions(-)
Range-diff against v7:
1: b2dcae03ed = 1: b2dcae03ed config: make git_config_include() static
2: 7c70089074 ! 2: 6691e39c82 config: include file if remote URL matches a glob
@@ Documentation/config.txt: all branches that begin with `foo/`. This is useful if
A few more notes on matching via `gitdir` and `gitdir/i`:
* Symlinks in `$GIT_DIR` are not resolved before matching.
+@@ Documentation/config.txt: Example
+ ; currently checked out
+ [includeIf "onbranch:foo-branch"]
+ path = foo.inc
++
++; include only if a remote with the given URL exists (note
++; that such a URL may be provided later in a file or in a
++; file read after this file is read, as seen in this example)
++[includeIf "hasconfig:remote.*.url:https://example.com/**"]
++ path = foo.inc
++[remote "origin"]
++ url = https://example.com/git
+ ----
+
+ Values
## config.c ##
@@ config.c: struct config_include_data {
@@ t/t1300-config.sh: test_expect_success '--get and --get-all with --fixed-value'
+ that = that-is-not-included
+ EOF
+ cat >>hasremoteurlTest/.git/config <<-EOF &&
-+ [includeIf "hasconfig:remote.*.url:foo"]
++ [includeIf "hasconfig:remote.*.url:foourl"]
+ path = "$(pwd)/include-this"
-+ [includeIf "hasconfig:remote.*.url:bar"]
++ [includeIf "hasconfig:remote.*.url:barurl"]
+ path = "$(pwd)/dont-include-that"
+ [remote "foo"]
-+ url = foo
++ url = foourl
+ EOF
+
+ echo this-is-included >expect-this &&
@@ t/t1300-config.sh: test_expect_success '--get and --get-all with --fixed-value'
+ EOF
+ cat >>hasremoteurlTest/.git/config <<-EOF &&
+ [remote "foo"]
-+ url = foo
++ url = foourl
+ [user]
+ one = main-config
+ two = main-config
-+ [includeIf "hasconfig:remote.*.url:foo"]
++ [includeIf "hasconfig:remote.*.url:foourl"]
+ path = "$(pwd)/include-two-three"
+ [user]
+ three = main-config
@@ t/t1300-config.sh: test_expect_success '--get and --get-all with --fixed-value'
+
+ cat >include-with-url <<-\EOF &&
+ [remote "bar"]
-+ url = bar
++ url = barurl
+ EOF
+ cat >>hasremoteurlTest/.git/config <<-EOF &&
-+ [includeIf "hasconfig:remote.*.url:foo"]
++ [includeIf "hasconfig:remote.*.url:foourl"]
+ path = "$(pwd)/include-with-url"
+ EOF
+Signature · 1 line
2.34.1.703.g22d0c6ccf7-goog