Merge branch 'maint'

* maint:
  compat/snprintf.c: handle snprintf's that always return the # chars transmitted
  git-svn: fix dcommit to urls with embedded usernames
  revision.h: make show_early_output an extern which is defined in revision.c
This commit is contained in:
Junio C Hamano 2008-08-21 01:54:49 -07:00
commit 436edc6eae
3 changed files with 10 additions and 4 deletions

View File

@ -17,6 +17,8 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)
if (maxsize > 0) { if (maxsize > 0) {
ret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap); ret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap);
if (ret == maxsize-1)
ret = -1;
/* Windows does not NUL-terminate if result fills buffer */ /* Windows does not NUL-terminate if result fills buffer */
str[maxsize-1] = 0; str[maxsize-1] = 0;
} }
@ -34,6 +36,8 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)
break; break;
s = str; s = str;
ret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap); ret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap);
if (ret == maxsize-1)
ret = -1;
} }
free(s); free(s);
return ret; return ret;

View File

@ -421,7 +421,7 @@ sub cmd_dcommit {
$head ||= 'HEAD'; $head ||= 'HEAD';
my @refs; my @refs;
my ($url, $rev, $uuid, $gs) = working_head_info($head, \@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; my $last_rev = $_revision if defined $_revision;
if ($url) { if ($url) {
print "Committing to $url ...\n"; print "Committing to $url ...\n";
@ -437,6 +437,8 @@ sub cmd_dcommit {
"If these changes depend on each other, re-running ", "If these changes depend on each other, re-running ",
"without --no-rebase may be required." "without --no-rebase may be required."
} }
my $expect_url = $url;
Git::SVN::remove_username($expect_url);
while (1) { while (1) {
my $d = shift @$linear_refs or last; my $d = shift @$linear_refs or last;
unless (defined $last_rev) { unless (defined $last_rev) {
@ -511,9 +513,9 @@ sub cmd_dcommit {
$gs->refname, $gs->refname,
"\nBefore dcommitting"; "\nBefore dcommitting";
} }
if ($url_ ne $url) { if ($url_ ne $expect_url) {
fatal "URL mismatch after rebase: ", fatal "URL mismatch after rebase: ",
"$url_ != $url"; "$url_ != $expect_url";
} }
if ($uuid_ ne $uuid) { if ($uuid_ ne $uuid) {
fatal "uuid mismatch after rebase: ", fatal "uuid mismatch after rebase: ",

View File

@ -119,7 +119,7 @@ struct rev_info {
void read_revisions_from_stdin(struct rev_info *revs); void read_revisions_from_stdin(struct rev_info *revs);
typedef void (*show_early_output_fn_t)(struct rev_info *, struct commit_list *); 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 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); extern int setup_revisions(int argc, const char **argv, struct rev_info *revs, const char *def);