-
Notifications
You must be signed in to change notification settings - Fork 169
Fix git-last-modified(1) bug triggered when passing a tree-ish #2038
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
base: master
Are you sure you want to change the base?
Conversation
Recently there was a bug reported[1] passing a tree OID triggers a BUG:
$ git last-modified fb06ce04173d47aaaa498385621cba8b8dfd7584
BUG: builtin/last-modified.c:456: paths remaining beyond boundary in last-modified
[1] 690163 IOT instruction (core dumped) git last-modified
`fb06ce04173d47aaaa498385621cba8b8dfd7584` is the tree commit id of web_src. I
suppose this should've returned a nice error message or blank output.
Fix this bug by checking the revision argument.
[1]: https://lore.kernel.org/git/03f96860-29fc-42a7-a220-c3ec65eb8516@codeberg.org/
Cc: Patrick Steinhardt <ps@pks.im>
Cc: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
---
Changes in v6:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v5: https://patch.msgid.link/20260127-toon-last-modified-tree-v5-0-38d18a0956d4@iotcl.com
Changes in v5:
- Use 'commit' instead of 'revision'.
- Small typo fixes.
- Link to v4: https://patch.msgid.link/20260123-toon-last-modified-tree-v4-0-86bf97bad4e2@iotcl.com
Changes in v4:
- Extend the error message when revision is not a tree
- Extend the test to verify the error message when more than one
revision is given.
- Link to v3: https://patch.msgid.link/20260116-toon-last-modified-tree-v3-0-e6ade4dc35ab@iotcl.com
Changes in v3:
- Split the change to plug the leak into a separate commit.
- Small changes to commit messages.
- Link to v2: https://patch.msgid.link/20260114-toon-last-modified-tree-v2-0-ba3b1860898f@iotcl.com
Changes in v2:
- Prepend the change with a commit that modifies the error message
when more than one revision is given.
- Prepend another commit that removes double error message.
- Add test to ensure the command works with annotated tags too.
- Link to v1: https://patch.msgid.link/20260112-toon-last-modified-tree-v1-1-ecbc78341f76@iotcl.com
--- b4-submit-tracking ---
# This section is used internally by b4 prep for tracking purposes.
{
"series": {
"revision": 6,
"change-id": "20260112-toon-last-modified-tree-fdd96b2feaf7",
"prefixes": [],
"presubject": "",
"history": {
"v1": [
"20260112-toon-last-modified-tree-v1-1-ecbc78341f76@iotcl.com"
],
"v2": [
"20260114-toon-last-modified-tree-v2-0-ba3b1860898f@iotcl.com"
],
"v3": [
"20260116-toon-last-modified-tree-v3-0-e6ade4dc35ab@iotcl.com"
],
"v4": [
"20260123-toon-last-modified-tree-v4-0-86bf97bad4e2@iotcl.com"
],
"v5": [
"20260127-toon-last-modified-tree-v5-0-38d18a0956d4@iotcl.com"
]
}
}
}
When more than one commit is passed to the git-last-modified(1) command,
this error message was printed:
error: last-modified can only operate on one tree at a time
Calling these a "tree" is technically not correct. git-last-modified(1)
expects revisions that peel to a commit.
Rephrase the error message to:
error: last-modified can only operate on one commit at a time
While at it, modify the test to ensure the correct error message is
printed.
Signed-off-by: Toon Claes <toon@iotcl.com>
When more than one commit is given, the function populate_paths_from_revs() leaks a `struct pathspec`. Plug it. Signed-off-by: Toon Claes <toon@iotcl.com>
When the user passes two revisions, they get the following output:
$ git last-modified HEAD HEAD~
error: last-modified can only operate on one revision at a time
error: unable to setup last-modified
The error message about "unable to setup" is not very informative,
remove it.
Signed-off-by: Toon Claes <toon@iotcl.com>
|
There are issues in commit 398ac26:
|
|
Pushing here because I saw a CI failure on |
|
Oh it's green. Well, I can close then. |
Passing a non-committish revision to git-last-modified(1) triggers the
following BUG:
git last-modified HEAD^{tree}
BUG: builtin/last-modified.c:456: paths remaining beyond boundary in last-modified
Fix this error by ensuring that the given revision peels to a commit.
Reported-by: Gusted <gusted@codeberg.org>
Signed-off-by: Toon Claes <toon@iotcl.com>
|
@dscho Is it me, or does it seem like the CI job |
always upload reports, not only on failure upload meson logs remove unused script print failures no verbose log with meson it causes us to write somewhere else, but we want it in the meson test log
9a810e1 to
16c4761
Compare
|
There are issues in commit 7da62d2:
|
|
There is an issue in commit 16c4761:
|
Recently there was a bug reported1 passing a tree OID triggers a BUG:
Fix this bug by checking the revision argument.
Cc: Patrick Steinhardt ps@pks.im
Cc: Kristoffer Haugsbakk kristofferhaugsbakk@fastmail.com
Changes in v5:
Changes in v4:
revision is given.
Changes in v3:
Changes in v2:
when more than one revision is given.