diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-04-29 23:06:30 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-04-29 23:06:30 -0700 |
commit | 68951af30c2ac7f74f0d794a8674ac320a84250a (patch) | |
tree | 03bd7cf70ba460bfdf81201ef5d8116d9367d778 | |
parent | f0ec47b8e7f46e17e6b6fe1cead728fa24477e43 (diff) | |
parent | 30c0312fd182942c10421e77d2b3ec6284cc0468 (diff) | |
download | git-68951af30c2ac7f74f0d794a8674ac320a84250a.tar.gz git-68951af30c2ac7f74f0d794a8674ac320a84250a.tar.xz |
Merge branch 'maint'
* 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
-rw-r--r-- | builtin-fetch-pack.c | 8 | ||||
-rw-r--r-- | builtin-fetch.c | 8 | ||||
-rwxr-xr-x | git-clone.sh | 2 | ||||
-rwxr-xr-x | git-cvsimport.perl | 2 | ||||
-rw-r--r-- | sha1_name.c | 7 |
5 files changed, 16 insertions, 11 deletions
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c index 65350ca52..fe8cfa0cb 100644 --- a/builtin-fetch-pack.c +++ b/builtin-fetch-pack.c @@ -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)) diff --git a/builtin-fetch.c b/builtin-fetch.c index 139a6b10c..167f94803 100644 --- a/builtin-fetch.c +++ b/builtin-fetch.c @@ -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; } diff --git a/git-clone.sh b/git-clone.sh index 9e433c080..8c7fc7f63 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -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 diff --git a/git-cvsimport.perl b/git-cvsimport.perl index 95c5eec51..bdac5d51b 100755 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -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) { diff --git a/sha1_name.c b/sha1_name.c index 491d2e7eb..b0b216757 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -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) |