Skip to content

Use << rather than <<- heredoc operator #1435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 1, 2024
Merged

Conversation

EliahKagan
Copy link
Member

This makes the change from <<- to << discussed in #1423, changing to << because the distinctive behavior with <<- of stripping consistent leading tabs was not relevant to any of the here documents in this project where it was being used.

See the commit messages for further details. In particular, the second commit, which regenerates archives, involves a choice related to an ongoing situation where a couple of committed archives have for some reason not be used, and you might prefer that a different choice be made there.

Because `<<-` only makes a difference when the contents of the here
document are indented with tabs, which was not being done anywhere
that `<<-` was used. See GitoxideLabs#1423 for details.

This also removes some spurious indentation (outside of the here
document) in make_dangling_symlink.sh and changes its blank lines
for readability and to match the style in similar scripts.
These are the changed archives generated by fixture scripts by
running `cargo nextest run --all --no-fail-fast` on an Ubuntu 22.04
system. (All tests passed, as expected.)

The changed archives divide into two cases. First, there are those
that are changed due to the stylistic changes to heredocs in the
preceding commit 2641f8b (which change the CRC32 hashes of the
scripts and thus cause archives to be regenerated):

* gix-index/tests/fixtures/generated-archives/v2_icase_name_clashes.tar
* gix-worktree-state/tests/fixtures/generated-archives/make_dangling_symlink.tar
* gix/tests/fixtures/generated-archives/make_rev_spec_parse_repos.tar

Second, there are those that were already being generated when the
tests were run, rather than using the committed archives:

* gix-diff/tests/fixtures/generated-archives/make_diff_repo.tar
* gix-odb/tests/fixtures/generated-archives/make_repo_multi_index.tar

These were being generated every time that `nextest` command was
run on Unix-like systems (or at least GNU/Linux and macOS). I don't
know why this was happening, but it suggests a bug somewhere.

