Merge branch 'maint'

* maint:
  http.c: fix compiling with libcurl 7.9.2
  import-tars: support symlinks
  pull, rebase: simplify to use die()
maint
Junio C Hamano 2009-06-18 10:39:17 -07:00
commit da4e4a65a2
4 changed files with 21 additions and 19 deletions

View File

@ -82,10 +82,16 @@ foreach my $tar_file (@ARGV)
$mtime = oct $mtime; $mtime = oct $mtime;
next if $typeflag == 5; # directory next if $typeflag == 5; # directory


print FI "blob\n", "mark :$next_mark\n", "data $size\n"; print FI "blob\n", "mark :$next_mark\n";
while ($size > 0 && read(I, $_, 512) == 512) { if ($typeflag == 2) { # symbolic link
print FI substr($_, 0, $size); print FI "data ", length($linkname), "\n", $linkname;
$size -= 512; $mode = 0120000;
} else {
print FI "data $size\n";
while ($size > 0 && read(I, $_, 512) == 512) {
print FI substr($_, 0, $size);
$size -= 512;
}
} }
print FI "\n"; print FI "\n";


@ -118,7 +124,8 @@ EOF
{ {
my ($mark, $mode) = @{$files{$path}}; my ($mark, $mode) = @{$files{$path}};
$path =~ s,^([^/]+)/,, if $have_top_dir; $path =~ s,^([^/]+)/,, if $have_top_dir;
printf FI "M %o :%i %s\n", $mode & 0111 ? 0755 : 0644, $mark, $path; $mode = $mode & 0111 ? 0755 : 0644 unless $mode == 0120000;
printf FI "M %o :%i %s\n", $mode, $mark, $path;
} }
print FI "\n"; print FI "\n";



View File

@ -176,13 +176,11 @@ case "$merge_head" in
?*' '?*) ?*' '?*)
if test -z "$orig_head" if test -z "$orig_head"
then then
echo >&2 "Cannot merge multiple branches into empty head" die "Cannot merge multiple branches into empty head"
exit 1
fi fi
if test true = "$rebase" if test true = "$rebase"
then then
echo >&2 "Cannot rebase onto multiple branches" die "Cannot rebase onto multiple branches"
exit 1
fi fi
;; ;;
esac esac

View File

@ -168,10 +168,8 @@ run_pre_rebase_hook () {
if test -z "$OK_TO_SKIP_PRE_REBASE" && if test -z "$OK_TO_SKIP_PRE_REBASE" &&
test -x "$GIT_DIR/hooks/pre-rebase" test -x "$GIT_DIR/hooks/pre-rebase"
then then
"$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || { "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} ||
echo >&2 "The pre-rebase hook refused to rebase." die "The pre-rebase hook refused to rebase."
exit 1
}
fi fi
} }


@ -359,8 +357,7 @@ fi


# The tree must be really really clean. # The tree must be really really clean.
if ! git update-index --ignore-submodules --refresh; then if ! git update-index --ignore-submodules --refresh; then
echo >&2 "cannot rebase: you have unstaged changes" die "cannot rebase: you have unstaged changes"
exit 1
fi fi
diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --) diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --)
case "$diff" in case "$diff" in

8
http.c
View File

@ -20,7 +20,7 @@ char curl_errorstr[CURL_ERROR_SIZE];


static int curl_ssl_verify = -1; static int curl_ssl_verify = -1;
static const char *ssl_cert; static const char *ssl_cert;
#if LIBCURL_VERSION_NUM >= 0x070902 #if LIBCURL_VERSION_NUM >= 0x070903
static const char *ssl_key; static const char *ssl_key;
#endif #endif
#if LIBCURL_VERSION_NUM >= 0x070908 #if LIBCURL_VERSION_NUM >= 0x070908
@ -126,7 +126,7 @@ static int http_options(const char *var, const char *value, void *cb)
} }
if (!strcmp("http.sslcert", var)) if (!strcmp("http.sslcert", var))
return git_config_string(&ssl_cert, var, value); return git_config_string(&ssl_cert, var, value);
#if LIBCURL_VERSION_NUM >= 0x070902 #if LIBCURL_VERSION_NUM >= 0x070903
if (!strcmp("http.sslkey", var)) if (!strcmp("http.sslkey", var))
return git_config_string(&ssl_key, var, value); return git_config_string(&ssl_key, var, value);
#endif #endif
@ -196,7 +196,7 @@ static CURL *get_curl_handle(void)


if (ssl_cert != NULL) if (ssl_cert != NULL)
curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert); curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
#if LIBCURL_VERSION_NUM >= 0x070902 #if LIBCURL_VERSION_NUM >= 0x070903
if (ssl_key != NULL) if (ssl_key != NULL)
curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key); curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key);
#endif #endif
@ -313,7 +313,7 @@ void http_init(struct remote *remote)
curl_ssl_verify = 0; curl_ssl_verify = 0;


set_from_env(&ssl_cert, "GIT_SSL_CERT"); set_from_env(&ssl_cert, "GIT_SSL_CERT");
#if LIBCURL_VERSION_NUM >= 0x070902 #if LIBCURL_VERSION_NUM >= 0x070903
set_from_env(&ssl_key, "GIT_SSL_KEY"); set_from_env(&ssl_key, "GIT_SSL_KEY");
#endif #endif
#if LIBCURL_VERSION_NUM >= 0x070908 #if LIBCURL_VERSION_NUM >= 0x070908