gitgitgadget / git

GitGitGadget's Git fork. Open Pull Requests here to submit them to the Git mailing list
https://gitgitgadget.github.io/
Other
208 stars 135 forks source link

Symlink resolutions: limits and return modes #1751

Closed migue closed 1 month ago

migue commented 2 months ago

It can be useful to limit the number of symlink resolutions performed while looking for a tree entry. The goal is to provide the ability to resolve up to a particular depth, instead of reaching the end of the link chain.

In addition, I would like to extend the symlink resolution process and provide the ability to return the object found at the designated depth instead of returning an error.

The current code already provides a limit to the maximum number of resolutions that can be performed, and something similar to this is returned to the caller:

loop SP <size> LF
<object> LF

With these patches, we are looking to return the actual information of the object where the resolution stopped. Something similar to:

<oid> blob <size>\nndata\n
gitgitgadget[bot] commented 2 months ago

Welcome to GitGitGadget

Hi @migue, and welcome to GitGitGadget, the GitHub App to send patch series to the Git mailing list from GitHub Pull Requests.

Please make sure that either:

You can CC potential reviewers by adding a footer to the PR description with the following syntax:

CC: Revi Ewer <revi.ewer@example.com>, Ill Takalook <ill.takalook@example.net>

Also, it is a good idea to review the commit messages one last time, as the Git project expects them in a quite specific form:

It is in general a good idea to await the automated test ("Checks") in this Pull Request before contributing the patches, e.g. to avoid trivial issues such as unportable code.

Contributing the patches

Before you can contribute the patches, your GitHub username needs to be added to the list of permitted users. Any already-permitted user can do that, by adding a comment to your PR of the form /allow. A good way to find other contributors is to locate recent pull requests where someone has been /allowed:

Both the person who commented /allow and the PR author are able to /allow you.

An alternative is the channel #git-devel on the Libera Chat IRC network:

<newcontributor> I've just created my first PR, could someone please /allow me? https://github.com/gitgitgadget/git/pull/12345
<veteran> newcontributor: it is done
<newcontributor> thanks!

Once on the list of permitted usernames, you can contribute the patches to the Git mailing list by adding a PR comment /submit.

If you want to see what email(s) would be sent for a /submit request, add a PR comment /preview to have the email(s) sent to you. You must have a public GitHub email address for this. Note that any reviewers CC'd via the list in the PR description will not actually be sent emails.

After you submit, GitGitGadget will respond with another comment that contains the link to the cover letter mail in the Git mailing list archive. Please make sure to monitor the discussion in that thread and to address comments and suggestions (while the comments and suggestions will be mirrored into the PR by GitGitGadget, you will still want to reply via mail).

If you do not want to subscribe to the Git mailing list just to be able to respond to a mail, you can download the mbox from the Git mailing list archive (click the (raw) link), then import it into your mail program. If you use GMail, you can do this via:

curl -g --user "<EMailAddress>:<Password>" \
    --url "imaps://imap.gmail.com/INBOX" -T /path/to/raw.txt

To iterate on your change, i.e. send a revised patch or patch series, you will first want to (force-)push to the same branch. You probably also want to modify your Pull Request description (or title). It is a good idea to summarize the revision by adding something like this to the cover letter (read: by editing the first comment on the PR, i.e. the PR description):

Changes since v1:
- Fixed a typo in the commit message (found by ...)
- Added a code comment to ... as suggested by ...
...

To send a new iteration, just add another PR comment with the contents: /submit.

Need help?

New contributors who want advice are encouraged to join git-mentoring@googlegroups.com, where volunteers who regularly contribute to Git are willing to answer newbie questions, give advice, or otherwise provide mentoring to interested contributors. You must join in order to post or view messages, but anyone can join.

You may also be able to find help in real time in the developer IRC channel, #git-devel on Libera Chat. Remember that IRC does not support offline messaging, so if you send someone a private message and log out, they cannot respond to you. The scrollback of #git-devel is archived, though.

gitgitgadget[bot] commented 2 months ago

There are issues in commit 5285b4709283fa5e5819ac0bbf3c39ac120c3ac7: Make the number of symlink resolutions configurable Lines in the body of the commit messages should be wrapped between 60 and 76 characters. Indented lines, and lines without whitespace, are exempt

