Re: [PATCH v9a 3/5] Implement line-history search (git log -L)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> diff --git a/t/t4211-line-log.sh b/t/t4211-line-log.sh
> new file mode 100755
> index 0000000..286390d
> --- /dev/null
> +++ b/t/t4211-line-log.sh
> @@ -0,0 +1,38 @@
> +#!/bin/sh
> +
> +test_description='test log -L'
> +. ./test-lib.sh
> +
> +test_expect_success 'setup (import history)' '
> +       git fast-import < "$TEST_DIRECTORY"/t4211/history.export &&
> +       git reset --hard
> +'
> +
> +canned_test () {
> +       test_expect_success "$1" "
> +               git log $1 >actual &&
> +               test_cmp \"\$TEST_DIRECTORY\"/t4211/expect.$2 actual
> +       "
> +}
> +
> +canned_test "-L 4,12:a.c simple" simple-f
> +canned_test "-L 4,+9:a.c simple" simple-f
> +canned_test "-L '/long f/,/^}/:a.c' simple" simple-f
> +
> +canned_test "-L '/main/,/^}/:a.c' simple" simple-main
> +
> +canned_test "-L 1,+4:a.c simple" beginning-of-file
> +
> +canned_test "-L 20:a.c simple" end-of-file
> +
> +test_expect_success "-L 20,10000:a.c (bogus end)" '
> +       test_must_fail git log -L 20,10000:a.c simple 2>errors &&
> +       grep "has only.*lines" errors
> +'
> +
> +canned_test "-L '/long f/',/^}/:a.c -L /main/,/^}/:a.c simple" two-ranges
> +canned_test "-L 24,+1:a.c simple" vanishes-early
> +
> +canned_test "-L '/long f/,/^}/:b.c' move-support" move-support-f
> +
> +test_done

Hi Thomas,

You should probably add some failing tests (for example when the input
parameters are not correct), and as a matter of fact, I have the
following segfault with v9:

Starting program: /home/antoine/code/git/git-log -M -L :git.c
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x000000000050164d in parse_range_funcname (arg=0x84f2d0 ":git.c",
    nth_line_cb=0, cb_data=0x0, lines=0, begin=0x0, end=0x0, path=0x0)
    at line-range.c:160
#2  0x0000000000501d28 in skip_range_arg (arg=0x84f2d0 ":git.c")
    at line-range.c:229
#3  0x00000000004fda78 in parse_lines (commit=0x86ea60, prefix=0x0,
    args=0x7fad48) at line-log.c:544
#4  0x00000000004fd75a in line_log_init (rev=0x7fffffffd9a8, prefix=0x0,
    args=0x7fad48) at line-log.c:701
#5  0x0000000000457189 in cmd_log_init_finish (argc=1, argv=0x7fffffffe238,
    prefix=0x0, rev=0x7fffffffd9a8, opt=0x7fffffffd988) at builtin/log.c:192
#6  0x0000000000455d2c in cmd_log_init (argc=4, argv=0x7fffffffe238,
    prefix=0x0, rev=0x7fffffffd9a8, opt=0x7fffffffd988) at builtin/log.c:201
#7  0x0000000000457250 in cmd_log (argc=4, argv=0x7fffffffe238, prefix=0x0)
    at builtin/log.c:612
#8  0x00000000004056cf in run_builtin (p=0x7f7af8, argc=4,
    argv=0x7fffffffe238) at git.c:281
#9  0x00000000004047aa in handle_internal_command (argc=4,
    argv=0x7fffffffe238) at git.c:443
#10 0x0000000000404506 in main (argc=4, argv=0x7fffffffe238) at git.c:532
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]