Merge branch 'tb/diff-tree-with-notes'
"git diff-tree --pretty --notes" used to hit an assertion failure, as it forgot to initialize the notes subsystem. * tb/diff-tree-with-notes: diff-tree.c: load notes machinery when requiredmaint
commit
5a96715eb7
|
@ -109,6 +109,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
|
||||||
struct object *tree1, *tree2;
|
struct object *tree1, *tree2;
|
||||||
static struct rev_info *opt = &log_tree_opt;
|
static struct rev_info *opt = &log_tree_opt;
|
||||||
struct setup_revision_opt s_r_opt;
|
struct setup_revision_opt s_r_opt;
|
||||||
|
struct userformat_want w;
|
||||||
int read_stdin = 0;
|
int read_stdin = 0;
|
||||||
|
|
||||||
if (argc == 2 && !strcmp(argv[1], "-h"))
|
if (argc == 2 && !strcmp(argv[1], "-h"))
|
||||||
|
@ -127,6 +128,14 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
|
||||||
precompose_argv(argc, argv);
|
precompose_argv(argc, argv);
|
||||||
argc = setup_revisions(argc, argv, opt, &s_r_opt);
|
argc = setup_revisions(argc, argv, opt, &s_r_opt);
|
||||||
|
|
||||||
|
memset(&w, 0, sizeof(w));
|
||||||
|
userformat_find_requirements(NULL, &w);
|
||||||
|
|
||||||
|
if (!opt->show_notes_given && w.notes)
|
||||||
|
opt->show_notes = 1;
|
||||||
|
if (opt->show_notes)
|
||||||
|
load_display_notes(&opt->notes_opt);
|
||||||
|
|
||||||
while (--argc > 0) {
|
while (--argc > 0) {
|
||||||
const char *arg = *++argv;
|
const char *arg = *++argv;
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,15 @@ test_expect_success setup '
|
||||||
git commit -m "update mode" &&
|
git commit -m "update mode" &&
|
||||||
git checkout -f master &&
|
git checkout -f master &&
|
||||||
|
|
||||||
|
GIT_AUTHOR_DATE="2006-06-26 00:06:00 +0000" &&
|
||||||
|
GIT_COMMITTER_DATE="2006-06-26 00:06:00 +0000" &&
|
||||||
|
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
|
||||||
|
git checkout -b note initial &&
|
||||||
|
git update-index --chmod=+x file2 &&
|
||||||
|
git commit -m "update mode (file2)" &&
|
||||||
|
git notes add -m "note" &&
|
||||||
|
git checkout -f master &&
|
||||||
|
|
||||||
# Same merge as master, but with parents reversed. Hide it in a
|
# Same merge as master, but with parents reversed. Hide it in a
|
||||||
# pseudo-ref to avoid impacting tests with --all.
|
# pseudo-ref to avoid impacting tests with --all.
|
||||||
commit=$(echo reverse |
|
commit=$(echo reverse |
|
||||||
|
@ -398,6 +407,9 @@ diff --no-index --raw --no-abbrev dir2 dir
|
||||||
|
|
||||||
diff-tree --pretty --root --stat --compact-summary initial
|
diff-tree --pretty --root --stat --compact-summary initial
|
||||||
diff-tree --pretty -R --root --stat --compact-summary initial
|
diff-tree --pretty -R --root --stat --compact-summary initial
|
||||||
|
diff-tree --pretty note
|
||||||
|
diff-tree --pretty --notes note
|
||||||
|
diff-tree --format=%N note
|
||||||
diff-tree --stat --compact-summary initial mode
|
diff-tree --stat --compact-summary initial mode
|
||||||
diff-tree -R --stat --compact-summary initial mode
|
diff-tree -R --stat --compact-summary initial mode
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
$ git diff-tree --format=%N note
|
||||||
|
note
|
||||||
|
|
||||||
|
|
||||||
|
:100644 100755 01e79c32a8c99c557f0757da7cb6d65b3414466d 01e79c32a8c99c557f0757da7cb6d65b3414466d M file2
|
||||||
|
$
|
|
@ -0,0 +1,12 @@
|
||||||
|
$ git diff-tree --pretty --notes note
|
||||||
|
commit a6f364368ca320bc5a92e18912e16fa6b3dff598
|
||||||
|
Author: A U Thor <author@example.com>
|
||||||
|
Date: Mon Jun 26 00:06:00 2006 +0000
|
||||||
|
|
||||||
|
update mode (file2)
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
note
|
||||||
|
|
||||||
|
:100644 100755 01e79c32a8c99c557f0757da7cb6d65b3414466d 01e79c32a8c99c557f0757da7cb6d65b3414466d M file2
|
||||||
|
$
|
|
@ -0,0 +1,9 @@
|
||||||
|
$ git diff-tree --pretty note
|
||||||
|
commit a6f364368ca320bc5a92e18912e16fa6b3dff598
|
||||||
|
Author: A U Thor <author@example.com>
|
||||||
|
Date: Mon Jun 26 00:06:00 2006 +0000
|
||||||
|
|
||||||
|
update mode (file2)
|
||||||
|
|
||||||
|
:100644 100755 01e79c32a8c99c557f0757da7cb6d65b3414466d 01e79c32a8c99c557f0757da7cb6d65b3414466d M file2
|
||||||
|
$
|
|
@ -5,12 +5,27 @@ Date: Mon Jun 26 00:06:00 2006 +0000
|
||||||
|
|
||||||
update mode
|
update mode
|
||||||
|
|
||||||
|
commit a6f364368ca320bc5a92e18912e16fa6b3dff598 (refs/heads/note)
|
||||||
|
Author: A U Thor <author@example.com>
|
||||||
|
Date: Mon Jun 26 00:06:00 2006 +0000
|
||||||
|
|
||||||
|
update mode (file2)
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
note
|
||||||
|
|
||||||
commit cd4e72fd96faed3f0ba949dc42967430374e2290 (refs/heads/rearrange)
|
commit cd4e72fd96faed3f0ba949dc42967430374e2290 (refs/heads/rearrange)
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:06:00 2006 +0000
|
Date: Mon Jun 26 00:06:00 2006 +0000
|
||||||
|
|
||||||
Rearranged lines in dir/sub
|
Rearranged lines in dir/sub
|
||||||
|
|
||||||
|
commit cbacedd14cb8b89255a2c02b59e77a2e9a8021a0 (refs/notes/commits)
|
||||||
|
Author: A U Thor <author@example.com>
|
||||||
|
Date: Mon Jun 26 00:06:00 2006 +0000
|
||||||
|
|
||||||
|
Notes added by 'git notes add'
|
||||||
|
|
||||||
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> refs/heads/master)
|
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> refs/heads/master)
|
||||||
Merge: 9a6d494 c7a2ab9
|
Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
|
|
@ -5,12 +5,27 @@ Date: Mon Jun 26 00:06:00 2006 +0000
|
||||||
|
|
||||||
update mode
|
update mode
|
||||||
|
|
||||||
|
commit a6f364368ca320bc5a92e18912e16fa6b3dff598 (note)
|
||||||
|
Author: A U Thor <author@example.com>
|
||||||
|
Date: Mon Jun 26 00:06:00 2006 +0000
|
||||||
|
|
||||||
|
update mode (file2)
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
note
|
||||||
|
|
||||||
commit cd4e72fd96faed3f0ba949dc42967430374e2290 (rearrange)
|
commit cd4e72fd96faed3f0ba949dc42967430374e2290 (rearrange)
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:06:00 2006 +0000
|
Date: Mon Jun 26 00:06:00 2006 +0000
|
||||||
|
|
||||||
Rearranged lines in dir/sub
|
Rearranged lines in dir/sub
|
||||||
|
|
||||||
|
commit cbacedd14cb8b89255a2c02b59e77a2e9a8021a0 (refs/notes/commits)
|
||||||
|
Author: A U Thor <author@example.com>
|
||||||
|
Date: Mon Jun 26 00:06:00 2006 +0000
|
||||||
|
|
||||||
|
Notes added by 'git notes add'
|
||||||
|
|
||||||
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> master)
|
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> master)
|
||||||
Merge: 9a6d494 c7a2ab9
|
Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
|
Loading…
Reference in New Issue