Code

Move local variables to narrower scopes
[git.git] / builtin-fetch-pack.c
index 372bfa20a2eac978f7511f5d8d9296be789b527f..c2e5adc8847e8ffa94bd009121b7a295f3f0512e 100644 (file)
@@ -216,9 +216,8 @@ static int find_common(int fd[2], unsigned char *result_sha1,
        if (args.depth > 0) {
                char line[1024];
                unsigned char sha1[20];
-               int len;
 
-               while ((len = packet_read_line(fd[0], line, sizeof(line)))) {
+               while (packet_read_line(fd[0], line, sizeof(line))) {
                        if (!prefixcmp(line, "shallow ")) {
                                if (get_sha1_hex(line + 8, sha1))
                                        die("invalid shallow line: %s", line);
@@ -780,7 +779,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;