Skip to content
Open
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
6 changes: 1 addition & 5 deletions josh-core/src/changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,7 @@ pub fn changes_to_refs(
change.commit
)));
}
} else {
return Err(josh_error(&format!(
"rejecting to push {:?} without id",
change.commit
)));
seen.insert(id);
}
}

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 @@ -56,15 +56,15 @@
$ git commit -m "add file3" 1> /dev/null
$ git push -o author=josh@example.com origin master:refs/stack/for/master
remote: josh-proxy: pre-receive hook
remote: upstream: response status: 500 Internal Server Error
remote: upstream: response status: 200 OK
remote: upstream: response body:
remote:
remote: rejecting to push 3ad32b3bd3bb778441e7eae43930d8dc6293eddc without id
remote: error: hook declined to update refs/stack/for/master
remote: Everything up-to-date
remote: Everything up-to-date
remote: To http://localhost:8001/real_repo.git
remote: ec41aad..3ad32b3 master -> @heads/master/josh@example.com
To http://localhost:8002/real_repo.git
! [remote rejected] master -> refs/stack/for/master (hook declined)
error: failed to push some refs to 'http://localhost:8002/real_repo.git'
[1]
* [new reference] master -> refs/stack/for/master
$ git push -o author=foo@example.com origin master:refs/stack/for/master
remote: josh-proxy: pre-receive hook
remote: upstream: response status: 200 OK
Expand All @@ -85,8 +85,8 @@
* [new branch] @heads/master/josh@example.com -> origin/@heads/master/josh@example.com

$ git log --decorate --graph --pretty="%s %d"
* add file3 (HEAD -> master, origin/@heads/master/foo@example.com)
* Change-Id: foo7 (origin/@heads/master/josh@example.com, origin/@changes/master/josh@example.com/foo7)
* add file3 (HEAD -> master, origin/@heads/master/josh@example.com, origin/@heads/master/foo@example.com)
* Change-Id: foo7 (origin/@changes/master/josh@example.com/foo7)
* Change-Id: 1234 (origin/@changes/master/josh@example.com/1234)
* add file1 (origin/master, origin/HEAD)

Expand Down Expand Up @@ -119,7 +119,7 @@ get listed if they differ from HEAD
3b0e3dbefd779ec54d92286047f32d3129161c0d\trefs/heads/@changes/master/josh@example.com/1234 (esc)
ec41aad70b4b898baf48efeb795a7753d9674152\trefs/heads/@changes/master/josh@example.com/foo7 (esc)
3ad32b3bd3bb778441e7eae43930d8dc6293eddc\trefs/heads/@heads/master/foo@example.com (esc)
ec41aad70b4b898baf48efeb795a7753d9674152\trefs/heads/@heads/master/josh@example.com (esc)
3ad32b3bd3bb778441e7eae43930d8dc6293eddc\trefs/heads/@heads/master/josh@example.com (esc)
4950fa502f51b7bfda0d7975dbff9b0f9a9481ca\trefs/heads/master (esc)

$ git ls-remote http://localhost:8002/real_repo.git:/sub1.git
Expand Down
22 changes: 12 additions & 10 deletions tests/proxy/push_stacked_gerrit.t
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,17 @@
$ git commit -m "add file3" 1> /dev/null
$ git push -o author=josh@example.com origin master:refs/for/master
remote: josh-proxy: pre-receive hook
remote: upstream: response status: 500 Internal Server Error
remote: upstream: response status: 200 OK
remote: upstream: response body:
remote:
remote: rejecting to push 3ad32b3bd3bb778441e7eae43930d8dc6293eddc without id
remote: error: hook declined to update refs/for/master
remote: Everything up-to-date
remote: Everything up-to-date
remote: To http://localhost:8001/real_repo.git
remote: ec41aad..3ad32b3 JOSH_PUSH -> refs/for/master
remote: To http://localhost:8001/real_repo.git
remote: ec41aad..3ad32b3 master -> @heads/master/josh@example.com
To http://localhost:8002/real_repo.git
! [remote rejected] master -> refs/for/master (hook declined)
error: failed to push some refs to 'http://localhost:8002/real_repo.git'
[1]
* [new reference] master -> refs/for/master
$ git push http://localhost:8001/real_repo.git :refs/for/master
To http://localhost:8001/real_repo.git
- [deleted] refs/for/master
Expand All @@ -97,8 +99,8 @@
* [new branch] @heads/master/josh@example.com -> origin/@heads/master/josh@example.com

