comparison tests/test-git-gpg.t @ 1108:aae2d15de6af

git_handler: store gpgsig header to maintain commit coherence
author Tony Tung <ttung@chanzuckerberg.com <mailto:ttung@chanzuckerberg.com>>
date Tue, 06 Feb 2018 17:04:24 -0800
parents
children
comparison
equal deleted inserted replaced
1107:327d12aeb560 1108:aae2d15de6af
1 #require gpg
2
3 Load commonly used test logic
4 $ . "$TESTDIR/testutil"
5
6 $ export GNUPGHOME="$(mktemp -d)"
7 $ cp -R "$TESTDIR"/gpg/* "$GNUPGHOME"
8
9 Start gpg-agent, which is required by GnuPG v2
10
11 #if gpg21
12 $ gpg-connect-agent -q --subst /serverpid '/echo ${get serverpid}' /bye \
13 > >> $DAEMON_PIDS
14 #endif
15
16 and migrate secret keys
17
18 #if gpg2
19 $ gpg --no-permission-warning --no-secmem-warning --list-secret-keys \
20 > > /dev/null 2>&1
21 #endif
22
23 $ alias gpg='gpg --no-permission-warning --no-secmem-warning --no-auto-check-trustdb'
24
25 Set up two identical git repos.
26
27 $ mkdir gitrepo
28 $ cd gitrepo
29 $ git init
30 Initialized empty Git repository in $TESTTMP/gitrepo/.git/
31 $ touch a
32 $ git add a
33 $ git commit -m "initial commit"
34 [master (root-commit) *] initial commit (glob)
35 1 file changed, 0 insertions(+), 0 deletions(-)
36 create mode 100644 a
37 $ cd ..
38 $ git clone gitrepo gitrepo2
39 Cloning into 'gitrepo2'...
40 done.
41
42 Add a signed commit to the first clone.
43
44 $ cd gitrepo
45 $ git checkout -b signed
46 Switched to a new branch 'signed'
47 $ touch b
48 $ git add b
49 $ git commit -m "message" -Shgtest
50 [signed *] message (glob)
51 1 file changed, 0 insertions(+), 0 deletions(-)
52 create mode 100644 b
53 $ cd ..
54
55 Hg clone it
56
57 $ hg clone gitrepo hgrepo
58 importing git objects into hg
59 updating to branch default
60 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
61
62 $ cd hgrepo
63 $ hg push ../gitrepo2 -B signed
64 pushing to ../gitrepo2
65 searching for changes
66 adding objects
67 added 1 commits with 1 trees and 0 blobs
68 $ cd ..
69
70 Verify the commit
71
72 $ cd gitrepo2
73 $ git show --show-signature signed | grep "Good signature from"
74 gpg: Good signature from "hgtest" [ultimate]