Skip to content

Commit 19258d7

Browse files
committed
Merge branch 'protocol-var'
Fixes #281 and fixes #278
2 parents c448602 + 17ae649 commit 19258d7

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ target=git-logins/${host}
138138

139139
The above configuration directive will lead to any host that did not match any previous section in the ini file to being looked up under the `git-logins` directory in your password store.
140140

141+
Apart from `${host}`, the variables `${username}` and `${protocol}` can be used for replacements.
142+
141143
#### DEFAULT Section
142144

143145
Defaults suitable for all entries of the mapping file can be specified in a special section of the configuration file named `[DEFAULT]`.

passgithelper.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ def define_pass_target(
352352
pass_target = section.get("target").replace("${host}", request["host"])
353353
if "username" in request:
354354
pass_target = pass_target.replace("${username}", request["username"])
355+
if "protocol" in request:
356+
pass_target = pass_target.replace("${protocol}", request["protocol"])
355357
return pass_target
356358

357359

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[*]
2-
target=dev/${host}/${username}
2+
target=dev/${protocol}/${host}/${username}

test_passgithelper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def test_path_used_if_present(self, capsys: Any) -> None:
263263
username=wildcard
264264
path=subpath/bar.git""",
265265
b"narf-wildcard",
266-
"dev/wildcard.com/wildcard",
266+
"dev/https/wildcard.com/wildcard",
267267
),
268268
],
269269
indirect=True,

0 commit comments

Comments
 (0)