gitgitgadget[bot] commented 2 months ago

There are issues in commit cc23c8fff687d78c343c200babc5fa03467d5b11: Make the results of symlink resolution configurable Lines in the body of the commit messages should be wrapped between 60 and 76 characters. Indented lines, and lines without whitespace, are exempt

dscho commented 2 months ago

/allow

gitgitgadget[bot] commented 2 months ago

User migue is now allowed to use GitGitGadget.

migue commented 2 months ago

@dscho Thanks a lot for taking the time to review this ๐Ÿ™‡ !

I have included the cat-file in both commit messages and added some additional comments in the second one. I would be happy to rephrase the second one if you think it's not clear enough.

On a different topic, I saw one windows related build failing in my previous push. I don't think it's related to my changes but I don't really know ๐Ÿ˜…

Again, thanks a lot for taking a look at this!!

dscho commented 2 months ago

I have included the cat-file in both commit messages and added some additional comments in the second one. I would be happy to rephrase the second one if you think it's not clear enough.

Thank you @migue! Personally, I would lead with the "best-effort" paragraph in the commit message, and then explain the more technical mechanics of the patch. But it's your contribution (not mine ๐Ÿ˜), and if you want to mention it at the end, that's fine, too.

On a different topic, I saw one windows related build failing in my previous push. I don't think it's related to my changes but I don't really know ๐Ÿ˜…

Yes, it failed with a cryptic "No plan found in TAP output" message. These happen in the Windows tests from time to time, I still haven't found out what is going on exactly, my working theory is that file/directory creation/deletion fails due to Defender doing its job. I saw that failure and re-ran the failed jobs so that your imminent force-push would result in a quick CI run due to the tree-same check finding an already-successful run for a tree-same commit.

Sorry for not telling you that I did that!

migue commented 2 months ago

Yes, it failed with a cryptic "No plan found in TAP output" message. These happen in the Windows tests from time to time, I still haven't found out what is going on exactly, my working theory is that file/directory creation/deletion fails due to Defender doing its job. I saw that failure and re-ran the failed jobs so that your imminent force-push would result in a quick CI run due to the tree-same check finding an already-successful run for a tree-same commit.

Thanks a lot for the context!!

Thank you @migue! Personally, I would lead with the "best-effort" paragraph in the commit message, and then explain the more technical mechanics of the patch. But it's your contribution (not mine ๐Ÿ˜), and if you want to mention it at the end, that's fine, too.

Reordered the message a bit, let me know if you think it's better now

dscho commented 2 months ago

Reordered the message a bit, let me know if you think it's better now

Thank you @migue. I think it is better now!

migue commented 2 months ago

/preview

gitgitgadget[bot] commented 2 months ago

Preview email sent as pull.1751.git.1718614485.gitgitgadget@gmail.com

migue commented 2 months ago

/submit

gitgitgadget[bot] commented 2 months ago

Submitted as pull.1751.git.1718615028.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-1751/migue/migue/follow-symlinks-max-depth-v1

To fetch this version to local tag pr-1751/migue/migue/follow-symlinks-max-depth-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-1751/migue/migue/follow-symlinks-max-depth-v1
gitgitgadget[bot] commented 2 months ago

On the Git mailing list, Junio C Hamano wrote (reply to this):

"Miguel รngel Pastor Olivar via GitGitGadget"
<gitgitgadget@gmail.com> writes:

> The current code already provides a limit to the maximum number of
> resolutions that can be performed, and something similar to this is returned
> to the caller:
>
> loop SP <size> LF
> <object> LF
>
>
> With these patches, we are looking to return the actual information of the
> object where the resolution stopped. Something similar to:
>
> <oid> blob <size>\nndata\n

Just a random and idle thought, but is it all that interesting to
learn only about the object at the horizon?

If recursive resolutions are limited to say 3 levels, I wonder if it
is beneficial to give full record from each iteration without losing
information, e.g., saying "A points at B which in turn points at C,
and I stopped there but C is still not the final thing", instead of
saying "I followed links and C was the last one I saw after I
repeated for the maximum number of times the configuration allows me
to".
migue commented 1 month ago

I am not going to pursue this