Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Junio C Hamano committed Apr 30, 2008
2 parents f0ec47b + 30c0312 commit 68951af
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
8 changes: 4 additions & 4 deletions builtin-fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
8 changes: 5 additions & 3 deletions builtin-fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,6 @@ static int do_fetch(struct transport *transport,
free_refs(ref_map);
}

transport_disconnect(transport);

return 0;
}

Expand All @@ -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");
Expand Down Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion git-clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion git-cvsimport.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 5 additions & 2 deletions sha1_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 68951af

Please sign in to comment.