1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-16 22:14:53 +01:00
git/builtin
Junio C Hamano ba3c69a9ee commit: teach --gpg-sign option
This uses the gpg-interface.[ch] to allow signing the commit, i.e.

    $ git commit --gpg-sign -m foo
    You need a passphrase to unlock the secret key for
    user: "Junio C Hamano <gitster@pobox.com>"
    4096-bit RSA key, ID 96AFE6CB, created 2011-10-03 (main key ID 713660A7)

    [master 8457d13] foo
     1 files changed, 1 insertions(+), 0 deletions(-)

The lines of GPG detached signature are placed in a new multi-line header
field, instead of tucking the signature block at the end of the commit log
message text (similar to how signed tag is done), for multiple reasons:

 - The signature won't clutter output from "git log" and friends if it is
   in the extra header. If we place it at the end of the log message, we
   would need to teach "git log" and friends to strip the signature block
   with an option.

 - Teaching new versions of "git log" and "gitk" to optionally verify and
   show signatures is cleaner if we structurally know where the signature
   block is (instead of scanning in the commit log message).

 - The signature needs to be stripped upon various commit rewriting
   operations, e.g. rebase, filter-branch, etc. They all already ignore
   unknown headers, but if we place signature in the log message, all of
   these tools (and third-party tools) also need to learn how a signature
   block would look like.

 - When we added the optional encoding header, all the tools (both in tree
   and third-party) that acts on the raw commit object should have been
   fixed to ignore headers they do not understand, so it is not like that
   new header would be more likely to break than extra text in the commit.

A commit made with the above sample sequence would look like this:

    $ git cat-file commit HEAD
    tree 3cd71d90e3db4136e5260ab54599791c4f883b9d
    parent b87755351a47b09cb27d6913e6e0e17e6254a4d4
    author Junio C Hamano <gitster@pobox.com> 1317862251 -0700
    committer Junio C Hamano <gitster@pobox.com> 1317862251 -0700
    gpgsig -----BEGIN PGP SIGNATURE-----
     Version: GnuPG v1.4.10 (GNU/Linux)

     iQIcBAABAgAGBQJOjPtrAAoJELC16IaWr+bL4TMP/RSe2Y/jYnCkds9unO5JEnfG
     ...
     =dt98
     -----END PGP SIGNATURE-----

    foo