- That oddity precedes 55c635a (GitoxideLabs#1425), I just didn't commit the
  two archives not related to the changes being made there at that
  time, since unlike here, that was not a cleanup PR.

- It precedes, or mostly precedes, the change in dcab79a (GitoxideLabs#1415). At
  least the first of those archives, make_diff_repo.tar, already
  behaved this way in its .tar.xz form before that, as noted in:
  GitoxideLabs#1361 (comment)
@Byron Byron merged commit 7330844 into GitoxideLabs:main Jul 1, 2024
19 checks passed
@EliahKagan EliahKagan deleted the heredocs branch July 1, 2024 07:28
Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

I ran cargo nextest run --all --no-fail-fast on MacOS right after gix clean -xd -m '*generated*' -e to assure nothing gets regenerated due to 'wonkiness', and found that gix-diff/tests/fixtures/generated-archives/make_diff_repo.tar is indeed regenerated.

Something certainly is fishy here as the implementation should see that there is an archive, and use it if present to create the extracted folder on disk. That wouldn't happen if the archive doesn't match the script, which is when script is executed and the archive is overwritten.

Assuming this works, I have committed the changed file whose diff is appended for completeness.

Ideally, this will now be stable whereever it is run.

Edit: Somehow I managed to merge this branch before pushing my adjustments, but they are all in main now.

diff --git a/gix-diff/tests/fixtures/generated-archives/make_diff_repo.tar b/gix-diff/tests/fixtures/generated-archives/make_diff_repo.tar
index c0a10aab0..1be3f74ad 100644
--- a/gix-diff/tests/fixtures/generated-archives/make_diff_repo.tar
+++ b/gix-diff/tests/fixtures/generated-archives/make_diff_repo.tar
@@ -1,185 +1,183 @@
 ./
 .git
-.git/info
-.git/info/exclude
-.git/HEAD
+.git/COMMIT_EDITMSG
 .git/index
+.git/refs
+.git/refs/tags
+.git/refs/heads
+.git/refs/heads/main
+.git/hooks
+.git/hooks/push-to-checkout.sample
+.git/hooks/update.sample
+.git/hooks/pre-push.sample
+.git/hooks/pre-applypatch.sample
+.git/hooks/pre-merge-commit.sample
+.git/hooks/post-update.sample
+.git/hooks/prepare-commit-msg.sample
+.git/hooks/pre-receive.sample
+.git/hooks/fsmonitor-watchman.sample
+.git/hooks/applypatch-msg.sample
+.git/hooks/pre-commit.sample
+.git/hooks/pre-rebase.sample
+.git/hooks/commit-msg.sample
+.git/description
 .git/logs
-.git/logs/HEAD
 .git/logs/refs
 .git/logs/refs/heads
 .git/logs/refs/heads/main
-.git/COMMIT_EDITMSG
+.git/logs/HEAD
+.git/info
+.git/info/exclude
+.git/HEAD
 .git/objects
-.git/objects/e1
-.git/objects/e1/c624c23efff3715aa92f0366558ab67130daec
-.git/objects/e1/3ff16ca35bf267112857fa17b597e22d31835b
-.git/objects/pack
-.git/objects/7e
-.git/objects/7e/b808e9bdb55a257727481adc18f3c969d22ed3
-.git/objects/7e/26dba59b6336f87d1d4ae3505a2da302b91c76
+.git/objects/13
+.git/objects/13/c2aca72ab576cb5f22dc8e7f8ba8ddab553a8a
 .git/objects/47
 .git/objects/47/df420a42032aeb94cc4c1a6448b2a4add28c89
-.git/objects/d7
-.git/objects/d7/60140f06f849b0dd3e40bb0013cac725502d14
-.git/objects/10
-.git/objects/10/f2f4b82222d2b5c31985130979a91fd87410f7
-.git/objects/bc
-.git/objects/bc/7dc11734b580f6778271080e75c266be39dd87
 .git/objects/2e
 .git/objects/2e/65efe2a145dda7ee51d1741299f848e5bf752e
-.git/objects/4b
-.git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904
-.git/objects/ac
-.git/objects/ac/5bc2db41fa428a61f296be4e7aa8afa21601db
-.git/objects/3d
-.git/objects/3d/5a503f4062d198b443db5065ca727f8354e7df
-.git/objects/3a
-.git/objects/3a/ed285fe73e669527888715e8b13f708089bb15
+.git/objects/49
+.git/objects/49/6d6428b9cf92981dc9495211e6e1120fb6f2ba
+.git/objects/82
+.git/objects/82/8bab5b4a116385fbec3bd5cffa38a41dfc72f3
+.git/objects/71
+.git/objects/71/47b5263fac5ed4e8e97b5b2820936ec1172844
+.git/objects/12
+.git/objects/12/4f8a8a4b36d15f4886c35941de26b22b1b78cf
+.git/objects/84
+.git/objects/84/9bd76db90b65ebbd2e6d3970ca70c96ee5592c
+.git/objects/1e
+.git/objects/1e/145741122cb04ebabd63dce8f42dea396b1884
+.git/objects/70
+.git/objects/70/1508d0ec9df008fd3366b0db27b5b1952f431b
+.git/objects/41
+.git/objects/41/72824a06962aa5971023775a0cd6ccaeac9b9b
 .git/objects/f8
 .git/objects/f8/4fc275158a2973cb4a79b1618b79ec7f573a95
-.git/objects/53
-.git/objects/53/2053ba55ee05fe58098dfaa99f2a3ba086bef3
+.git/objects/f1
+.git/objects/f1/790a6e933e7aa88fb2269bd86e76c87df84c33
+.git/objects/e9
+.git/objects/e9/0ae1f6503efcea19b56ca24eed9feb5cf3b077
+.git/objects/c2
+.git/objects/c2/57dfdd0b82d7bf4949c66b00837cab7855bdc3
+.git/objects/e8
+.git/objects/e8/bdb2475f33885c7d76a8ca0097d6e18e384817
+.git/objects/f7
+.git/objects/f7/642c5b9aabd73eca5ceab1e1c0e2c51b745372
+.git/objects/f9
+.git/objects/f9/d206d562b04c001c0dbce207e4420937763d59
+.git/objects/e6
+.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
 .git/objects/cc
 .git/objects/cc/5d4284295a394dd4bf7175940de4f0342e5bd0
-.git/objects/84
-.git/objects/84/9bd76db90b65ebbd2e6d3970ca70c96ee5592c
-.git/objects/92
-.git/objects/92/1e6fa4af7800aef8f8dbca3a6690e2f9fba4c8
-.git/objects/4c
-.git/objects/4c/866d549e9a57d2bf8a41041c46c82c2bc657be
-.git/objects/b4
-.git/objects/b4/b41728eb58c1b74fa1a662e4c121aee272a266
+.git/objects/cd
+.git/objects/cd/25fd76348ee6a10bef22c2b61bcf74368012f2
+.git/objects/e1
+.git/objects/e1/3ff16ca35bf267112857fa17b597e22d31835b
+.git/objects/e1/c624c23efff3715aa92f0366558ab67130daec
 .git/objects/aa
 .git/objects/aa/eae71d3d58640bb52b72f49c77045aecaff87f
-.git/objects/12
-.git/objects/12/4f8a8a4b36d15f4886c35941de26b22b1b78cf
-.git/objects/89
-.git/objects/89/1d289d13e1f6edb5249c5db38eece219502ed5
-.git/objects/19
-.git/objects/19/166c6735d68677f30a1c56d1ffc51a34f6ee24
-.git/objects/info
-.git/objects/35
-.git/objects/35/3d9f0444775a2ae7f6c8a444a739b3a99154e3
+.git/objects/d3
+.git/objects/d3/6d05d8bb75ee8dff9aa3bd619f5111c9cb1e6f
+.git/objects/0a
+.git/objects/0a/d7f85a71fc030988750732c507878b3521d767
+.git/objects/97
+.git/objects/97/811d89c8629c25690991f1e68dc32d0783656f
+.git/objects/52
+.git/objects/52/474c4cccbc085d6997684672508550ece0d57f
 .git/objects/01
 .git/objects/01/72075359eb23bbbc98dd0325c48b83be919666
-.git/objects/0d
-.git/objects/0d/f4d0ed769eacd0a231e7512fca25d3cabdeca4
+.git/objects/37
+.git/objects/37/019831df2f19007bf4d8bedc5f0b41ac39e447
+.git/objects/53
+.git/objects/53/2053ba55ee05fe58098dfaa99f2a3ba086bef3
 .git/objects/54
 .git/objects/54/ffdaed5ed85805dbf4af76d363898d0a35bc6a
-.git/objects/74
-.git/objects/74/5e7743da0fe34263a37ac8dcccb8daf454cebd
-.git/objects/1e
-.git/objects/1e/145741122cb04ebabd63dce8f42dea396b1884
-.git/objects/cd
-.git/objects/cd/25fd76348ee6a10bef22c2b61bcf74368012f2
-.git/objects/0a
-.git/objects/0a/d7f85a71fc030988750732c507878b3521d767
+.git/objects/3a
+.git/objects/3a/ed285fe73e669527888715e8b13f708089bb15
+.git/objects/info
 .git/objects/09
 .git/objects/09/da14b57d2cbe242d9d704362a9dbc219ccd3e0
-.git/objects/c9
-.git/objects/c9/435ffc0315dcb76735f78d3a98e1cba2064e88
-.git/objects/e6
-.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
-.git/objects/eb
-.git/objects/eb/be0b3000afdfd1aed15000094b59a2800328eb
-.git/objects/13
-.git/objects/13/c2aca72ab576cb5f22dc8e7f8ba8ddab553a8a
-.git/objects/52
-.git/objects/52/474c4cccbc085d6997684672508550ece0d57f
-.git/objects/1f
-.git/objects/1f/2210e7080895673c264ba4a96aebef27a9b3f4
-.git/objects/97
-.git/objects/97/811d89c8629c25690991f1e68dc32d0783656f
-.git/objects/e9
-.git/objects/e9/0ae1f6503efcea19b56ca24eed9feb5cf3b077
-.git/objects/49
-.git/objects/49/6d6428b9cf92981dc9495211e6e1120fb6f2ba
-.git/objects/70
-.git/objects/70/1508d0ec9df008fd3366b0db27b5b1952f431b
-.git/objects/82
-.git/objects/82/8bab5b4a116385fbec3bd5cffa38a41dfc72f3
+.git/objects/6e
+.git/objects/6e/5931346904b020301f74f581142826eacc4678
+.git/objects/9f
+.git/objects/9f/22d83e63bf29a566e7c1212cb7143edc55ae6d
+.git/objects/21
+.git/objects/21/295bf386be9445b2bdaac6627613a2c6d61c2d
+.git/objects/4c
+.git/objects/4c/866d549e9a57d2bf8a41041c46c82c2bc657be
+.git/objects/19
+.git/objects/19/166c6735d68677f30a1c56d1ffc51a34f6ee24
+.git/objects/10
+.git/objects/10/f2f4b82222d2b5c31985130979a91fd87410f7
+.git/objects/7e
+.git/objects/7e/26dba59b6336f87d1d4ae3505a2da302b91c76
+.git/objects/7e/b808e9bdb55a257727481adc18f3c969d22ed3
 .git/objects/28
 .git/objects/28/ce6a8b26aa170e1de65536fe8abe1832bd3242
 .git/objects/28/5059a67c7fc8c8bfdadcacc632a89c1c959f7e
-.git/objects/41
-.git/objects/41/72824a06962aa5971023775a0cd6ccaeac9b9b
-.git/objects/04
-.git/objects/04/1c4e23f042c73e1fa1691c10a7fc2fdb68bfc7
+.git/objects/74
+.git/objects/74/5e7743da0fe34263a37ac8dcccb8daf454cebd
 .git/objects/87
 .git/objects/87/2c22a871f493f630819db07adbd7cc999dba72
-.git/objects/f1
-.git/objects/f1/790a6e933e7aa88fb2269bd86e76c87df84c33
-.git/objects/c2
-.git/objects/c2/57dfdd0b82d7bf4949c66b00837cab7855bdc3
-.git/objects/e8
-.git/objects/e8/bdb2475f33885c7d76a8ca0097d6e18e384817
-.git/objects/6a
-.git/objects/6a/eb7e968397af00cd99637aa5644e039b6c2e5e
+.git/objects/1f
+.git/objects/1f/2210e7080895673c264ba4a96aebef27a9b3f4
+.git/objects/89
+.git/objects/89/1d289d13e1f6edb5249c5db38eece219502ed5
 .git/objects/42
 .git/objects/42/4cc064501996dcab13490081eb79ae8364f1a1
-.git/objects/05
-.git/objects/05/1d615be6c46fc22e86f4f73816b0c2d48f3068
-.git/objects/9f
-.git/objects/9f/22d83e63bf29a566e7c1212cb7143edc55ae6d
-.git/objects/b2
-.git/objects/b2/6903ddc45362fe7201e45a5a84d080b9a32ea5
-.git/objects/f7
-.git/objects/f7/642c5b9aabd73eca5ceab1e1c0e2c51b745372
-.git/objects/68
-.git/objects/68/f266d6da344bec51f02d35619a0c7e22d57075
-.git/objects/71
-.git/objects/71/47b5263fac5ed4e8e97b5b2820936ec1172844
+.git/objects/pack
+.git/objects/4b
+.git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904
 .git/objects/fe
 .git/objects/fe/a5a8af496b35abe8cb3fab52e6cf9e0f3c4624
-.git/objects/66
-.git/objects/66/68372986c1e5863dba702dddc6a31344caf161
-.git/objects/66/7cbcc4e8eb2248e7416cd3f12d9348f9f8ffd2
-.git/objects/d3
-.git/objects/d3/6d05d8bb75ee8dff9aa3bd619f5111c9cb1e6f
+.git/objects/c9
+.git/objects/c9/435ffc0315dcb76735f78d3a98e1cba2064e88
+.git/objects/eb
+.git/objects/eb/be0b3000afdfd1aed15000094b59a2800328eb
 .git/objects/f4
 .git/objects/f4/865c885c15f06cc58a5483f16d039e388db69d
-.git/objects/37
-.git/objects/37/019831df2f19007bf4d8bedc5f0b41ac39e447
-.git/objects/21
-.git/objects/21/295bf386be9445b2bdaac6627613a2c6d61c2d
+.git/objects/bc
+.git/objects/bc/7dc11734b580f6778271080e75c266be39dd87
+.git/objects/b4
+.git/objects/b4/b41728eb58c1b74fa1a662e4c121aee272a266
 .git/objects/d0
-.git/objects/d0/5be6cc8c706b48905b9b1eed3e306e4ef8dd88
 .git/objects/d0/93906596024bc69ae23d7e52d572d94857b744
-.git/objects/f9
-.git/objects/f9/d206d562b04c001c0dbce207e4420937763d59
-.git/objects/6e
-.git/objects/6e/5931346904b020301f74f581142826eacc4678
-.git/hooks
-.git/hooks/pre-rebase.sample
-.git/hooks/fsmonitor-watchman.sample
-.git/hooks/commit-msg.sample
-.git/hooks/push-to-checkout.sample
-.git/hooks/pre-receive.sample
-.git/hooks/sendemail-validate.sample
-.git/hooks/pre-merge-commit.sample
-.git/hooks/pre-commit.sample
-.git/hooks/prepare-commit-msg.sample
-.git/hooks/pre-push.sample
-.git/hooks/update.sample
-.git/hooks/pre-applypatch.sample
-.git/hooks/post-update.sample
-.git/hooks/applypatch-msg.sample
+.git/objects/d0/5be6cc8c706b48905b9b1eed3e306e4ef8dd88
+.git/objects/d7
+.git/objects/d7/60140f06f849b0dd3e40bb0013cac725502d14
+.git/objects/ac
+.git/objects/ac/5bc2db41fa428a61f296be4e7aa8afa21601db
+.git/objects/b2
+.git/objects/b2/6903ddc45362fe7201e45a5a84d080b9a32ea5
+.git/objects/05
+.git/objects/05/1d615be6c46fc22e86f4f73816b0c2d48f3068
+.git/objects/3d
+.git/objects/3d/5a503f4062d198b443db5065ca727f8354e7df
+.git/objects/35
+.git/objects/35/3d9f0444775a2ae7f6c8a444a739b3a99154e3
+.git/objects/6a
+.git/objects/6a/eb7e968397af00cd99637aa5644e039b6c2e5e
+.git/objects/04
+.git/objects/04/1c4e23f042c73e1fa1691c10a7fc2fdb68bfc7
+.git/objects/68
+.git/objects/68/f266d6da344bec51f02d35619a0c7e22d57075
+.git/objects/66
+.git/objects/66/7cbcc4e8eb2248e7416cd3f12d9348f9f8ffd2
+.git/objects/66/68372986c1e5863dba702dddc6a31344caf161
+.git/objects/92
+.git/objects/92/1e6fa4af7800aef8f8dbca3a6690e2f9fba4c8
+.git/objects/0d
+.git/objects/0d/f4d0ed769eacd0a231e7512fca25d3cabdeca4
 .git/config
-.git/description
-.git/refs
-.git/refs/heads
-.git/refs/heads/main
-.git/refs/tags
-.git/branches
 a
+a/git-sec
+a/git-sec/2
 a/git-sequencer
 a/h
 a/a
 a/gix
 a/gix/5
-a/git-sec
-a/git-sec/2
 __gitoxide_meta__
-__gitoxide_meta__/git-version
 __gitoxide_meta__/identity
+__gitoxide_meta__/git-version

@EliahKagan
Copy link
Member Author

EliahKagan commented Jul 4, 2024

I have found that the problem with gix-diff/tests/fixtures/generated-archives/make_diff_repo.tar still persists even after that change, on both Ubuntu and macOS. I've investigated further and opened #1440 for this.

By the way, thank you for the recommendation of gix clean -xd -m '*generated*' -e to clean up the non-committed files of generated fixtures! You may have meant just to report using it yourself rather than to suggest I use it, but it helped me quite a bit as I was looking into this today. I'm in the habit of running gix clean -xde, and while that more extensive clean has some advantages and has helped me investigate broader (now fixed) issues affecting the whole test suite, it would have made the research behind #1440 take much longer, with little benefit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants