FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

submodule: Try to fetch when update fails to find the target commit. by hackhaslam · Pull Request #3813 · libgit2/libgit2 · GitHub

Repository navigation

submodule: Try to fetch when update fails to find the target commit. - #3813

Merged
ethomson merged 1 commit into
libgit2:masterfrom
stinb:submodule-update-fetch
Jun 29, 2016
Merged

ethomson merged 1 commit into
libgit2:masterfrom
stinb:submodule-update-fetch

Conversation

hackhaslam commented Jun 7, 2016 •
edited
Loading

Copy link
Copy Markdown
Contributor

This fixes #3783. When submodule update doesn't find the target commit in the submodule, fetch from the default remote and then try to lookup the commit again.

Copy link
Copy Markdown
Member

@jamill Would you have a moment to spare a second set of eyes here? I realize that you're not spending as much time with submodules these days, but you certainly still know more about them than I do. :)

Comment thread src/submodule.c
* Look up the target commit in the submodule.
* If it isn't found then fetch and try again.
*/
if ((error = git_object_lookup(&target_commit, sub_repo, git_submodule_index_id(sm), GIT_OBJ_COMMIT)) < 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Is there a specific error code that is returned when the target commit could not be found? Could we be more selective and only attempt to fetch for the not found error?

jamill commented Jun 14, 2016

Copy link
Copy Markdown
Member

Looks OK to me - and I think this matches the expected behavior. I might also suggest updating the comments for this function to clarify that this will fetch if there are missing commits. Thanks!

hackhaslam force-pushed the submodule-update-fetch branch from b793016 to 9223905 Compare June 16, 2016 01:48

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I restricted the fetch logic to the not found error, and changed the documenation comment to mention the new behavior. I also made a slight drive-by fix for a duplicate check in the clone side.

I'm noticing now that submodule update has a -no-fetch flag. Maybe there should be a no_fetch flag in the submodule update options? Probably not a big deal though.

hackhaslam force-pushed the submodule-update-fetch branch from 9223905 to 980c199 Compare June 16, 2016 16:40

Copy link
Copy Markdown
Member

I'm noticing now that submodule update has a -no-fetch flag. Maybe there should be a no_fetch flag in the submodule update options? Probably not a big deal though.

I agree, that would be a really nice option. Is this something you want to tackle in this PR or do you want me to merge this and tackle this later?

Copy link
Copy Markdown
Contributor Author

I guess that I should probably add it in this PR so that I don't forget it. I'll add it soon.

hackhaslam force-pushed the submodule-update-fetch branch from 980c199 to de43efc Compare June 29, 2016 04:30

Copy link
Copy Markdown
Contributor Author

I added the flag. I also made another small drive-by fix to the version used in the update options initializer.

Copy link
Copy Markdown
Member

I also made another small drive-by fix to the version used in the update options initializer.

Good catch on that one. 👌 Thanks!

ethomson merged commit 59a0005 into libgit2:master Jun 29, 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

git_submodule_update doesn't fetch

3 participants


Back | FazBrowse Home | New Git URL