but "git log" (unless you ask for it with --pretty=raw) output is not
cluttered with the signature information.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-12 22:27:37 -08:00
..
add.c
annotate.c
apply.c Merge branch 'jm/maint-apply-detects-corrupt-patch-header' 2011-10-19 10:48:29 -07:00
archive.c Merge branch 'il/archive-err-signal' 2011-10-13 19:03:23 -07:00
bisect--helper.c
blame.c
branch.c Merge branch 'mg/branch-list' 2011-10-05 12:36:23 -07:00
bundle.c Teach progress eye-candy to fetch_refs_from_bundle() 2011-09-19 11:07:21 -07:00
cat-file.c
check-attr.c Merge branch 'bc/attr-ignore-case' 2011-10-17 21:37:14 -07:00
check-ref-format.c Change check_refname_format() to reject unnormalized refnames 2011-10-05 13:45:30 -07:00
checkout-index.c
checkout.c Merge branch 'jc/checkout-from-tree-keep-local-changes' 2011-10-17 21:37:09 -07:00
clean.c Documentation: clarify "git clean -e <pattern>" 2011-08-28 23:47:55 -07:00
clone.c Merge branch 'nd/maint-clone-gitdir' 2011-08-28 21:20:28 -07:00
commit-tree.c commit: teach --gpg-sign option 2011-11-12 22:27:37 -08:00
commit.c commit: teach --gpg-sign option 2011-11-12 22:27:37 -08:00
config.c Merge branch 'mm/maint-config-explicit-bool-display' 2011-10-17 21:37:12 -07:00
count-objects.c
describe.c
diff-files.c
diff-index.c
diff-tree.c
diff.c want_color: automatically fallback to color.ui 2011-08-19 15:51:38 -07:00
fast-export.c
fetch-pack.c Merge branch 'mh/check-ref-format-3' 2011-10-10 15:56:18 -07:00
fetch.c fetch: do not store peeled tag object names in FETCH_HEAD 2011-11-04 21:40:25 -07:00
fmt-merge-msg.c fmt-merge-msg: Add contents of merged tag in the merge message 2011-11-08 10:36:18 -08:00
for-each-ref.c for-each-ref: add split message parts to %(contents:*). 2011-09-08 13:56:19 -07:00
fsck.c fsck: do not abort upon finding an empty blob 2011-09-11 18:03:38 -07:00
gc.c
grep.c Merge branch 'jc/grep-untracked-exclude' 2011-10-15 20:27:19 -07:00
hash-object.c
help.c
index-pack.c
init-db.c read_gitfile_gently(): rename misnamed function to read_gitfile() 2011-08-22 14:04:56 -07:00
log.c format-patch: ignore ui.color 2011-09-12 11:43:58 -07:00
ls-files.c Merge branch 'cb/common-prefix-unification' 2011-10-10 15:56:17 -07:00
ls-remote.c Merge branch 'jc/ls-remote-short-help' 2011-10-05 12:36:26 -07:00
ls-tree.c
mailinfo.c
mailsplit.c
merge-base.c
merge-file.c
merge-index.c
merge-ours.c
merge-recursive.c
merge-tree.c
merge.c commit: teach --gpg-sign option 2011-11-12 22:27:37 -08:00
mktag.c
mktree.c
mv.c builtin/mv.c: plug miniscule memory leak 2011-10-06 13:54:32 -07:00
name-rev.c name-rev: split usage string 2011-10-03 11:55:57 -07:00
notes.c
pack-objects.c Merge branch 'jc/fetch-verify' 2011-10-05 12:36:20 -07:00
pack-redundant.c
pack-refs.c
patch-id.c patch-id.c: use strbuf instead of a fixed buffer 2011-09-22 09:35:07 -07:00
prune-packed.c
prune.c
push.c push: Don't push a repository with unpushed submodules 2011-08-20 23:03:52 -07:00
read-tree.c
receive-pack.c Merge branch 'ph/push-to-delete-nothing' 2011-10-17 21:37:10 -07:00
reflog.c
remote-ext.c
remote-fd.c
remote.c Merge branch 'mz/remote-rename' 2011-10-10 15:56:17 -07:00
replace.c Change check_ref_format() to take a flags argument 2011-10-05 13:45:29 -07:00
rerere.c
reset.c Merge branch 'jk/reset-reflog-message-fix' into maint 2011-09-11 22:33:20 -07:00
rev-list.c rev-list --verify-object 2011-09-01 15:46:13 -07:00
rev-parse.c
revert.c Merge branch 'js/no-cherry-pick-head-after-punted' 2011-10-19 10:49:05 -07:00
rm.c
send-pack.c Revert "Merge branch 'cb/maint-quiet-push' into maint" 2011-09-06 11:10:41 -07:00
shortlog.c
show-branch.c want_color: automatically fallback to color.ui 2011-08-19 15:51:38 -07:00
show-ref.c Change check_ref_format() to take a flags argument 2011-10-05 13:45:29 -07:00
stripspace.c
symbolic-ref.c
tag.c Split GPG interface into its own helper library 2011-11-04 21:40:25 -07:00
tar-tree.c
unpack-file.c
unpack-objects.c
update-index.c
update-ref.c update-ref: whitespace fix 2011-08-25 14:42:11 -07:00
update-server-info.c
upload-archive.c
var.c
verify-pack.c
verify-tag.c Split GPG interface into its own helper library 2011-11-04 21:40:25 -07:00
write-tree.c