Fourth batch
[gitweb.git] / t / t1414-reflog-walk.sh
index 8bda862ca7337d38026e8a56ab4077a2cede0b95..1181a9fb28e359e803ef5672ff7742187e7730f1 100755 (executable)
@@ -18,10 +18,9 @@ do_walk () {
        git log -g --format="%gd %gs" "$@"
 }
 
-sq="'"
 test_expect_success 'set up expected reflog' '
        cat >expect.all <<-EOF
-       HEAD@{0} commit (merge): Merge branch ${sq}master${sq} into side
+       HEAD@{0} commit (merge): Merge branch ${SQ}master${SQ} into side
        HEAD@{1} commit: three
        HEAD@{2} checkout: moving from master to side
        HEAD@{3} commit: two
@@ -34,19 +33,19 @@ test_expect_success 'reflog walk shows expected logs' '
        test_cmp expect.all actual
 '
 
-test_expect_failure 'reflog can limit with --no-merges' '
+test_expect_success 'reflog can limit with --no-merges' '
        grep -v merge expect.all >expect &&
        do_walk --no-merges >actual &&
        test_cmp expect actual
 '
 
-test_expect_failure 'reflog can limit with pathspecs' '
+test_expect_success 'reflog can limit with pathspecs' '
        grep two expect.all >expect &&
        do_walk -- two.t >actual &&
        test_cmp expect actual
 '
 
-test_expect_failure 'pathspec limiting handles merges' '
+test_expect_success 'pathspec limiting handles merges' '
        # we pick up:
        #   - the initial commit of one
        #   - the checkout back to commit one
@@ -56,14 +55,14 @@ test_expect_failure 'pathspec limiting handles merges' '
        test_cmp expect actual
 '
 
-test_expect_failure '--parents shows true parents' '
+test_expect_success '--parents shows true parents' '
        # convert newlines to spaces
        echo $(git rev-parse HEAD HEAD^1 HEAD^2) >expect &&
        git rev-list -g --parents -1 HEAD >actual &&
        test_cmp expect actual
 '
 
-test_expect_failure 'walking multiple reflogs shows all' '
+test_expect_success 'walking multiple reflogs shows all' '
        # We expect to see all entries for all reflogs, but interleaved by
        # date, with order on the command line breaking ties. We
        # can use "sort" on the separate lists to generate this,
@@ -91,7 +90,33 @@ test_expect_success 'date-limiting does not interfere with other logs' '
        test_cmp expect.all actual
 '
 
-test_expect_failure 'walk prefers reflog to ref tip' '
+test_expect_success 'min/max age uses entry date to limit' '
+       # Flip between commits one and two so each ref update actually
+       # does something (and does not get optimized out). We know
+       # that the timestamps of those commits will be before our "min".
+
+       git update-ref -m before refs/heads/minmax one &&
+
+       test_tick &&
+       min=$test_tick &&
+       git update-ref -m min refs/heads/minmax two &&
+
+       test_tick &&
+       max=$test_tick &&
+       git update-ref -m max refs/heads/minmax one &&
+
+       test_tick &&
+       git update-ref -m after refs/heads/minmax two &&
+
+       cat >expect <<-\EOF &&
+       max
+       min
+       EOF
+       git log -g --since=$min --until=$max --format=%gs minmax >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'walk prefers reflog to ref tip' '
        head=$(git rev-parse HEAD) &&
        one=$(git rev-parse one) &&
        ident="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" &&