{"thread":{"id":"17304","subject":"[PATCH 1/2] t/t4202-log.sh: Add testcases","startedAt":"2009-01-22T16:37:24Z","lastAt":"2009-01-22T17:28:59Z","messageCount":3,"participants":["Arjen Laarhoven","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"101543","messageId":"1232642245-94405-1-git-send-email-arjen@yaph.org","threadId":"17304","inReplyTo":null,"subject":"[PATCH 1/2] t/t4202-log.sh: Add testcases","fromName":"Arjen Laarhoven","fromEmail":"arjen@yaph.org","sentAt":"2009-01-22T16:37:24Z","receivedAt":"2009-01-22T16:37:24Z","isPatch":true,"sender":{"key":"arjen@yaph.org","avatar":"https://gravatar.com/avatar/f776c2c0c5ea62d70827b942eb7d95ce85661a3d70bc3f03cf9773815c599c01?d=mp&s=160"},"body":"Add testcases for 'git log --diff-filter=[CM]' (copies and renames).\nAlso add a testcase for 'git log --follow'.\n\nSigned-off-by: Arjen Laarhoven <arjen@yaph.org>\n---\n t/t4202-log.sh |   59 +++++++++++++++++++++++++++++++++++++++++++++++--------\n 1 files changed, 50 insertions(+), 9 deletions(-)\n\ndiff --git a/t/t4202-log.sh b/t/t4202-log.sh\nindex 0ab925c..7b976ee 100755\n--- a/t/t4202-log.sh\n+++ b/t/t4202-log.sh\n@@ -16,27 +16,31 @@ test_expect_success setup '\n \ttest_tick &&\n \tgit commit -m second &&\n \n-\tmkdir a &&\n-\techo ni >a/two &&\n-\tgit add a/two &&\n+\tgit mv one ichi &&\n \ttest_tick &&\n \tgit commit -m third &&\n \n-\techo san >a/three &&\n-\tgit add a/three &&\n+\tcp ichi ein &&\n+\tgit add ein &&\n \ttest_tick &&\n \tgit commit -m fourth &&\n \n-\tgit rm a/three &&\n+\tmkdir a &&\n+\techo ni >a/two &&\n+\tgit add a/two &&\n+\ttest_tick &&\n+\tgit commit -m fifth  &&\n+\n+\tgit rm a/two &&\n \ttest_tick &&\n-\tgit commit -m fifth\n+\tgit commit -m sixth\n \n '\n \n test_expect_success 'diff-filter=A' '\n \n \tactual=$(git log --pretty=\"format:%s\" --diff-filter=A HEAD) &&\n-\texpect=$(echo fourth ; echo third ; echo initial) &&\n+\texpect=$(echo fifth ; echo fourth ; echo third ; echo initial) &&\n \ttest \"$actual\" = \"$expect\" || {\n \t\techo Oops\n \t\techo \"Actual: $actual\"\n@@ -60,7 +64,43 @@ test_expect_success 'diff-filter=M' '\n test_expect_success 'diff-filter=D' '\n \n \tactual=$(git log --pretty=\"format:%s\" --diff-filter=D HEAD) &&\n-\texpect=$(echo fifth) &&\n+\texpect=$(echo sixth ; echo third) &&\n+\ttest \"$actual\" = \"$expect\" || {\n+\t\techo Oops\n+\t\techo \"Actual: $actual\"\n+\t\tfalse\n+\t}\n+\n+'\n+\n+test_expect_success 'diff-filter=R' '\n+\n+\tactual=$(git log -M --pretty=\"format:%s\" --diff-filter=R HEAD) &&\n+\texpect=$(echo third) &&\n+\ttest \"$actual\" = \"$expect\" || {\n+\t\techo Oops\n+\t\techo \"Actual: $actual\"\n+\t\tfalse\n+\t}\n+\n+'\n+\n+test_expect_success 'diff-filter=C' '\n+\n+\tactual=$(git log -C -C --pretty=\"format:%s\" --diff-filter=C HEAD) &&\n+\texpect=$(echo fourth) &&\n+\ttest \"$actual\" = \"$expect\" || {\n+\t\techo Oops\n+\t\techo \"Actual: $actual\"\n+\t\tfalse\n+\t}\n+\n+'\n+\n+test_expect_success 'git log --follow' '\n+\n+\tactual=$(git log --follow --pretty=\"format:%s\" ichi) &&\n+\texpect=$(echo third ; echo second ; echo initial) &&\n \ttest \"$actual\" = \"$expect\" || {\n \t\techo Oops\n \t\techo \"Actual: $actual\"\n@@ -72,6 +112,7 @@ test_expect_success 'diff-filter=D' '\n test_expect_success 'setup case sensitivity tests' '\n \techo case >one &&\n \ttest_tick &&\n+\tgit add one\n \tgit commit -a -m Second\n '\n \n-- \n1.6.1.354.gd9e51\n"},{"id":"101544","messageId":"1232642245-94405-2-git-send-email-arjen@yaph.org","threadId":"17304","inReplyTo":"1232642245-94405-1-git-send-email-arjen@yaph.org","subject":"[PATCH 2/2] git-log: Follow file copies with 'git log --follow -C -C'","fromName":"Arjen Laarhoven","fromEmail":"arjen@yaph.org","sentAt":"2009-01-22T16:37:25Z","receivedAt":"2009-01-22T16:37:25Z","isPatch":true,"sender":{"key":"arjen@yaph.org","avatar":"https://gravatar.com/avatar/f776c2c0c5ea62d70827b942eb7d95ce85661a3d70bc3f03cf9773815c599c01?d=mp&s=160"},"body":"When the '--follow' option is used with '--find-copies-harder' ('-C -C')\nlogs on individual files will work across file copies as well as\nrenames.\n\nIntermediate copies will not be shown as a result of the workings of the\n'--find-copies-harder' option.\n\nSigned-off-by: Arjen Laarhoven <arjen@yaph.org>\n---\n Documentation/git-log.txt |    6 +++++-\n t/t4202-log.sh            |   12 ++++++++++++\n tree-diff.c               |    2 ++\n 3 files changed, 19 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-log.txt b/Documentation/git-log.txt\nindex 34cf4e5..2d42101 100644\n--- a/Documentation/git-log.txt\n+++ b/Documentation/git-log.txt\n@@ -52,7 +52,11 @@ include::diff-options.txt[]\n \tcommits, and doesn't limit diff for those commits.\n \n --follow::\n-\tContinue listing the history of a file beyond renames.\n+\tContinue listing the history of a file beyond renames.  When\n+\tcombined with `--find-copies-harder` (`-C -C`) git will also\n+\tlist the file history beyond copies.  Intermediate copies\n+\twill be skipped, e.g. a copy of file A to B to C will not\n+\tshow B when showing the log on file C.\n \n --log-size::\n \tBefore the log message print out its size in bytes. Intended\ndiff --git a/t/t4202-log.sh b/t/t4202-log.sh\nindex 7b976ee..a8dd690 100755\n--- a/t/t4202-log.sh\n+++ b/t/t4202-log.sh\n@@ -109,6 +109,18 @@ test_expect_success 'git log --follow' '\n \n '\n \n+test_expect_success 'git log --follow --find-copies-harder' '\n+\n+\tactual=$(git log --follow -C -C --pretty=\"format:%s\" ein) &&\n+\texpect=$(echo fourth; echo third ; echo second ; echo initial) &&\n+\ttest \"$actual\" = \"$expect\" || {\n+\t\techo Oops\n+\t\techo \"Actual: $actual\"\n+\t\tfalse\n+\t}\n+\n+'\n+\n test_expect_success 'setup case sensitivity tests' '\n \techo case >one &&\n \ttest_tick &&\ndiff --git a/tree-diff.c b/tree-diff.c\nindex 9f67af6..73652b2 100644\n--- a/tree-diff.c\n+++ b/tree-diff.c\n@@ -333,6 +333,8 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co\n \n \tdiff_setup(&diff_opts);\n \tDIFF_OPT_SET(&diff_opts, RECURSIVE);\n+\tif (DIFF_OPT_TST(opt, FIND_COPIES_HARDER))\n+\t\tDIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);\n \tdiff_opts.detect_rename = DIFF_DETECT_RENAME;\n \tdiff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;\n \tdiff_opts.single_follow = opt->paths[0];\n-- \n1.6.1.354.gd9e51\n"},{"id":"101553","messageId":"7v8wp36yhw.fsf@gitster.siamese.dyndns.org","threadId":"17304","inReplyTo":"1232642245-94405-2-git-send-email-arjen@yaph.org","subject":"Re: [PATCH 2/2] git-log: Follow file copies with 'git log --follow -C -C'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-22T17:28:59Z","receivedAt":"2009-01-22T17:28:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Arjen Laarhoven <arjen@yaph.org> writes:\n\n> When the '--follow' option is used with '--find-copies-harder' ('-C -C')\n> logs on individual files will work across file copies as well as\n> renames.\n\nIs there a reason to limit this to \"harder\" case?\n\n> diff --git a/tree-diff.c b/tree-diff.c\n> index 9f67af6..73652b2 100644\n> --- a/tree-diff.c\n> +++ b/tree-diff.c\n> @@ -333,6 +333,8 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co\n>  \n>  \tdiff_setup(&diff_opts);\n>  \tDIFF_OPT_SET(&diff_opts, RECURSIVE);\n> +\tif (DIFF_OPT_TST(opt, FIND_COPIES_HARDER))\n> +\t\tDIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);\n>  \tdiff_opts.detect_rename = DIFF_DETECT_RENAME;\n\nHmm, why isn't this DIFF_DETECT_COPY?\n\n>  \tdiff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;\n>  \tdiff_opts.single_follow = opt->paths[0];\n> -- \n> 1.6.1.354.gd9e51\n"}]}