Skip to content

Commit 68951af

Browse files
committed
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
2 parents f0ec47b + 30c0312 commit 68951af

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

builtin-fetch-pack.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ static const unsigned char* get_rev(void)
117117

118118
while (commit == NULL) {
119119
unsigned int mark;
120-
struct commit_list *parents = NULL;
120+
struct commit_list *parents;
121121

122122
if (rev_list == NULL || non_common_revs == 0)
123123
return NULL;
124124

125125
commit = rev_list->item;
126-
if (!(commit->object.parsed))
127-
if (!parse_commit(commit))
128-
parents = commit->parents;
126+
if (commit->object.parsed)
127+
parse_commit(commit);
128+
parents = commit->parents;
129129

130130
commit->object.flags |= POPPED;
131131
if (!(commit->object.flags & COMMON))

builtin-fetch.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,6 @@ static int do_fetch(struct transport *transport,
577577
free_refs(ref_map);
578578
}
579579

580-
transport_disconnect(transport);
581-
582580
return 0;
583581
}
584582

@@ -599,6 +597,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
599597
int i;
600598
static const char **refs = NULL;
601599
int ref_nr = 0;
600+
int exit_code;
602601

603602
/* Record the command line for the reflog */
604603
strbuf_addstr(&default_rla, "fetch");
@@ -652,6 +651,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
652651

653652
signal(SIGINT, unlock_pack_on_signal);
654653
atexit(unlock_pack);
655-
return do_fetch(transport,
654+
exit_code = do_fetch(transport,
656655
parse_fetch_refspec(ref_nr, refs), ref_nr);
656+
transport_disconnect(transport);
657+
transport = NULL;
658+
return exit_code;
657659
}

git-clone.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ fi
219219
if test -n "$2"
220220
then
221221
dir="$2"
222-
test $# == 2 || die "excess parameter to git-clone"
222+
test $# = 2 || die "excess parameter to git-clone"
223223
else
224224
# Derive one from the repository name
225225
# Try using "humanish" part of source repo if user didn't specify one

git-cvsimport.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ sub commit {
772772
waitpid($pid,0);
773773
die "Error running git-commit-tree: $?\n" if $?;
774774

775-
system("git-update-ref $remote/$branch $cid") == 0
775+
system('git-update-ref', "$remote/$branch", $cid) == 0
776776
or die "Cannot write branch $branch for update: $!\n";
777777

778778
if ($tag) {

sha1_name.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,11 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
351351
}
352352
if (0 <= nth)
353353
at_time = 0;
354-
else
355-
at_time = approxidate(str + at + 2);
354+
else {
355+
char *tmp = xstrndup(str + at + 2, reflog_len);
356+
at_time = approxidate(tmp);
357+
free(tmp);
358+
}
356359
if (read_ref_at(real_ref, at_time, nth, sha1, NULL,
357360
&co_time, &co_tz, &co_cnt)) {
358361
if (at_time)

0 commit comments

Comments
 (0)