Skip to content
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

Tweak formatting of input digest diffs #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lencioni
Copy link

@lencioni lencioni commented Mar 8, 2022

The current formatting ends up looking like this:

bazel-out/k8-fastbuild/bin/path/to/file.tar.gz: hash: "b5b1169371c657146115147232068d1a04e88ca52df7de4f522bbc9fc3209606"
size_bytes: 428915
hash_function_name: "SHA-256"
 hash: "747563ba65ac0f390ef1c983d189cdfeb6abb24c14b57ac34e9f101e6b847696"
size_bytes: 428914
hash_function_name: "SHA-256"

I am hoping to make this more readable. With this change I think the
format will end up looking more like this:

bazel-out/k8-fastbuild/bin/path/to/file.tar.gz:

hash: "b5b1169371c657146115147232068d1a04e88ca52df7de4f522bbc9fc3209606"
size_bytes: 428915
hash_function_name: "SHA-256"

hash: "747563ba65ac0f390ef1c983d189cdfeb6abb24c14b57ac34e9f101e6b847696"
size_bytes: 428914
hash_function_name: "SHA-256"

I think this could be taken a step further to collapse the hash and
hash_function_name onto the same line like this:

bazel-out/k8-fastbuild/bin/path/to/file.tar.gz:

SHA-256: "b5b1169371c657146115147232068d1a04e88ca52df7de4f522bbc9fc3209606"
size_bytes: 428915

SHA-256: "747563ba65ac0f390ef1c983d189cdfeb6abb24c14b57ac34e9f101e6b847696"
size_bytes: 428914

But I'm not familiar with the shape of these digests so I didn't want to
bake in any logic to do this if it doesn't always apply.

This could also potentially be improved by producing a diff, like this:

 bazel-out/k8-fastbuild/bin/path/to/file.tar.gz:

-SHA-256: "b5b1169371c657146115147232068d1a04e88ca52df7de4f522bbc9fc3209606"
+SHA-256: "747563ba65ac0f390ef1c983d189cdfeb6abb24c14b57ac34e9f101e6b847696"
-size_bytes: 428915
+size_bytes: 428914

But I decided to keep this change relatively simple for now.

The current formatting ends up looking like this:

```
bazel-out/k8-fastbuild/bin/path/to/file.tar.gz: hash: "b5b1169371c657146115147232068d1a04e88ca52df7de4f522bbc9fc3209606"
size_bytes: 428915
hash_function_name: "SHA-256"
 hash: "747563ba65ac0f390ef1c983d189cdfeb6abb24c14b57ac34e9f101e6b847696"
size_bytes: 428914
hash_function_name: "SHA-256"

```

I am hoping to make this more readable. With this change I think the
format will end up looking more like this:

```
bazel-out/k8-fastbuild/bin/path/to/file.tar.gz:

hash: "b5b1169371c657146115147232068d1a04e88ca52df7de4f522bbc9fc3209606"
size_bytes: 428915
hash_function_name: "SHA-256"

hash: "747563ba65ac0f390ef1c983d189cdfeb6abb24c14b57ac34e9f101e6b847696"
size_bytes: 428914
hash_function_name: "SHA-256"

```

I think this could be taken a step further to collapse the hash and
hash_function_name onto the same line like this:

```
bazel-out/k8-fastbuild/bin/path/to/file.tar.gz:

SHA-256: "b5b1169371c657146115147232068d1a04e88ca52df7de4f522bbc9fc3209606"
size_bytes: 428915

SHA-256: "747563ba65ac0f390ef1c983d189cdfeb6abb24c14b57ac34e9f101e6b847696"
size_bytes: 428914

```

But I'm not familiar with the shape of these digests so I didn't want to
bake in any logic to do this if it doesn't always apply.

This could also potentially be improved by producing a diff, like this:

```diff
 bazel-out/k8-fastbuild/bin/path/to/file.tar.gz:

-SHA-256: "b5b1169371c657146115147232068d1a04e88ca52df7de4f522bbc9fc3209606"
+SHA-256: "747563ba65ac0f390ef1c983d189cdfeb6abb24c14b57ac34e9f101e6b847696"
-size_bytes: 428915
+size_bytes: 428914
```

But I decided to keep this change relatively simple for now.
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.

1 participant