]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t4202-log.sh
Merge branch 'jc/grep-commandline-vs-configuration' into maint
[thirdparty/git.git] / t / t4202-log.sh
index f136a0f7004c8713f9fd88ee37d7f92a5ebf618d..0b53e566946e6e51ed83391aebce252c4ccaa4aa 100755 (executable)
@@ -101,8 +101,8 @@ test_expect_success 'oneline' '
 
 test_expect_success 'diff-filter=A' '
 
-       git log --pretty="format:%s" --diff-filter=A HEAD > actual &&
-       git log --pretty="format:%s" --diff-filter A HEAD > actual-separate &&
+       git log --no-renames --pretty="format:%s" --diff-filter=A HEAD > actual &&
+       git log --no-renames --pretty="format:%s" --diff-filter A HEAD > actual-separate &&
        printf "fifth\nfourth\nthird\ninitial" > expect &&
        test_cmp expect actual &&
        test_cmp expect actual-separate
@@ -119,7 +119,7 @@ test_expect_success 'diff-filter=M' '
 
 test_expect_success 'diff-filter=D' '
 
-       actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) &&
+       actual=$(git log --no-renames --pretty="format:%s" --diff-filter=D HEAD) &&
        expect=$(echo sixth ; echo third) &&
        verbose test "$actual" = "$expect"
 
@@ -146,7 +146,30 @@ test_expect_success 'git log --follow' '
        actual=$(git log --follow --pretty="format:%s" ichi) &&
        expect=$(echo third ; echo second ; echo initial) &&
        verbose test "$actual" = "$expect"
+'
+
+test_expect_success 'git config log.follow works like --follow' '
+       test_config log.follow true &&
+       actual=$(git log --pretty="format:%s" ichi) &&
+       expect=$(echo third ; echo second ; echo initial) &&
+       verbose test "$actual" = "$expect"
+'
+
+test_expect_success 'git config log.follow does not die with multiple paths' '
+       test_config log.follow true &&
+       git log --pretty="format:%s" ichi ein
+'
+
+test_expect_success 'git config log.follow does not die with no paths' '
+       test_config log.follow true &&
+       git log --
+'
 
+test_expect_success 'git config log.follow is overridden by --no-follow' '
+       test_config log.follow true &&
+       actual=$(git log --no-follow --pretty="format:%s" ichi) &&
+       expect="third" &&
+       verbose test "$actual" = "$expect"
 '
 
 cat > expect << EOF
@@ -839,7 +862,7 @@ sanitize_output () {
 }
 
 test_expect_success 'log --graph with diff and stats' '
-       git log --graph --pretty=short --stat -p >actual &&
+       git log --no-renames --graph --pretty=short --stat -p >actual &&
        sanitize_output >actual.sanitized <actual &&
        test_i18ncmp expect actual.sanitized
 '
@@ -885,4 +908,47 @@ test_expect_success 'log --graph --no-walk is forbidden' '
        test_must_fail git log --graph --no-walk
 '
 
+test_expect_success 'log diagnoses bogus HEAD' '
+       git init empty &&
+       test_must_fail git -C empty log 2>stderr &&
+       test_i18ngrep does.not.have.any.commits stderr &&
+       echo 1234abcd >empty/.git/refs/heads/master &&
+       test_must_fail git -C empty log 2>stderr &&
+       test_i18ngrep broken stderr &&
+       echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
+       test_must_fail git -C empty log 2>stderr &&
+       test_i18ngrep broken stderr &&
+       test_must_fail git -C empty log --default totally-bogus 2>stderr &&
+       test_i18ngrep broken stderr
+'
+
+test_expect_success 'set up --source tests' '
+       git checkout --orphan source-a &&
+       test_commit one &&
+       test_commit two &&
+       git checkout -b source-b HEAD^ &&
+       test_commit three
+'
+
+test_expect_success 'log --source paints branch names' '
+       cat >expect <<-\EOF &&
+       09e12a9 source-b three
+       8e393e1 source-a two
+       1ac6c77 source-b one
+       EOF
+       git log --oneline --source source-a source-b >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'log --source paints tag names' '
+       git tag -m tagged source-tag &&
+       cat >expect <<-\EOF &&
+       09e12a9 source-tag three
+       8e393e1 source-a two
+       1ac6c77 source-tag one
+       EOF
+       git log --oneline --source source-tag source-a >actual &&
+       test_cmp expect actual
+'
+
 test_done