Skip to content

Commit a0a8dfa

Browse files
Use Josh signature for proxy generated merges (#1179)
Previously the signature was copied from the commit to be merged which is not really correct. This happens on push so it is also ok to use the current server time as this operation does not need to be repeatable. Change: merge-signature
1 parent b6cd5a4 commit a0a8dfa

File tree

4 files changed

+91
-89
lines changed

4 files changed

+91
-89
lines changed

josh-proxy/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,16 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult<String>
238238
.revparse_single(&original_target_ref)
239239
.map(|x| x.id())
240240
{
241+
let signature = proxy_commit_signature()?;
241242
let base_commit = transaction.repo().find_commit(base_commit_id)?;
242243
let merged_tree = transaction
243244
.repo()
244245
.merge_commits(&base_commit, &backward_commit, None)?
245246
.write_tree_to(transaction.repo())?;
246247
transaction.repo().commit(
247248
None,
248-
&backward_commit.author(),
249-
&backward_commit.committer(),
249+
&signature,
250+
&signature,
250251
&format!("Merge from {}", &repo_update.filter_spec),
251252
&transaction.repo().find_tree(merged_tree)?,
252253
&[&base_commit, &backward_commit],

tests/proxy/workspace_invalid_trailing_slash.t

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ Flushed credential cache
5555
remote: josh-proxy
5656
remote: response from upstream:
5757
remote: To http://localhost:8001/real_repo.git
58-
remote: 81c59c0..ae64c76 JOSH_PUSH -> master
59-
remote: REWRITE(85ee20960c56619305e098b301d8253888b6ce5b -> c255706f564f629eed1756b789d761048cfe060a)
58+
remote: 81c59c0..37c79e6 JOSH_PUSH -> master
59+
remote: REWRITE(85ee20960c56619305e098b301d8253888b6ce5b -> 705dcb4e33bd0dd3f95d5831fc8dc8a41ca3e566)
6060
remote:
6161
remote:
6262
To http://localhost:8002/real_repo.git:workspace=ws.git
@@ -92,8 +92,8 @@ Flushed credential cache
9292
$ cd ${TESTTMP}/real_repo
9393
$ git pull --rebase
9494
From http://localhost:8001/real_repo
95-
81c59c0..ae64c76 master -> origin/master
96-
Updating 81c59c0..ae64c76
95+
81c59c0..37c79e6 master -> origin/master
96+
Updating 81c59c0..37c79e6
9797
Fast-forward
9898
ws/workspace.josh | 4 ++++
9999
1 file changed, 4 insertions(+)
@@ -128,7 +128,7 @@ Flushed credential cache
128128
remote: josh-proxy
129129
remote: response from upstream:
130130
remote:
131-
remote: Can't apply "mod workspace" (4e531443c5533e6d1b2503d0fad238cfc8491807)
131+
remote: Can't apply "mod workspace" (b78eb888451be077531b50794384c2faec025765)
132132
remote: Invalid workspace:
133133
remote: ----
134134
remote: --> 1:1
@@ -205,6 +205,8 @@ Flushed credential cache
205205
| | | `-- cadcac11584c2c798ff38995ebd4d27490885a
206206
| | |-- 2b
207207
| | | `-- 20b4f8abb6d70648e2573e2f798a18e0079f9e
208+
| | |-- 37
209+
| | | `-- c79e64948d36bd1bb804e274ef5419bb44e602
208210
| | |-- 3d
209211
| | | `-- 77ff51363c9825cc2a221fc0ba5a883a1a2c72
210212
| | |-- 81
@@ -220,8 +222,6 @@ Flushed credential cache
220222
| | | `-- 24003ee1acc6bf70318a46e7b6df651b9dc246
221223
| | |-- ad
222224
| | | `-- 24149d789e59d4b5f9ce41cda90110ca0f98b7
223-
| | |-- ae
224-
| | | `-- 64c764b19ab4cb9c8d4ad32ae9dc04a30eb42a
225225
| | |-- b3
226226
| | | `-- dc01c39cba3251ec3a349fc585bd57ee4136f8
227227
| | |-- e6
@@ -257,6 +257,8 @@ Flushed credential cache
257257
| | `-- 20b4f8abb6d70648e2573e2f798a18e0079f9e
258258
| |-- 31
259259
| | `-- f15ce76ce6a453ecc90f5852e70babf3554707
260+
| |-- 37
261+
| | `-- c79e64948d36bd1bb804e274ef5419bb44e602
260262
| |-- 3d
261263
| | `-- 96ae1a24134d32cf3eca0629fb4fd1d095693a
262264
| |-- 41
@@ -267,15 +269,17 @@ Flushed credential cache
267269
| | `-- 9ee6ea51565adf5c005dd1bc93f4b42f335be3
268270
| |-- 4b
269271
| | `-- 825dc642cb6eb9a060e54bf8d69288fbee4904
270-
| |-- 4e
271-
| | `-- 531443c5533e6d1b2503d0fad238cfc8491807
272272
| |-- 51
273273
| | `-- 45dedc66248700cf33e354ef555877bc24f533
274274
| |-- 66
275275
| | `-- 1bafe5fb60524a9efafd413c42e4c2d706bae8
276276
| |-- 6c
277277
| | |-- 8233465e92d353e2ef47c02dc568ea44a32339
278278
| | `-- 9e5f368b68b7e511f7b0ce25cbedd2a3b42abb
279+
| |-- 70
280+
| | `-- 5dcb4e33bd0dd3f95d5831fc8dc8a41ca3e566
281+
| |-- 7b
282+
| | `-- 418ed7c356797b1a8eef3ff949632495d273c6
279283
| |-- 7d
280284
| | `-- 5816334652b9738e33e4ceaf925573c3414e0c
281285
| |-- 85
@@ -294,12 +298,10 @@ Flushed credential cache
294298
| | `-- 613be55337cdfab189935d8dbd1d4f427ef75e
295299
| |-- a1
296300
| | `-- fe09109ceb8c170db78421172e3674ff18f762
297-
| |-- ae
298-
| | `-- 64c764b19ab4cb9c8d4ad32ae9dc04a30eb42a
299-
| |-- c2
300-
| | `-- 55706f564f629eed1756b789d761048cfe060a
301-
| |-- cc
302-
| | `-- c413520301cf92e055b007c3810e6239e43939
301+
| |-- b7
302+
| | `-- 8eb888451be077531b50794384c2faec025765
303+
| |-- cd
304+
| | `-- 9ae8cb61e7d1aaa7b90766ff9aa9b3dc78c856
303305
| |-- db
304306
| | `-- 9120ba624b0afe79d37a5a262d8deb14e13707
305307
| |-- df
@@ -308,8 +310,6 @@ Flushed credential cache
308310
| | `-- 2803a3f6b703de58a33b330f70b5034e0ebcf8
309311
| |-- f7
310312
| | `-- 99a2ffcfae170f01efea806ff109e5e702191a
311-
| |-- f8
312-
| | `-- 0574b1c92818683f0283f78078031282fff75a
313313
| |-- info
314314
| `-- pack
315315
`-- refs

0 commit comments

Comments
 (0)