Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Wed, 30 Apr 2008 06:06:30 +0000 (23:06 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 30 Apr 2008 06:06:30 +0000 (23:06 -0700)
* maint:
cvsimport: always pass user data to "system" as a list
fix reflog approxidate parsing bug
Fix use after free() in builtin-fetch
fetch-pack: do not stop traversing an already parsed commit
Use "=" instead of "==" in condition as it is more portable

builtin-fetch-pack.c
builtin-fetch.c
git-clone.sh
git-cvsimport.perl
sha1_name.c
index 65350ca52240bad95c1632ae604d66279d9a8997..fe8cfa0cb899d0db2f572e4fcf859dea9e895197 100644 (file)
@@ -117,15 +117,15 @@ static const unsigned char* get_rev(void)
 
        while (commit == NULL) {
                unsigned int mark;
-               struct commit_list *parents = NULL;
+               struct commit_list *parents;
 
                if (rev_list == NULL || non_common_revs == 0)
                        return NULL;
 
                commit = rev_list->item;
-               if (!(commit->object.parsed))
-                       if (!parse_commit(commit))
-                               parents = commit->parents;
+               if (commit->object.parsed)
+                       parse_commit(commit);
+               parents = commit->parents;
 
                commit->object.flags |= POPPED;
                if (!(commit->object.flags & COMMON))
index 139a6b10c50d38fa3caf224e8031a152eac1a22e..167f948036170fd2ec5a8e3bd3ca20359d8c9ee5 100644 (file)
@@ -577,8 +577,6 @@ static int do_fetch(struct transport *transport,
                free_refs(ref_map);
        }
 
-       transport_disconnect(transport);
-
        return 0;
 }
 
@@ -599,6 +597,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
        int i;
        static const char **refs = NULL;
        int ref_nr = 0;
+       int exit_code;
 
        /* Record the command line for the reflog */
        strbuf_addstr(&default_rla, "fetch");
@@ -652,6 +651,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 
        signal(SIGINT, unlock_pack_on_signal);
        atexit(unlock_pack);
-       return do_fetch(transport,
+       exit_code = do_fetch(transport,
                        parse_fetch_refspec(ref_nr, refs), ref_nr);
+       transport_disconnect(transport);
+       transport = NULL;
+       return exit_code;
 }
index 9e433c08086f3a80c91cc9dae1e48c88723b82f8..8c7fc7f6317113fcef923dcc625fb94e13fb77a0 100755 (executable)
@@ -219,7 +219,7 @@ fi
 if test -n "$2"
 then
        dir="$2"
-       test $# == 2 || die "excess parameter to git-clone"
+       test $# = 2 || die "excess parameter to git-clone"
 else
        # Derive one from the repository name
        # Try using "humanish" part of source repo if user didn't specify one
index 95c5eec51ecc6ab6f142cef51eb4bd3b5842debb..bdac5d51b6dfb721bb648e455cb8f3c5078217e4 100755 (executable)
@@ -772,7 +772,7 @@ sub commit {
        waitpid($pid,0);
        die "Error running git-commit-tree: $?\n" if $?;
 
-       system("git-update-ref $remote/$branch $cid") == 0
+       system('git-update-ref', "$remote/$branch", $cid) == 0
                or die "Cannot write branch $branch for update: $!\n";
 
        if ($tag) {
index 491d2e7ebf19d5c582adbc5ece28d931b09b8a6d..b0b2167578a7baebeba676af0b33161fb688bae0 100644 (file)
@@ -351,8 +351,11 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
                }
                if (0 <= nth)
                        at_time = 0;
-               else
-                       at_time = approxidate(str + at + 2);
+               else {
+                       char *tmp = xstrndup(str + at + 2, reflog_len);
+                       at_time = approxidate(tmp);
+                       free(tmp);
+               }
                if (read_ref_at(real_ref, at_time, nth, sha1, NULL,
                                &co_time, &co_tz, &co_cnt)) {
                        if (at_time)