git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 8/9] fetch: retry fetching submodules if needed objects were not fetched

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Oct 23, 2018, 23:37 UTC
Message-ID
<20181023233756.190026-1-jonathantanmy@google.com>
In-Reply-To
<CAGZ79kZrK5G-EeGRzxyw0xW3ozo9_aPab4r8fn_Jc4hzKDOEwg@mail.gmail.com>
Show 5 quoted lines
> > Another thing you need to clarify is what happens if the fetch-by-commit
> > fails. Right now, it seems that it will make the whole thing fail, which
> > might be a surprising change in behavior.
> 
> But a positive surprise, I would assume?

Whether positive or negative, I think that this needs to be mentioned in the commit message.

As for positive or negative, I tend to agree that it's positive - sure, some previously successful fetches would now fail, but the results of those fetches could not be recursively checked out anyway.

Show 5 quoted lines
> > The test stores the result in a normal branch, not a remote tracking
> > branch. Is storing in a normal branch required?
> 
> In the test we fetch from another repository, such that in the
> repository-under-test this will show up in a remote tracking branch?
If that were true, I would expect that when this line:
> git fetch --recurse-submodules --recurse-submodules-default on-demand origin refs/changes/2:refs/heads/my_branch &&
is replaced by this line:
> git fetch --recurse-submodules --recurse-submodules-default on-demand origin refs/changes/2 &&

then things would still work. The tests pass with the first line (after I fixed a type mismatch) but not with the second. (Also I don't think a remote-tracking branch is generated here - the output printed doesn't indicate so, and refs/changes/2 is not a branch anyway.)

Show 6 quoted lines
> > Also, do you know why this is required? A naive reading of the patch
> > leads me to believe that this should work even if merely fetching to
> > FETCH_HEAD.
> 
> See the next patch, check_for_new_submodule_commits() is missing
> for FETCH_HEAD.

I see in the next patch that there is an "if" branch in store_updated_refs() without update_local_ref() in which "check_for_new_submodule_commits(&rm->old_oid)" needs to be inserted. I think this is a symptom that maybe check_for_new_submodule_commits() needs to be extracted from update_local_ref() and put into store_updated_refs() instead? In update_local_ref(), it is called on ref->new_oid, which is actually the same as rm->old_oid anyway (there is an oidcpy earlier).

Show 22 quoted lines
> > > +static const struct submodule *get_default_submodule(const char *path)
> > > +{
> > > +     struct submodule *ret = NULL;
> > > +     const char *name = default_name_or_path(path);
> > > +
> > > +     if (!name)
> > > +             return NULL;
> > > +
> > > +     ret = xmalloc(sizeof(*ret));
> > > +     memset(ret, 0, sizeof(*ret));
> > > +     ret->path = name;
> > > +     ret->name = name;
> > > +
> > > +     return (const struct submodule *) ret;
> > > +}
> >
> > What is a "default" submodule and why would you need one?
> 
> s/default/artificial/. Such a submodule is a submodule that has no
> config in the .gitmodules file and its name == path.
> We need to keep those around for historic reasons AFAICT, c.f.
> c68f837576 (implement fetching of moved submodules, 2017-10-16)

Ah, OK. I would call it a fake submodule then, and copy over the "No entry in .gitmodules?" comment.

Show 12 quoted lines
> > Will task->sub ever be NULL?
> 
> Yes, if we fall back to these "default" submodule and just try if it
> can be handled
> as a submodule, but it cannot be handled as such,
> get_next_submodule_task_create has
> 
>     task->sub = submodule_from_path(r, &null_oid, path);
>     if (!task->sub) {
>         task->sub = get_default_submodule(path);
> 
> and get_default_submodule can return NULL.
Ah, yes you're right.
Previous: Stefan BellerNext: Stefan Beller
Message 22 of 28 in “Resending sb/submodule-recursive-fetch-gets-the-tip”
  1. 0/9 Resending sb/submodule-recursive-fetch-gets-the-tipStefan Beller, Oct 16, 2018
  2. 1/9 sha1-array: provide oid_array_filterStefan Beller, Oct 16, 2018
  3. 2/9 submodule.c: fix indentationStefan Beller, Oct 16, 2018
  4. 3/9 submodule.c: sort changed_submodule_names before searching itStefan Beller, Oct 16, 2018
  5. Jonathan TanOct 17, 2018
  6. 4/9 submodule.c: move global changed_submodule_names into fetch submodule structStefan Beller, Oct 16, 2018
  7. Jonathan TanOct 17, 2018
  8. Stefan BellerOct 18, 2018
  9. 5/9 submodule.c: do not copy around submodule listStefan Beller, Oct 16, 2018
  10. Jonathan TanOct 17, 2018
  11. Junio C HamanoOct 18, 2018
  12. 6/9 repository: repo_submodule_init to take a submodule structStefan Beller, Oct 16, 2018
  13. Jonathan TanOct 17, 2018
  14. 7/9 submodule: fetch in submodules git directory instead of in worktreeStefan Beller, Oct 16, 2018
  15. Jonathan TanOct 17, 2018
  16. Stefan BellerOct 23, 2018
  17. Jonathan TanOct 23, 2018
  18. Stefan BellerOct 23, 2018
  19. 8/9 fetch: retry fetching submodules if needed objects were not fetchedStefan Beller, Oct 16, 2018
  20. Jonathan TanOct 18, 2018
  21. Stefan BellerOct 23, 2018
  22. Jonathan TanOct 23, 2018
  23. Stefan BellerOct 25, 2018
  24. 9/9 builtin/fetch: check for submodule updates for non branch fetchesStefan Beller, Oct 16, 2018
  25. Jonathan TanOct 18, 2018
  26. Junio C HamanoOct 18, 2018
  27. Junio C HamanoOct 18, 2018
  28. Stefan BellerOct 18, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.