]> git.ipfire.org Git - thirdparty/git.git/commitdiff
test-ref-store: don't add newline to reflog message
authorHan-Wen Nienhuys <hanwen@google.com>
Thu, 2 Dec 2021 17:36:30 +0000 (17:36 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 Dec 2021 19:14:07 +0000 (11:14 -0800)
By convention, reflog messages always end in '\n', so
before we would print blank lines between entries.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-ref-store.c
t/t1405-main-ref-store.sh
t/t1406-submodule-ref-store.sh

index 3986665037a199293bab786c6b324d408ad69a71..5ac33dfb598d3dc0d06547cba570836616d97788 100644 (file)
@@ -152,9 +152,8 @@ static int each_reflog(struct object_id *old_oid, struct object_id *new_oid,
                       const char *committer, timestamp_t timestamp,
                       int tz, const char *msg, void *cb_data)
 {
-       printf("%s %s %s %"PRItime" %d %s\n",
-              oid_to_hex(old_oid), oid_to_hex(new_oid),
-              committer, timestamp, tz, msg);
+       printf("%s %s %s %" PRItime " %d %s", oid_to_hex(old_oid),
+              oid_to_hex(new_oid), committer, timestamp, tz, msg);
        return 0;
 }
 
index 49718b7ea7fe7df85b6e2bd4c9833ee443825632..a600bedf2cd638257eb087f0190989b47d2e1311 100755 (executable)
@@ -89,13 +89,12 @@ test_expect_success 'for_each_reflog()' '
 test_expect_success 'for_each_reflog_ent()' '
        $RUN for-each-reflog-ent HEAD >actual &&
        head -n1 actual | grep one &&
-       tail -n2 actual | head -n1 | grep recreate-main
+       tail -n1 actual | grep recreate-main
 '
 
 test_expect_success 'for_each_reflog_ent_reverse()' '
        $RUN for-each-reflog-ent-reverse HEAD >actual &&
-       head -n1 actual | grep recreate-main &&
-       tail -n2 actual | head -n1 | grep one
+       tail -n1 actual | grep one
 '
 
 test_expect_success 'reflog_exists(HEAD)' '
index 0a87058971ee3f601f928a1d3078c25ac0a60ce2..b0365c1fee026d0e554e89fd2e0106ecd566f71b 100755 (executable)
@@ -74,13 +74,13 @@ test_expect_success 'for_each_reflog()' '
 test_expect_success 'for_each_reflog_ent()' '
        $RUN for-each-reflog-ent HEAD >actual &&
        head -n1 actual | grep first &&
-       tail -n2 actual | head -n1 | grep main.to.new
+       tail -n1 actual | grep main.to.new
 '
 
 test_expect_success 'for_each_reflog_ent_reverse()' '
        $RUN for-each-reflog-ent-reverse HEAD >actual &&
        head -n1 actual | grep main.to.new &&
-       tail -n2 actual | head -n1 | grep first
+       tail -n1 actual | grep first
 '
 
 test_expect_success 'reflog_exists(HEAD)' '