write_index(): update index_state->timestamp after flushing to disk
[gitweb.git] / builtin-fetch-pack.c
index 372bfa20a2eac978f7511f5d8d9296be789b527f..3b210c7fdfd0e5a75e5627099fc8fa183b8c0269 100644 (file)
@@ -780,7 +780,8 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
        struct ref *ref_cpy;
 
        fetch_pack_setup();
-       memcpy(&args, my_args, sizeof(args));
+       if (&args != my_args)
+               memcpy(&args, my_args, sizeof(args));
        if (args.depth > 0) {
                if (stat(git_path("shallow"), &st))
                        st.st_mtime = 0;
@@ -801,14 +802,14 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
 
                mtime.sec = st.st_mtime;
 #ifdef USE_NSEC
-               mtime.usec = st.st_mtim.usec;
+               mtime.nsec = st.st_mtim.tv_nsec;
 #endif
                if (stat(shallow, &st)) {
                        if (mtime.sec)
                                die("shallow file was removed during fetch");
                } else if (st.st_mtime != mtime.sec
 #ifdef USE_NSEC
-                               || st.st_mtim.usec != mtime.usec
+                               || st.st_mtim.tv_nsec != mtime.nsec
 #endif
                          )
                        die("shallow file was changed during fetch");