Thread (2 messages) 2 messages, 2 authors, 2017-03-07

Re: [PATCH 16/18] entry.c: update submodules when interesting

From: Junio C Hamano <hidden>
Date: 2017-03-07 23:19:37

Junio C Hamano [off-list ref] writes:
quoted
+			if (!is_submodule_populated_gently(ce->name, &err)) {
+				struct stat sb;
+				if (lstat(ce->name, &sb))
+					die(_("could not stat file '%s'"), ce->name);
+				if (!(st.st_mode & S_IFDIR))
+					unlink_or_warn(ce->name);
We found that the path ce->name is supposed to be a submodule that
is checked out, we found that the submodule is not yet populated, we
tried to make sure what is on that path, and its failure would cause
us to die().  All that is sensible.
...
But if that unlink fails, shouldn't we die, just like the case where
we cannot tell what is at the path ce->name?

And if that unlink succeeds, instead of having an empty directory,
we start the "move-head" call to switch from NULL to ce->oid without
having any directory.  Wouldn't we want to mkdir() here (and remove
mkdir() in submodule_move_head() if there is one---if there isn't
then I do not think this codepath would work)?
In addition to mkdir(), would we also need the .git file that point
into superproject's .git/modules/ too?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help