-
Notifications
You must be signed in to change notification settings - Fork 134
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
Remove implicit dependency of the_repository
#915
base: master
Are you sure you want to change the base?
Conversation
Welcome to GitGitGadgetHi @chinmoy12c, and welcome to GitGitGadget, the GitHub App to send patch series to the Git mailing list from GitHub Pull Requests. Please make sure that your Pull Request has a good description, as it will be used as cover letter. 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 patchesBefore 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 Both the person who commented An alternative is the channel
Once on the list of permitted usernames, you can contribute the patches to the Git mailing list by adding a PR comment If you want to see what email(s) would be sent for a 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 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):
To send a new iteration, just add another PR comment with the contents: 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, |
There is an issue in commit 51ab74f: |
/allow |
User chinmoy12c is now allowed to use GitGitGadget. WARNING: chinmoy12c has no public email address set on GitHub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether there is another function that can be converted, one that does not require such extensive changes as cache_tree_update()
(because some of its callers are outside of builtin/
, and they, too, need to be converted not to use the_repository
).
unpack-trees.c
Outdated
@@ -1726,7 +1726,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options | |||
if (git_env_bool("GIT_TEST_CHECK_CACHE_TREE", 0)) | |||
cache_tree_verify(the_repository, &o->result); | |||
if (!cache_tree_fully_valid(o->result.cache_tree)) | |||
cache_tree_update(&o->result, | |||
cache_tree_update(the_repository, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, too, we're outside of builtin/
and outside of t/helper/
, so it is not really okay to introduce the_repository
.
In this instance, we should consider putting it into struct unpack_trees_options
, anyway, but that will require a much larger set of changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made the changes in other files. Changing this would need changes to a lot of files. What would you suggest? Should I make the changes to those files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is ultimately up to you: this is a rabbit hole, and it is your decision how far down you want to go.
In general, I would suggest to do the conversion one function signature at a time. All the callers that do not have an r
to work with should get it via a (transitional!) struct repository *r = the_repository;
at the beginning of the function, just like you did here: c977a2a#diff-eeb5ad245cf301bdd1dcd3253bf45156af5171a7dd82abf60ed241a044d704d4R65
Ultimately, we will want to have the entire code base converted, with cmd_*()
functions in builtin/*.c
getting their struct repository *r
passed in as parameter.
But that is probably many, many years down the road. It's also a pretty disruptive set of changes, so it also makes sense to pay attention to what is happening in Git's seen
branch, which is a branch collecting most of the patch series that are currently in flight. If your patches conflict with any of those, it is a safe bet that it would be wise to work on other parts of the code ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I would suggest to do the conversion one function signature at a time. All the callers that do not have an
r
to work with should get it via a (transitional!)struct repository *r = the_repository;
at the beginning of the function, just like you did here: c977a2a#diff-eeb5ad245cf301bdd1dcd3253bf45156af5171a7dd82abf60ed241a044d704d4R65
Okay, I'll try to do this and convert them one at a time for this patch and thereby address individual callers in different patches.
But that is probably many, many years down the road. It's also a pretty disruptive set of changes, so it also makes sense to pay attention to what is happening in Git's
seen
branch, which is a branch collecting most of the patch series that are currently in flight. If your patches conflict with any of those, it is a safe bet that it would be wise to work on other parts of the code ;-)
Yes, I'll be on the lookout for those :). Thanks for helping. 😄
EDIT: Would it be fine to let the function unpack_trees
work with struct repository *r = the_repository;
and then pass r
for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This is totally legitimate, as we want to convert the code base incrementally, to make it substantially easier to review.
There is an issue in commit 970af5a: |
c977a2a
to
764b1a2
Compare
Hey, @dscho could you please take a final look before I submit the patch :) |
cache-tree.h
Outdated
if (!the_index.cache_tree) | ||
the_index.cache_tree = cache_tree(); | ||
return cache_tree_update(&the_index, flags); | ||
return cache_tree_update(r, r->index, flags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might need a bit of explanation... a casual reviewer might point out (and I almost did!) that r->index
is easily deduced from r
, so why not change the signature of cache_tree_update()
to take a struct repository*
instead of a struct index_state *
?
The solution to that riddle is, of course, that you can have temporary indexes. Therefore, you might want to update the cache tree for an index other than r->index
.
Most likely, information like this would be most welcome in the commit message.
Speaking of the commit message: maybe you want to imitate, say, 3a7a698's commit message? It talks a bit about what it does, but also a bit about "why?", and a bit about "what about ...?".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure I'll update this with a proper commit message with that explanation :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pretty good GSoC mini project, "to learn the ropes".
unpack-trees.c
Outdated
@@ -1726,7 +1726,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options | |||
if (git_env_bool("GIT_TEST_CHECK_CACHE_TREE", 0)) | |||
cache_tree_verify(the_repository, &o->result); | |||
if (!cache_tree_fully_valid(o->result.cache_tree)) | |||
cache_tree_update(&o->result, | |||
cache_tree_update(the_repository, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This is totally legitimate, as we want to convert the code base incrementally, to make it substantially easier to review.
Nice 😄 could you suggest a few more good issues to dive deeper into the code. I wanna understand the codebase a bit more properly before working on my proposal 😃 |
From https://github.com/gitgitgadget/git/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22, I would like to highlight #302 (to learn how to build/modify the documentation). It might not look like much, but the mini project really is more about proving that you can efficiently contribute to the Git project (whose contribution process is unfortunately not very welcoming). |
Submitted as pull.915.git.1616701733901.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
On the Git mailing list, Derrick Stolee wrote (reply to this):
|
User |
On the Git mailing list, Chinmoy Chakraborty wrote (reply to this):
|
On the Git mailing list, Chinmoy Chakraborty wrote (reply to this):
|
fa0e766
to
cfa9931
Compare
There is an issue in commit cfa9931: |
@dscho, I made the required fixes on @derrickstolee 's patch. Should I open a PR with this on |
I did not follow that discussion, so I do not know. If the patch in question is a separate fix on top of If you want to extend this PR to cover a fix on top of |
/submit |
Submitted as pull.915.v2.git.1616772930098.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
46e7175
to
2a4fad2
Compare
/submit |
Submitted as pull.915.v3.git.1617465421353.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
On the Git mailing list, Junio C Hamano wrote (reply to this):
|
On the Git mailing list, Chinmoy Chakraborty wrote (reply to this):
|
On the Git mailing list, Chinmoy Chakraborty wrote (reply to this):
|
On the Git mailing list, Junio C Hamano wrote (reply to this):
|
On the Git mailing list, Junio C Hamano wrote (reply to this):
|
On the Git mailing list, Derrick Stolee wrote (reply to this):
|
User |
On the Git mailing list, Junio C Hamano wrote (reply to this):
|
The pull request has 283 commits. The max allowed is 30. Please split the patch series into multiple pull requests. Also consider squashing related commits. |
There is an issue in commit 84cf07d: |
This kills the_repository dependency in cache_tree_update() and prime_cache_tree(). Signed-off-by: Chinmoy Chakraborty <chinmoy12c@gmail.com>
/submit |
Submitted as pull.915.v4.git.1617778489719.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
On the Git mailing list, Junio C Hamano wrote (reply to this):
|
On the Git mailing list, Chinmoy Chakraborty wrote (reply to this):
|
On the Git mailing list, Junio C Hamano wrote (reply to this):
|
the_repository
with r
the_repository
There are multiple files that try to reference
the repository
andthe_index
directly. To follow a more object-orientedconvention these references should be replaced with
r
andindex
, or withistate->repo
and passed through functions.Signed-off-by: Chinmoy Chakraborty chinmoy12c@gmail.com
Related issue
#379
cc: Derrick Stolee stolee@gmail.com
Changes since v3
cc: Derrick Stolee stolee@gmail.com