From 4dc1db0bd1fc4eedea1ae8ceeee43cb0ea3322ca Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Wed, 20 Aug 2008 19:34:30 -0500 Subject: revision.h: make show_early_output an extern which is defined in revision.c The variable show_early_output is defined in revision.c and should be declared extern in revision.h so that the linker does not complain about multiply defined variables. Signed-off-by: Brandon Casey Signed-off-by: Junio C Hamano diff --git a/revision.h b/revision.h index f64e8ce..1b04566 100644 --- a/revision.h +++ b/revision.h @@ -119,7 +119,7 @@ struct rev_info { void read_revisions_from_stdin(struct rev_info *revs); typedef void (*show_early_output_fn_t)(struct rev_info *, struct commit_list *); -volatile show_early_output_fn_t show_early_output; +extern volatile show_early_output_fn_t show_early_output; extern void init_revisions(struct rev_info *revs, const char *prefix); extern int setup_revisions(int argc, const char **argv, struct rev_info *revs, const char *def); -- cgit v0.10.2-6-g49f6 From 711521e246ea7d7b9bb10a1607cdd0a6de6a9927 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 20 Aug 2008 00:30:06 -0700 Subject: git-svn: fix dcommit to urls with embedded usernames Don't rely on the extracted URL from working_head_info since that has the username removed. Instead use the $gs->full_url method (as before with ba24e74 (git-svn: add ability to specify --commit-url for dcommit, 2008-08-07)) to give us the URL to commit to if --commit-url is not specified. Aditionally, since we clean usernames from URLs, checking the URL after rebase can fail because it doesn't match the URL we used to commit; so unconditionally provide a username-free URL for checking the result of the refetch. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano diff --git a/git-svn.perl b/git-svn.perl index 099fd02..7a1d26d 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -421,7 +421,7 @@ sub cmd_dcommit { $head ||= 'HEAD'; my @refs; my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs); - $url = $_commit_url if defined $_commit_url; + $url = defined $_commit_url ? $_commit_url : $gs->full_url; my $last_rev = $_revision if defined $_revision; if ($url) { print "Committing to $url ...\n"; @@ -437,6 +437,8 @@ sub cmd_dcommit { "If these changes depend on each other, re-running ", "without --no-rebase may be required." } + my $expect_url = $url; + Git::SVN::remove_username($expect_url); while (1) { my $d = shift @$linear_refs or last; unless (defined $last_rev) { @@ -511,9 +513,9 @@ sub cmd_dcommit { $gs->refname, "\nBefore dcommitting"; } - if ($url_ ne $url) { + if ($url_ ne $expect_url) { fatal "URL mismatch after rebase: ", - "$url_ != $url"; + "$url_ != $expect_url"; } if ($uuid_ ne $uuid) { fatal "uuid mismatch after rebase: ", -- cgit v0.10.2-6-g49f6 From a81892dd8c37b6f13793739721b520fee3ce4c2c Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Wed, 20 Aug 2008 20:53:50 -0500 Subject: compat/snprintf.c: handle snprintf's that always return the # chars transmitted Some platforms provide a horribly broken snprintf. More broken than the platforms that return -1 when there is too little space in the target buffer for the formatted string. Some platforms provide an snprintf which _always_ returns the number of characters transmitted to the buffer, regardless of whether there was enough space or not. IRIX 6.5 is such a platform. IRIX does have a working snprintf(), but it is only provided when _NO_XOPEN5 evaluates to zero, and this only happens if _XOPEN_SOURCE is defined, but definition of _XOPEN_SOURCE prevents inclusion of many other common functions and defines. So it must be avoided. Work around these horribly broken snprintf implementations by detecting an snprintf call which results in the number of transmitted characters exactly equal to the length of our buffer and retrying with a larger buffer just to be safe. Signed-off-by: Brandon Casey Acked-by: Johannes Sixt Signed-off-by: Junio C Hamano diff --git a/compat/snprintf.c b/compat/snprintf.c index 580966e..357e733 100644 --- a/compat/snprintf.c +++ b/compat/snprintf.c @@ -17,6 +17,8 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap) if (maxsize > 0) { ret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap); + if (ret == maxsize-1) + ret = -1; /* Windows does not NUL-terminate if result fills buffer */ str[maxsize-1] = 0; } @@ -34,6 +36,8 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap) break; s = str; ret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap); + if (ret == maxsize-1) + ret = -1; } free(s); return ret; -- cgit v0.10.2-6-g49f6