Initial implementation of git_diff_blob This gets the basic plumbing in place for git_diff_blob. There is a known issue where additional parameters like the number of lines of context to display on the diff are not working correctly (which leads one of the new unit tests to fail).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556
diff --git a/include/git2/diff.h b/include/git2/diff.h
new file mode 100644
index 0000000..1d3a8d4
--- /dev/null
+++ b/include/git2/diff.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2009-2012 the libgit2 contributors
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+#ifndef INCLUDE_git_diff_h__
+#define INCLUDE_git_diff_h__
+
+#include "common.h"
+#include "types.h"
+#include "oid.h"
+#include "tree.h"
+#include "refs.h"
+
+/**
+ * @file git2/diff.h
+ * @brief Git tree and file differencing routines.
+ * @ingroup Git
+ * @{
+ */
+GIT_BEGIN_DECL
+
+typedef int (*git_diff_file_fn)(
+ void *cb_data,
+ const git_oid *old,
+ const char *old_path,
+ int old_mode,
+ const git_oid *new, /* hashed object if from work tree */
+ const char *new_path,
+ int new_mode);
+
+typedef int (*git_diff_hunk_fn)(
+ void *cb_data,
+ int old_start,
+ int old_lines,
+ int new_start,
+ int new_lines);
+
+#define GIT_DIFF_LINE_CONTEXT 0
+#define GIT_DIFF_LINE_ADDITION 1
+#define GIT_DIFF_LINE_DELETION 2
+
+typedef int (*git_diff_line_fn)(
+ void *cb_data,
+ int origin, /* GIT_DIFF_LINE value from above */
+ const char *content,
+ size_t content_len);
+
+typedef struct {
+ int context_lines;
+ int interhunk_lines;
+ int ignore_whitespace;
+
+ git_diff_file_fn file_cb;
+ git_diff_hunk_fn hunk_cb;
+ git_diff_line_fn line_cb;
+ void *cb_data;
+} git_diff_opts;
+
+
+GIT_EXTERN(int) git_diff_blobs(
+ git_repository *repo,
+ git_blob *old,
+ git_blob *new,
+ git_diff_opts *options);
+
+GIT_EXTERN(int) git_diff_trees(
+ git_repository *repo,
+ git_tree *old,
+ git_tree *new,
+ git_diff_opts *options);
+
+GIT_EXTERN(int) git_diff_index(
+ git_repository *repo,
+ git_tree *old,
+ git_diff_opts *options);
+
+/* pass NULL for the git_tree to diff workdir against index */
+GIT_EXTERN(int) git_diff_workdir(
+ git_repository *repo,
+ git_tree *old,
+ git_diff_opts *options);
+
+GIT_EXTERN(int) git_diff_workdir_file(
+ git_repository *repo,
+ git_blob *old,
+ const char *path,
+ git_diff_opts *options);
+
+/* pass git_objects to diff against or NULL for index.
+ * can handle: blob->blob, tree->index, tree->tree
+ * it will be an error if object types don't match
+ */
+/* pass git_object to diff WT against or NULL for index
+ * can handle: index->wt, tree->wt, blob->wt with path
+ */
+
+GIT_END_DECL
+
+/** @} */
+
+#endif
diff --git a/src/diff.c b/src/diff.c
new file mode 100644
index 0000000..7128b7c
--- /dev/null
+++ b/src/diff.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2009-2011 the libgit2 contributors
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+
+#include "common.h"
+#include "git2/diff.h"
+#include "xdiff/xdiff.h"
+#include "blob.h"
+#include <ctype.h>
+
+static int read_next_int(const char **str, int *value)
+{
+ const char *scan = *str;
+ int v = 0, digits = 0;
+ /* find next digit */
+ for (scan = *str; *scan && !isdigit(*scan); scan++);
+ /* parse next number */
+ for (; isdigit(*scan); scan++, digits++)
+ v = (v * 10) + (*scan - '0');
+ *str = scan;
+ *value = v;
+ return (digits > 0) ? GIT_SUCCESS : GIT_ENOTFOUND;
+}
+
+static int diff_output_cb(void *priv, mmbuffer_t *bufs, int len)
+{
+ int err = GIT_SUCCESS;
+ git_diff_opts *opts = priv;
+
+ if (len == 1) {
+ int ostart = -1, olen = 0, nstart = -1, nlen = 0;
+ /* expect something of the form "@@ -%d[,%d] +%d[,%d] @@" */
+ if (opts->hunk_cb && bufs[0].ptr[0] == '@') {
+ const char *scan = bufs[0].ptr;
+ if (!(err = read_next_int(&scan, &ostart)) && *scan == ',')
+ err = read_next_int(&scan, &olen);
+ if (!err && !(err = read_next_int(&scan, &nstart)) && *scan == ',')
+ err = read_next_int(&scan, &nlen);
+ if (!err && ostart >= 0 && nstart >= 0)
+ err = opts->hunk_cb(
+ opts->cb_data, ostart, olen, nstart, nlen);
+ }
+ }
+ else if (len == 2 || len == 3) {
+ int origin;
+ /* expect " "/"-"/"+", then data, then maybe newline */
+ origin =
+ (*bufs[0].ptr == '+') ? GIT_DIFF_LINE_ADDITION :
+ (*bufs[0].ptr == '-') ? GIT_DIFF_LINE_DELETION :
+ GIT_DIFF_LINE_CONTEXT;
+
+ if (opts->line_cb)
+ err = opts->line_cb(
+ opts->cb_data, origin, bufs[1].ptr, bufs[1].size);
+ }
+
+ return err;
+}
+
+int git_diff_blobs(
+ git_repository *repo,
+ git_blob *old_blob,
+ git_blob *new_blob,
+ git_diff_opts *options)
+{
+ mmfile_t old, new;
+ xpparam_t params;
+ xdemitconf_t cfg;
+ xdemitcb_t callback;
+
+ assert(repo && old_blob && new_blob && options);
+
+ old.ptr = (char *)git_blob_rawcontent(old_blob);
+ old.size = git_blob_rawsize(old_blob);
+
+ new.ptr = (char *)git_blob_rawcontent(new_blob);
+ new.size = git_blob_rawsize(new_blob);
+
+ memset(¶ms, 0, sizeof(params));
+
+ memset(&cfg, 0, sizeof(cfg));
+ cfg.ctxlen = options->context_lines || 3;
+ cfg.interhunkctxlen = options->interhunk_lines || 3;
+ if (options->ignore_whitespace)
+ cfg.flags |= XDF_WHITESPACE_FLAGS;
+
+ memset(&callback, 0, sizeof(callback));
+ callback.outf = diff_output_cb;
+ callback.priv = options;
+
+ if (options->file_cb)
+ options->file_cb(
+ options->cb_data,
+ git_object_id((const git_object *)old_blob), NULL, 010644,
+ git_object_id((const git_object *)new_blob), NULL, 010644);
+
+ xdl_diff(&old, &new, ¶ms, &cfg, &callback);
+
+ return GIT_SUCCESS;
+}
+
diff --git a/src/xdiff/xinclude.h b/src/xdiff/xinclude.h
index 526ccb3..2928d32 100644
--- a/src/xdiff/xinclude.h
+++ b/src/xdiff/xinclude.h
@@ -26,10 +26,14 @@
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <string.h>
#include <limits.h>
+#ifdef WIN32
+#else
+#include <unistd.h>
+#endif
+
#include "xmacros.h"
#include "xdiff.h"
#include "xtypes.h"
diff --git a/tests-clay/diff/blob.c b/tests-clay/diff/blob.c
new file mode 100644
index 0000000..2fb3e77
--- /dev/null
+++ b/tests-clay/diff/blob.c
@@ -0,0 +1,181 @@
+#include "clay_libgit2.h"
+#include "fileops.h"
+#include "git2/diff.h"
+
+static git_repository *g_repo = NULL;
+
+void test_diff_blob__initialize(void)
+{
+ cl_fixture_sandbox("attr");
+ cl_git_pass(p_rename("attr/.gitted", "attr/.git"));
+ cl_git_pass(p_rename("attr/gitattributes", "attr/.gitattributes"));
+ cl_git_pass(git_repository_open(&g_repo, "attr/.git"));
+}
+
+void test_diff_blob__cleanup(void)
+{
+ git_repository_free(g_repo);
+ g_repo = NULL;
+ cl_fixture_cleanup("attr");
+}
+
+typedef struct {
+ int files;
+ int hunks;
+ int hunk_new_lines;
+ int hunk_old_lines;
+ int lines;
+ int line_ctxt;
+ int line_adds;
+ int line_dels;
+} diff_expects;
+
+static void log(const char *str, int n)
+{
+ FILE *fp = fopen("/Users/rb/tmp/diff.log", "a");
+ if (n > 0)
+ fprintf(fp, "%.*s", n, str);
+ else
+ fputs(str, fp);
+ fclose(fp);
+}
+
+static int diff_file_fn(
+ void *cb_data,
+ const git_oid *old,
+ const char *old_path,
+ int old_mode,
+ const git_oid *new,
+ const char *new_path,
+ int new_mode)
+{
+ diff_expects *e = cb_data;
+ e->files++;
+ log("-- file --\n", 0);
+ return 0;
+}
+
+static int diff_hunk_fn(
+ void *cb_data,
+ int old_start,
+ int old_lines,
+ int new_start,
+ int new_lines)
+{
+ diff_expects *e = cb_data;
+ e->hunks++;
+ e->hunk_old_lines += old_lines;
+ e->hunk_new_lines += new_lines;
+ log("-- hunk --\n", 0);
+ return 0;
+}
+
+static int diff_line_fn(
+ void *cb_data,
+ int origin,
+ const char *content,
+ size_t content_len)
+{
+ diff_expects *e = cb_data;
+ e->lines++;
+ switch (origin) {
+ case GIT_DIFF_LINE_CONTEXT:
+ log("[ ]", 3);
+ e->line_ctxt++;
+ break;
+ case GIT_DIFF_LINE_ADDITION:
+ log("[+]", 3);
+ e->line_adds++;
+ break;
+ case GIT_DIFF_LINE_DELETION:
+ log("[-]", 3);
+ e->line_dels++;
+ break;
+ default:
+ cl_assert("Unknown diff line origin" == 0);
+ }
+ log(content, content_len);
+ return 0;
+}
+
+void test_diff_blob__0(void)
+{
+ int err;
+ git_blob *a, *b, *c, *d;
+ git_oid a_oid, b_oid, c_oid, d_oid;
+ git_diff_opts opts;
+ diff_expects exp;
+
+ /* tests/resources/attr/root_test1 */
+ cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8));
+ cl_git_pass(git_blob_lookup_prefix(&a, g_repo, &a_oid, 4));
+
+ /* tests/resources/attr/root_test2 */
+ cl_git_pass(git_oid_fromstrn(&b_oid, "4d713dc4", 8));
+ cl_git_pass(git_blob_lookup_prefix(&b, g_repo, &b_oid, 4));
+
+ /* tests/resources/attr/root_test3 */
+ cl_git_pass(git_oid_fromstrn(&c_oid, "c96bbb2c2557a832", 16));
+ cl_git_pass(git_blob_lookup_prefix(&c, g_repo, &c_oid, 8));
+
+ /* tests/resources/attr/root_test4.txt */
+ cl_git_pass(git_oid_fromstrn(&d_oid, "fe773770c5a6", 12));
+ cl_git_pass(git_blob_lookup_prefix(&d, g_repo, &d_oid, 6));
+
+ /* Doing the equivalent of a `diff -U 2` on these files */
+
+ opts.context_lines = 2;
+ opts.interhunk_lines = 0;
+ opts.ignore_whitespace = 0;
+ opts.file_cb = diff_file_fn;
+ opts.hunk_cb = diff_hunk_fn;
+ opts.line_cb = diff_line_fn;
+ opts.cb_data = &exp;
+
+ memset(&exp, 0, sizeof(exp));
+ cl_git_pass(git_diff_blobs(g_repo, a, b, &opts));
+
+ cl_assert(exp.files == 1);
+ cl_assert(exp.hunks == 1);
+ cl_assert(exp.lines == 6);
+ cl_assert(exp.line_ctxt == 1);
+ cl_assert(exp.line_adds == 5);
+ cl_assert(exp.line_dels == 0);
+
+ memset(&exp, 0, sizeof(exp));
+ cl_git_pass(git_diff_blobs(g_repo, b, c, &opts));
+
+ cl_assert(exp.files == 1);
+ cl_assert(exp.hunks == 1);
+ cl_assert(exp.lines == 15);
+ cl_assert(exp.line_ctxt == 3);
+ cl_assert(exp.line_adds == 9);
+ cl_assert(exp.line_dels == 3);
+
+ memset(&exp, 0, sizeof(exp));
+ cl_git_pass(git_diff_blobs(g_repo, a, c, &opts));
+
+ cl_assert(exp.files == 1);
+ cl_assert(exp.hunks == 1);
+ cl_assert(exp.lines == 13);
+ cl_assert(exp.line_ctxt == 0);
+ cl_assert(exp.line_adds == 12);
+ cl_assert(exp.line_dels == 1);
+
+ opts.context_lines = 2;
+
+ memset(&exp, 0, sizeof(exp));
+ cl_git_pass(git_diff_blobs(g_repo, c, d, &opts));
+
+ cl_assert(exp.files == 1);
+ cl_assert(exp.hunks == 2);
+ cl_assert(exp.lines == 16);
+ cl_assert(exp.line_ctxt == 6);
+ cl_assert(exp.line_adds == 6);
+ cl_assert(exp.line_dels == 4);
+
+ git_blob_free(a);
+ git_blob_free(b);
+ git_blob_free(c);
+}
+
diff --git a/tests/resources/attr/.gitted/index b/tests/resources/attr/.gitted/index
index c52747e..f35d300 100644
Binary files a/tests/resources/attr/.gitted/index and b/tests/resources/attr/.gitted/index differ
diff --git a/tests/resources/attr/.gitted/logs/HEAD b/tests/resources/attr/.gitted/logs/HEAD
index f518a46..6d09635 100644
--- a/tests/resources/attr/.gitted/logs/HEAD
+++ b/tests/resources/attr/.gitted/logs/HEAD
@@ -1,3 +1,5 @@
0000000000000000000000000000000000000000 6bab5c79cd5140d0f800917f550eb2a3dc32b0da Russell Belfer <arrbee@arrbee.com> 1324416995 -0800 commit (initial): initial test data
6bab5c79cd5140d0f800917f550eb2a3dc32b0da 605812ab7fe421fdd325a935d35cb06a9234a7d7 Russell Belfer <arrbee@arrbee.com> 1325143098 -0800 commit: latest test updates
605812ab7fe421fdd325a935d35cb06a9234a7d7 a5d76cad53f66f1312bd995909a5bab3c0820770 Russell Belfer <arrbee@arrbee.com> 1325281762 -0800 commit: more macro tests
+a5d76cad53f66f1312bd995909a5bab3c0820770 370fe9ec224ce33e71f9e5ec2bd1142ce9937a6a Russell Belfer <arrbee@arrbee.com> 1327611749 -0800 commit: Updating files so we can do diffs
+370fe9ec224ce33e71f9e5ec2bd1142ce9937a6a f5b0af1fb4f5c0cd7aad880711d368a07333c307 Russell Belfer <arrbee@arrbee.com> 1327621027 -0800 commit: Updating test data
diff --git a/tests/resources/attr/.gitted/logs/refs/heads/master b/tests/resources/attr/.gitted/logs/refs/heads/master
index f518a46..6d09635 100644
--- a/tests/resources/attr/.gitted/logs/refs/heads/master
+++ b/tests/resources/attr/.gitted/logs/refs/heads/master
@@ -1,3 +1,5 @@
0000000000000000000000000000000000000000 6bab5c79cd5140d0f800917f550eb2a3dc32b0da Russell Belfer <arrbee@arrbee.com> 1324416995 -0800 commit (initial): initial test data
6bab5c79cd5140d0f800917f550eb2a3dc32b0da 605812ab7fe421fdd325a935d35cb06a9234a7d7 Russell Belfer <arrbee@arrbee.com> 1325143098 -0800 commit: latest test updates
605812ab7fe421fdd325a935d35cb06a9234a7d7 a5d76cad53f66f1312bd995909a5bab3c0820770 Russell Belfer <arrbee@arrbee.com> 1325281762 -0800 commit: more macro tests
+a5d76cad53f66f1312bd995909a5bab3c0820770 370fe9ec224ce33e71f9e5ec2bd1142ce9937a6a Russell Belfer <arrbee@arrbee.com> 1327611749 -0800 commit: Updating files so we can do diffs
+370fe9ec224ce33e71f9e5ec2bd1142ce9937a6a f5b0af1fb4f5c0cd7aad880711d368a07333c307 Russell Belfer <arrbee@arrbee.com> 1327621027 -0800 commit: Updating test data
diff --git a/tests/resources/attr/.gitted/objects/37/0fe9ec224ce33e71f9e5ec2bd1142ce9937a6a b/tests/resources/attr/.gitted/objects/37/0fe9ec224ce33e71f9e5ec2bd1142ce9937a6a
new file mode 100644
index 0000000..9c37c59
Binary files /dev/null and b/tests/resources/attr/.gitted/objects/37/0fe9ec224ce33e71f9e5ec2bd1142ce9937a6a differ
diff --git a/tests/resources/attr/.gitted/objects/3a/6df026462ebafe455af9867d27eda20a9e0974 b/tests/resources/attr/.gitted/objects/3a/6df026462ebafe455af9867d27eda20a9e0974
new file mode 100644
index 0000000..c74add8
Binary files /dev/null and b/tests/resources/attr/.gitted/objects/3a/6df026462ebafe455af9867d27eda20a9e0974 differ
diff --git a/tests/resources/attr/.gitted/objects/4d/713dc48e6b1bd75b0d61ad078ba9ca3a56745d b/tests/resources/attr/.gitted/objects/4d/713dc48e6b1bd75b0d61ad078ba9ca3a56745d
new file mode 100644
index 0000000..eb1e8d0
--- /dev/null
+++ b/tests/resources/attr/.gitted/objects/4d/713dc48e6b1bd75b0d61ad078ba9ca3a56745d
@@ -0,0 +1,2 @@
+x
@WŶ
+|k 9n$}g:;51e4\k_]ރ٭hDk'~
\ No newline at end of file
diff --git a/tests/resources/attr/.gitted/objects/71/7fc31f6b84f9d6fc3a4edbca259d7fc92beee2 b/tests/resources/attr/.gitted/objects/71/7fc31f6b84f9d6fc3a4edbca259d7fc92beee2
new file mode 100644
index 0000000..a80265c
Binary files /dev/null and b/tests/resources/attr/.gitted/objects/71/7fc31f6b84f9d6fc3a4edbca259d7fc92beee2 differ
diff --git a/tests/resources/attr/.gitted/objects/96/089fd31ce1d3ee2afb0ba09ba063066932f027 b/tests/resources/attr/.gitted/objects/96/089fd31ce1d3ee2afb0ba09ba063066932f027
new file mode 100644
index 0000000..efa62f9
Binary files /dev/null and b/tests/resources/attr/.gitted/objects/96/089fd31ce1d3ee2afb0ba09ba063066932f027 differ
diff --git a/tests/resources/attr/.gitted/objects/c9/6bbb2c2557a8325ae1559e3ba79cdcecb23076 b/tests/resources/attr/.gitted/objects/c9/6bbb2c2557a8325ae1559e3ba79cdcecb23076
new file mode 100644
index 0000000..589f9ad
--- /dev/null
+++ b/tests/resources/attr/.gitted/objects/c9/6bbb2c2557a8325ae1559e3ba79cdcecb23076
@@ -0,0 +1,2 @@
+x5A
+0D]SεouJ~L0ͯ)xcfp]OOΊcB6!뢘ó{,U<Cj[E--&#)~=;;{.e"3A
\ No newline at end of file
diff --git a/tests/resources/attr/.gitted/objects/f5/b0af1fb4f5c0cd7aad880711d368a07333c307 b/tests/resources/attr/.gitted/objects/f5/b0af1fb4f5c0cd7aad880711d368a07333c307
new file mode 100644
index 0000000..21faeb8
--- /dev/null
+++ b/tests/resources/attr/.gitted/objects/f5/b0af1fb4f5c0cd7aad880711d368a07333c307
@@ -0,0 +1,2 @@
+xN[j1̷O4RbPJ
+=;N
A?y 1y~7Z(2be8uJanF.H"UD_HIsvZwL=0TZG_UbKo̮}cv?h<aoԵ_EK
\ No newline at end of file
diff --git a/tests/resources/attr/.gitted/objects/fe/773770c5a6cc7185580c9204b1ff18a33ff3fc b/tests/resources/attr/.gitted/objects/fe/773770c5a6cc7185580c9204b1ff18a33ff3fc
new file mode 100644
index 0000000..e6fcbc0
--- /dev/null
+++ b/tests/resources/attr/.gitted/objects/fe/773770c5a6cc7185580c9204b1ff18a33ff3fc
@@ -0,0 +1 @@
+x5A09xBAGvդTУ坝<#1UT釛*MWlOCR2dѵC.TIlQH/mY۬UN[߬B@t8~}}R#č#kAdD_=-H
\ No newline at end of file
diff --git a/tests/resources/attr/.gitted/refs/heads/master b/tests/resources/attr/.gitted/refs/heads/master
index 0516af2..9eca424 100644
--- a/tests/resources/attr/.gitted/refs/heads/master
+++ b/tests/resources/attr/.gitted/refs/heads/master
@@ -1 +1 @@
-a5d76cad53f66f1312bd995909a5bab3c0820770
+f5b0af1fb4f5c0cd7aad880711d368a07333c307
diff --git a/tests/resources/attr/root_test2 b/tests/resources/attr/root_test2
index 45141a7..4d713dc 100644
--- a/tests/resources/attr/root_test2
+++ b/tests/resources/attr/root_test2
@@ -1 +1,6 @@
Hello from the root
+
+Some additional lines
+
+Down here below
+
diff --git a/tests/resources/attr/root_test3 b/tests/resources/attr/root_test3
index 45141a7..c96bbb2 100644
--- a/tests/resources/attr/root_test3
+++ b/tests/resources/attr/root_test3
@@ -1 +1,12 @@
-Hello from the root
+Some additional lines
+
+Down here below the other lines
+
+With even more at the end
+
+And lots of good stuff
+
+Anywhere you want
+
+Don't you think
+
diff --git a/tests/resources/attr/root_test4.txt b/tests/resources/attr/root_test4.txt
index fb5067b..fe77377 100644
--- a/tests/resources/attr/root_test4.txt
+++ b/tests/resources/attr/root_test4.txt
@@ -1 +1,14 @@
-Hello again
+Here is some stuff at the start
+
+This should go in one hunk
+
+Some additional lines
+
+Down here below the other lines
+
+With even more at the end
+
+Followed by a second hunk of stuff
+
+That happens down here
+