$ git log --decorate --graph --pretty="%s %d"
* add file3 (HEAD -> master, origin/@heads/master/foo@example.com)
* Change-Id: foo7 (origin/@heads/master/josh@example.com, origin/@changes/master/josh@example.com/foo7)
* add file3 (HEAD -> master, origin/@heads/master/josh@example.com, origin/@heads/master/foo@example.com)
* Change-Id: foo7 (origin/@changes/master/josh@example.com/foo7)
* Change-Id: 1234 (origin/@changes/master/josh@example.com/1234)
* add file1 (origin/master, origin/HEAD)

Expand All @@ -111,8 +113,8 @@
* [new branch] @heads/master/josh@example.com -> origin/@heads/master/josh@example.com
$ git checkout -q @heads/master/foo@example.com
$ git log --decorate --graph --pretty="%s %d"
* add file3 (HEAD -> @heads/master/foo@example.com, origin/@heads/master/foo@example.com)
* Change-Id: foo7 (origin/@heads/master/josh@example.com, origin/@changes/master/josh@example.com/foo7)
* add file3 (HEAD -> @heads/master/foo@example.com, origin/@heads/master/josh@example.com, origin/@heads/master/foo@example.com)
* Change-Id: foo7 (origin/@changes/master/josh@example.com/foo7)
* Change-Id: 1234 (origin/@changes/master/josh@example.com/1234)
* add file1 (origin/master, origin/HEAD, master)

Expand Down
24 changes: 15 additions & 9 deletions tests/proxy/push_stacked_sub.t
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@
$ git commit -m "add file3" 1> /dev/null
$ git push -o author=josh@example.com origin master:refs/stack/for/master
remote: josh-proxy: pre-receive hook
remote: upstream: response status: 500 Internal Server Error
remote: upstream: response status: 200 OK
remote: upstream: response body:
remote:
remote: rejecting to push a3065162ecee0fecc977ec04a275e10b5e15a39c without id
remote: error: hook declined to update refs/stack/for/master
remote: Everything up-to-date
remote: Everything up-to-date
remote: To http://localhost:8001/real_repo.git
remote: 2bb9471..a306516 master -> @heads/master/josh@example.com
To http://localhost:8002/real_repo.git:/sub1.git
! [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]
* [new reference] master -> refs/stack/for/master

$ curl -s http://localhost:8002/flush
Flushed credential cache
Expand All @@ -94,8 +94,8 @@
* [new branch] @heads/master/josh@example.com -> origin/@heads/master/josh@example.com
* [new branch] @heads/other_branch/josh@example.com -> origin/@heads/other_branch/josh@example.com
$ git log --decorate --graph --pretty="%s %d"
* add file3 (HEAD -> master)
* Change-Id: foo7 (origin/@heads/other_branch/josh@example.com, origin/@heads/master/josh@example.com, origin/@changes/other_branch/josh@example.com/foo7, origin/@changes/master/josh@example.com/foo7)
* add file3 (HEAD -> master, origin/@heads/master/josh@example.com)
* Change-Id: foo7 (origin/@heads/other_branch/josh@example.com, origin/@changes/other_branch/josh@example.com/foo7, origin/@changes/master/josh@example.com/foo7)
* Change-Id: 1234 (origin/@changes/other_branch/josh@example.com/1234, origin/@changes/master/josh@example.com/1234)
* add file1 (origin/master, origin/HEAD)

Expand Down Expand Up @@ -151,15 +151,21 @@ Make sure all temporary namespace got removed
| | | `-- 77ff51363c9825cc2a221fc0ba5a883a1a2c72
| | |-- 6b
| | | `-- 46faacade805991bcaea19382c9d941828ce80
| | |-- 88
| | | `-- 2b84c5d3241087bc41982a744b72b7a174c49e
| | |-- a0
| | | `-- 24003ee1acc6bf70318a46e7b6df651b9dc246
| | |-- a3
| | | `-- 065162ecee0fecc977ec04a275e10b5e15a39c
| | |-- b2
| | | `-- ea883bc5df63565960a38cad7a57f73ac66eaa
| | |-- ba
| | | |-- 7e17233d9f79c96cb694959eb065302acd96a6
| | | `-- c8af20b53d712874a32944874c66a21afa91f9
| | |-- bb
| | | `-- 282e9cdc1b972fffd08fd21eead43bc0c83cb8
| | |-- be
| | | `-- 33ab805ad4ef7ddda5b51e4a78ec0fac6b699a
| | |-- c6
| | | `-- 27a2e3a6bfbb7307f522ad94fdfc8c20b92967
| | |-- c8
Expand Down Expand Up @@ -233,7 +239,7 @@ Make sure all temporary namespace got removed
|-- namespaces
`-- tags

58 directories, 44 files
61 directories, 47 files

$ cat ${TESTTMP}/josh-proxy.out
$ cat ${TESTTMP}/josh-proxy.out | grep REPO_UPDATE
Expand Down