On Thu, Feb 27, 2014 at 4:22 PM, Jeff King <peff@xxxxxxxx> wrote: > On Thu, Feb 27, 2014 at 04:10:12AM -0500, Jeff King wrote: > >> I also notice that check_shallow_file_for_update returns early if >> !is_shallow. Is that safe? Is it possible for another process to have >> made us shallow since the program began? In that case, we would have to >> stat() the file always, then complain if it exists and !is_shallow. I think it's safer to do it your way. > > That patch would look like this: > > diff --git a/shallow.c b/shallow.c > index 75da07a..e05a241 100644 > --- a/shallow.c > +++ b/shallow.c > @@ -139,13 +139,13 @@ void check_shallow_file_for_update(void) > { > struct stat st; > > - if (!is_shallow) > - return; > - else if (is_shallow == -1) > + if (is_shallow == -1) > die("BUG: shallow must be initialized by now"); > > if (stat(git_path("shallow"), &st)) > die("shallow file was removed during fetch"); > + else if (!is_shallow) > + die("shallow file appeared during fetch"); > else if (st.st_mtime != shallow_stat.st_mtime > #ifdef USE_NSEC > || ST_MTIME_NSEC(st) != ST_MTIME_NSEC(shallow_stat) > > but again, I'm not really clear on whether this is possible. > > -Peff -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html