Code

Merge branch 'jh/notes' (early part)
authorJunio C Hamano <gitster@pobox.com>
Sat, 21 Nov 2009 07:53:55 +0000 (23:53 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 21 Nov 2009 07:53:55 +0000 (23:53 -0800)
* 'jh/notes' (early part):
  Add selftests verifying concatenation of multiple notes for the same commit
  Refactor notes code to concatenate multiple notes annotating the same object
  Add selftests verifying that we can parse notes trees with various fanouts
  Teach the notes lookup code to parse notes trees with various fanout schemes
  Teach notes code to free its internal data structures on request
  Add '%N'-format for pretty-printing commit notes
  Add flags to get_commit_notes() to control the format of the note string
  t3302-notes-index-expensive: Speed up create_repo()
  fast-import: Add support for importing commit notes
  Teach "-m <msg>" and "-F <file>" to "git notes edit"
  Add an expensive test for git-notes
  Speed up git notes lookup
  Add a script to edit/inspect notes
  Introduce commit notes

Conflicts:
.gitignore
Documentation/pretty-formats.txt
pretty.c

1  2 
.gitignore
Documentation/config.txt
Documentation/pretty-formats.txt
Makefile
cache.h
command-list.txt
commit.c
fast-import.c
pretty.c

diff --cc .gitignore
index f63992a6cca190f1b226f746dfc815e7399f47b5,cbafa64b44905ec61a643b1b1b3dfe3c04ff3e38..ac02a580daf07150b03194a5a0de522ac1e3415d
 -GIT-BUILD-OPTIONS
 -GIT-CFLAGS
 -GIT-GUI-VARS
 -GIT-VERSION-FILE
 -git
 -git-add
 -git-add--interactive
 -git-am
 -git-annotate
 -git-apply
 -git-archimport
 -git-archive
 -git-bisect
 -git-bisect--helper
 -git-blame
 -git-branch
 -git-bundle
 -git-cat-file
 -git-check-attr
 -git-check-ref-format
 -git-checkout
 -git-checkout-index
 -git-cherry
 -git-cherry-pick
 -git-clean
 -git-clone
 -git-commit
 -git-commit-tree
 -git-config
 -git-count-objects
 -git-cvsexportcommit
 -git-cvsimport
 -git-cvsserver
 -git-daemon
 -git-diff
 -git-diff-files
 -git-diff-index
 -git-diff-tree
 -git-difftool
 -git-difftool--helper
 -git-describe
 -git-fast-export
 -git-fast-import
 -git-fetch
 -git-fetch--tool
 -git-fetch-pack
 -git-filter-branch
 -git-fmt-merge-msg
 -git-for-each-ref
 -git-format-patch
 -git-fsck
 -git-fsck-objects
 -git-gc
 -git-get-tar-commit-id
 -git-grep
 -git-hash-object
 -git-help
 -git-http-fetch
 -git-http-push
 -git-imap-send
 -git-index-pack
 -git-init
 -git-init-db
 -git-instaweb
 -git-log
 -git-lost-found
 -git-ls-files
 -git-ls-remote
 -git-ls-tree
 -git-mailinfo
 -git-mailsplit
 -git-merge
 -git-merge-base
 -git-merge-index
 -git-merge-file
 -git-merge-tree
 -git-merge-octopus
 -git-merge-one-file
 -git-merge-ours
 -git-merge-recursive
 -git-merge-resolve
 -git-merge-subtree
 -git-mergetool
 -git-mergetool--lib
 -git-mktag
 -git-mktree
 -git-name-rev
 -git-mv
 -git-notes
 -git-pack-redundant
 -git-pack-objects
 -git-pack-refs
 -git-parse-remote
 -git-patch-id
 -git-peek-remote
 -git-prune
 -git-prune-packed
 -git-pull
 -git-push
 -git-quiltimport
 -git-read-tree
 -git-rebase
 -git-rebase--interactive
 -git-receive-pack
 -git-reflog
 -git-relink
 -git-remote
 -git-remote-curl
 -git-repack
 -git-replace
 -git-repo-config
 -git-request-pull
 -git-rerere
 -git-reset
 -git-rev-list
 -git-rev-parse
 -git-revert
 -git-rm
 -git-send-email
 -git-send-pack
 -git-sh-setup
 -git-shell
 -git-shortlog
 -git-show
 -git-show-branch
 -git-show-index
 -git-show-ref
 -git-stage
 -git-stash
 -git-status
 -git-stripspace
 -git-submodule
 -git-svn
 -git-symbolic-ref
 -git-tag
 -git-tar-tree
 -git-unpack-file
 -git-unpack-objects
 -git-update-index
 -git-update-ref
 -git-update-server-info
 -git-upload-archive
 -git-upload-pack
 -git-var
 -git-verify-pack
 -git-verify-tag
 -git-web--browse
 -git-whatchanged
 -git-write-tree
 -git-core-*/?*
 -gitk-wish
 -gitweb/gitweb.cgi
 -test-chmtime
 -test-ctype
 -test-date
 -test-delta
 -test-dump-cache-tree
 -test-genrandom
 -test-match-trees
 -test-parse-options
 -test-path-utils
 -test-sha1
 -test-sigchain
 -common-cmds.h
 +/GIT-BUILD-OPTIONS
 +/GIT-CFLAGS
 +/GIT-GUI-VARS
 +/GIT-VERSION-FILE
 +/git
 +/git-add
 +/git-add--interactive
 +/git-am
 +/git-annotate
 +/git-apply
 +/git-archimport
 +/git-archive
 +/git-bisect
 +/git-bisect--helper
 +/git-blame
 +/git-branch
 +/git-bundle
 +/git-cat-file
 +/git-check-attr
 +/git-check-ref-format
 +/git-checkout
 +/git-checkout-index
 +/git-cherry
 +/git-cherry-pick
 +/git-clean
 +/git-clone
 +/git-commit
 +/git-commit-tree
 +/git-config
 +/git-count-objects
 +/git-cvsexportcommit
 +/git-cvsimport
 +/git-cvsserver
 +/git-daemon
 +/git-diff
 +/git-diff-files
 +/git-diff-index
 +/git-diff-tree
 +/git-difftool
 +/git-difftool--helper
 +/git-describe
 +/git-fast-export
 +/git-fast-import
 +/git-fetch
 +/git-fetch--tool
 +/git-fetch-pack
 +/git-filter-branch
 +/git-fmt-merge-msg
 +/git-for-each-ref
 +/git-format-patch
 +/git-fsck
 +/git-fsck-objects
 +/git-gc
 +/git-get-tar-commit-id
 +/git-grep
 +/git-hash-object
 +/git-help
 +/git-http-backend
 +/git-http-fetch
 +/git-http-push
 +/git-imap-send
 +/git-index-pack
 +/git-init
 +/git-init-db
 +/git-instaweb
 +/git-log
 +/git-lost-found
 +/git-ls-files
 +/git-ls-remote
 +/git-ls-tree
 +/git-mailinfo
 +/git-mailsplit
 +/git-merge
 +/git-merge-base
 +/git-merge-index
 +/git-merge-file
 +/git-merge-tree
 +/git-merge-octopus
 +/git-merge-one-file
 +/git-merge-ours
 +/git-merge-recursive
 +/git-merge-resolve
 +/git-merge-subtree
 +/git-mergetool
 +/git-mergetool--lib
 +/git-mktag
 +/git-mktree
 +/git-name-rev
 +/git-mv
++/git-notes
 +/git-pack-redundant
 +/git-pack-objects
 +/git-pack-refs
 +/git-parse-remote
 +/git-patch-id
 +/git-peek-remote
 +/git-prune
 +/git-prune-packed
 +/git-pull
 +/git-push
 +/git-quiltimport
 +/git-read-tree
 +/git-rebase
 +/git-rebase--interactive
 +/git-receive-pack
 +/git-reflog
 +/git-relink
 +/git-remote
 +/git-remote-curl
 +/git-repack
 +/git-replace
 +/git-repo-config
 +/git-request-pull
 +/git-rerere
 +/git-reset
 +/git-rev-list
 +/git-rev-parse
 +/git-revert
 +/git-rm
 +/git-send-email
 +/git-send-pack
 +/git-sh-setup
 +/git-shell
 +/git-shortlog
 +/git-show
 +/git-show-branch
 +/git-show-index
 +/git-show-ref
 +/git-stage
 +/git-stash
 +/git-status
 +/git-stripspace
 +/git-submodule
 +/git-svn
 +/git-symbolic-ref
 +/git-tag
 +/git-tar-tree
 +/git-unpack-file
 +/git-unpack-objects
 +/git-update-index
 +/git-update-ref
 +/git-update-server-info
 +/git-upload-archive
 +/git-upload-pack
 +/git-var
 +/git-verify-pack
 +/git-verify-tag
 +/git-web--browse
 +/git-whatchanged
 +/git-write-tree
 +/git-core-*/?*
 +/gitk-git/gitk-wish
 +/gitweb/gitweb.cgi
 +/test-chmtime
 +/test-ctype
 +/test-date
 +/test-delta
 +/test-dump-cache-tree
 +/test-genrandom
 +/test-match-trees
 +/test-parse-options
 +/test-path-utils
 +/test-sha1
 +/test-sigchain
 +/common-cmds.h
  *.tar.gz
  *.dsc
  *.deb
Simple merge
index 38b9904791466152a98ab3df7c5b84ac66dbac73,5fb10b3a1525dabd0f0e75835847a6187fa99a30..09462021ead2591ae1f21f4441ff0bc357af2a1c
@@@ -123,9 -123,7 +123,10 @@@ The placeholders are
  - '%s': subject
  - '%f': sanitized subject line, suitable for a filename
  - '%b': body
+ - '%N': commit notes
 +- '%gD': reflog selector, e.g., `refs/stash@\{1\}`
 +- '%gd': shortened reflog selector, e.g., `stash@\{1\}`
 +- '%gs': reflog subject
  - '%Cred': switch color to red
  - '%Cgreen': switch color to green
  - '%Cblue': switch color to blue
diff --cc Makefile
Simple merge
diff --cc cache.h
Simple merge
Simple merge
diff --cc commit.c
Simple merge
diff --cc fast-import.c
Simple merge
diff --cc pretty.c
index 2e031e62fd98c02bfa6cc558fc49aef86c03ed09,7f350bbdff050041f541d227de6bfe20ec7fe510..5661cba5952e2e68dd067a8afebe144bc1ca63af
+++ b/pretty.c
@@@ -6,8 -6,8 +6,9 @@@
  #include "string-list.h"
  #include "mailmap.h"
  #include "log-tree.h"
+ #include "notes.h"
  #include "color.h"
 +#include "reflog-walk.h"
  
  static char *user_format;
  
@@@ -757,22 -702,10 +758,26 @@@ static size_t format_commit_item(struc
        case 'd':
                format_decoration(sb, commit);
                return 1;
 +      case 'g':               /* reflog info */
 +              switch(placeholder[1]) {
 +              case 'd':       /* reflog selector */
 +              case 'D':
 +                      if (c->pretty_ctx->reflog_info)
 +                              get_reflog_selector(sb,
 +                                                  c->pretty_ctx->reflog_info,
 +                                                  c->pretty_ctx->date_mode,
 +                                                  (placeholder[1] == 'd'));
 +                      return 2;
 +              case 's':       /* reflog message */
 +                      if (c->pretty_ctx->reflog_info)
 +                              get_reflog_message(sb, c->pretty_ctx->reflog_info);
 +                      return 2;
 +              }
 +              return 0;       /* unknown %g placeholder */
+       case 'N':
+               get_commit_notes(commit, sb, git_log_output_encoding ?
+                            git_log_output_encoding : git_commit_encoding, 0);
+               return 1;
        }
  
        /* For the rest we have to parse the commit header. */