Skip to content

Turned the extern integer fetch_if_missing into field of struct repository - #650

Closed
ghost wants to merge 3 commits into
masterfrom
unknown repository
Closed

Turned the extern integer fetch_if_missing into field of struct repository #650
ghost wants to merge 3 commits into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Sep 22, 2019

Copy link
Copy Markdown

Hi GIT contributors !
I am Shubham Ghule.I have resolved the problem of extern integer fetch_if_missing by putting it in the structure repository as a field.I have achieved this by declaring an object named repo of structure repository and including alloc.h file where fetch_if_missing was used.
I'm looking forward to your review.
Special thanks to @dscho.
with regards,
Shubham.

@ghost ghost changed the title I have changed the extern integer fetch_if_missing into a field of struct repository Turned the extern integer fetch_if_missing into a field of struct repository Sep 22, 2019
@ghost ghost changed the title Turned the extern integer fetch_if_missing into a field of struct repository Turned the extern integer fetch_if_missing into field of struct repository Sep 22, 2019

@dscho dscho left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These changes should probably all be consolidated into a single patch.

Please have a look at other commits touching e.g. repository.c for inspiration with the commit message: the Git project strongly prefers verbose commit messages, in the imperative tense instead of the past tense.

Finally, I see that there are merge conflicts. Please rebase the changes on top of the target branch.

Comment thread alloc.h
struct repository
{
int fetch_if_missing;
}repo;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In this header, this is just a forward declaration of struct repository. The actual struct is defined in repository.h. You probably want to add the field there.

Comment thread builtin/pack-objects.c
if (!strcmp(arg, "allow-any")) {
arg_missing_action = MA_ALLOW_ANY;
fetch_if_missing = 0;
repo.fetch_if_missing = 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

At this point, there is no variable repo. The variable you are looking for is probably the_repository, and as it is a pointed, you need to use -> rather than . to dereference it.

Comment thread fetch-object.c
{
struct remote *remote;
struct transport *transport;
int original_fetch_if_missing = fetch_if_missing;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This line also needs to be adjusted.

Comment thread revision.c
} else if (opt && opt->allow_exclude_promisor_objects &&
!strcmp(arg, "--exclude-promisor-objects")) {
if (fetch_if_missing)
if (repo.fetch_if_missing)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IIRC struct rev_info contains a pointer to the repository in question. repo does not exist at this point.

Comment thread fetch-object.c
int original_fetch_if_missing = fetch_if_missing;

fetch_if_missing = 0;
repo.fetch_if_missing = 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You will need to adjust the signature of fetch_refs() to receive a pointer to the repository, the convention is to use struct repository *r.

Comment thread sha1-file.c
}

int fetch_if_missing = 1;
repo.fetch_if_missing = 1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That is not the correct spot to initialize default values of structs. The correct spot is repo_init() in repository.c.

Comment thread sha1-file.c

/* Check if it is a missing object */
if (fetch_if_missing && repository_format_partial_clone &&
if (repo.fetch_if_missing && repository_format_partial_clone &&

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This function already accepts a parameter r of type struct repository *, please use that instead of the non-existing repo variable.

@dscho

dscho commented Oct 10, 2019

Copy link
Copy Markdown
Member

@dev-shubham1 gentle ping?

@ghost ghost closed this Oct 13, 2019
derrickstolee pushed a commit to derrickstolee/git that referenced this pull request May 31, 2024
I noticed the `osx-gcc` job failing in git#647 so I found this upstream fix
from @peff. Merging now to unblock PR builds in `microsoft/git`.
derrickstolee pushed a commit to derrickstolee/git that referenced this pull request Jun 19, 2024
I noticed the `osx-gcc` job failing in git#647 so I found this upstream fix
from @peff. Merging now to unblock PR builds in `microsoft/git`.
This pull request was closed.
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