Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions josh-proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ fn baseref_and_options(refname: &str) -> josh::JoshResult<(String, String, Vec<S
push_mode = PushMode::Review;
baseref = baseref.replacen("refs/drafts", "refs/heads", 1)
}
if baseref.starts_with("refs/stack") {
if baseref.starts_with("refs/stack/for") {
push_mode = PushMode::Stack;
baseref = baseref.replacen("refs/stack", "refs/heads", 1)
baseref = baseref.replacen("refs/stack/for", "refs/heads", 1)
}
if baseref.starts_with("refs/split") {
if baseref.starts_with("refs/split/for") {
push_mode = PushMode::Split;
baseref = baseref.replacen("refs/split", "refs/heads", 1)
baseref = baseref.replacen("refs/split/for", "refs/heads", 1)
}
Ok((baseref, push_to, options, push_mode))
}
Expand Down
18 changes: 9 additions & 9 deletions tests/proxy/push_stacked.t
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@
* Change-Id: foo7 (HEAD -> master)
* Change-Id: 1234
* add file1 (origin/master, origin/HEAD)
$ git push -o author=foo@example.com origin master:refs/stack/master
$ git push -o author=foo@example.com origin master:refs/stack/for/master
remote: josh-proxy
remote: response from upstream:
remote: To http://localhost:8001/real_repo.git
remote: * [new branch] master -> @heads/master/foo@example.com
remote:
remote:
To http://localhost:8002/real_repo.git
* [new reference] master -> refs/stack/master
$ git push -o author=josh@example.com origin master:refs/stack/master
* [new reference] master -> refs/stack/for/master
$ git push -o author=josh@example.com origin master:refs/stack/for/master
remote: josh-proxy
remote: response from upstream:
remote: To http://localhost:8001/real_repo.git
Expand All @@ -50,30 +50,30 @@
remote:
remote:
To http://localhost:8002/real_repo.git
* [new reference] master -> refs/stack/master
* [new reference] master -> refs/stack/for/master
$ echo contents2 > file3
$ git add file3
$ git commit -m "add file3" 1> /dev/null
$ git push -o author=josh@example.com origin master:refs/stack/master
$ git push -o author=josh@example.com origin master:refs/stack/for/master
remote: josh-proxy
remote: response from upstream:
remote: rejecting to push 3ad32b3bd3bb778441e7eae43930d8dc6293eddc without Change-Id
remote:
remote:
remote: error: hook declined to update refs/stack/master
remote: error: hook declined to update refs/stack/for/master
To http://localhost:8002/real_repo.git
! [remote rejected] master -> refs/stack/master (hook declined)
! [remote rejected] master -> refs/stack/for/master (hook declined)
error: failed to push some refs to 'http://localhost:8002/real_repo.git'
[1]
$ git push -o author=foo@example.com origin master:refs/stack/master
$ git push -o author=foo@example.com origin master:refs/stack/for/master
remote: josh-proxy
remote: response from upstream:
remote: To http://localhost:8001/real_repo.git
remote: ec41aad..3ad32b3 master -> @heads/master/foo@example.com
remote:
remote:
To http://localhost:8002/real_repo.git
* [new reference] master -> refs/stack/master
* [new reference] master -> refs/stack/for/master

$ curl -s http://localhost:8002/flush
Flushed credential cache
Expand Down
4 changes: 2 additions & 2 deletions tests/proxy/push_stacked_split.t
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* Change-Id: foo7
* Change-Id: 1234
* add file1 (origin/master, origin/HEAD)
$ git push -o split -o author=josh@example.com origin master:refs/split/master
$ git push -o split -o author=josh@example.com origin master:refs/split/for/master
remote: josh-proxy
remote: response from upstream:
remote: To http://localhost:8001/real_repo.git
Expand All @@ -47,7 +47,7 @@
remote:
remote:
To http://localhost:8002/real_repo.git
* [new reference] master -> refs/split/master
* [new reference] master -> refs/split/for/master

$ curl -s http://localhost:8002/flush
Flushed credential cache
Expand Down
20 changes: 10 additions & 10 deletions tests/proxy/push_stacked_sub.t
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Change-Id: foo7 (HEAD -> master)
* Change-Id: 1234
* add file1 (origin/master, origin/HEAD)
$ git push -o author=josh@example.com origin master:refs/stack/master
$ git push -o author=josh@example.com origin master:refs/stack/for/master
remote: josh-proxy
remote: response from upstream:
remote: To http://localhost:8001/real_repo.git
Expand All @@ -40,8 +40,8 @@
remote:
remote:
To http://localhost:8002/real_repo.git:/sub1.git
* [new reference] master -> refs/stack/master
$ git push -o author=josh@example.com origin master:refs/stack/other_branch
* [new reference] master -> refs/stack/for/master
$ git push -o author=josh@example.com origin master:refs/stack/for/other_branch
remote: josh-proxy
remote: response from upstream:
remote: Reference "refs/heads/other_branch" does not exist on remote.
Expand All @@ -50,12 +50,12 @@
remote:
remote:
remote:
remote: error: hook declined to update refs/stack/other_branch
remote: error: hook declined to update refs/stack/for/other_branch
To http://localhost:8002/real_repo.git:/sub1.git
! [remote rejected] master -> refs/stack/other_branch (hook declined)
! [remote rejected] master -> refs/stack/for/other_branch (hook declined)
error: failed to push some refs to 'http://localhost:8002/real_repo.git:/sub1.git'
[1]
$ git push -o base=master -o author=josh@example.com origin master:refs/stack/other_branch
$ git push -o base=master -o author=josh@example.com origin master:refs/stack/for/other_branch
remote: josh-proxy
remote: response from upstream:
remote: To http://localhost:8001/real_repo.git
Expand All @@ -67,19 +67,19 @@
remote:
remote:
To http://localhost:8002/real_repo.git:/sub1.git
* [new reference] master -> refs/stack/other_branch
* [new reference] master -> refs/stack/for/other_branch
$ echo contents2 > file3
$ git add file3
$ git commit -m "add file3" 1> /dev/null
$ git push -o author=josh@example.com origin master:refs/stack/master
$ git push -o author=josh@example.com origin master:refs/stack/for/master
remote: josh-proxy
remote: response from upstream:
remote: rejecting to push a3065162ecee0fecc977ec04a275e10b5e15a39c without Change-Id
remote:
remote:
remote: error: hook declined to update refs/stack/master
remote: error: hook declined to update refs/stack/for/master
To http://localhost:8002/real_repo.git:/sub1.git
! [remote rejected] master -> refs/stack/master (hook declined)
! [remote rejected] master -> refs/stack/for/master (hook declined)
error: failed to push some refs to 'http://localhost:8002/real_repo.git:/sub1.git'
[1]

Expand Down