Skip to content

Commit da4e4a6

Browse files
committed
Merge branch 'maint'
* maint: http.c: fix compiling with libcurl 7.9.2 import-tars: support symlinks pull, rebase: simplify to use die()
2 parents d978ead + ef52aaf commit da4e4a6

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

contrib/fast-import/import-tars.perl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,16 @@
8282
$mtime = oct $mtime;
8383
next if $typeflag == 5; # directory
8484

85-
print FI "blob\n", "mark :$next_mark\n", "data $size\n";
86-
while ($size > 0 && read(I, $_, 512) == 512) {
87-
print FI substr($_, 0, $size);
88-
$size -= 512;
85+
print FI "blob\n", "mark :$next_mark\n";
86+
if ($typeflag == 2) { # symbolic link
87+
print FI "data ", length($linkname), "\n", $linkname;
88+
$mode = 0120000;
89+
} else {
90+
print FI "data $size\n";
91+
while ($size > 0 && read(I, $_, 512) == 512) {
92+
print FI substr($_, 0, $size);
93+
$size -= 512;
94+
}
8995
}
9096
print FI "\n";
9197

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

git-pull.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,11 @@ case "$merge_head" in
176176
?*' '?*)
177177
if test -z "$orig_head"
178178
then
179-
echo >&2 "Cannot merge multiple branches into empty head"
180-
exit 1
179+
die "Cannot merge multiple branches into empty head"
181180
fi
182181
if test true = "$rebase"
183182
then
184-
echo >&2 "Cannot rebase onto multiple branches"
185-
exit 1
183+
die "Cannot rebase onto multiple branches"
186184
fi
187185
;;
188186
esac

git-rebase.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,8 @@ run_pre_rebase_hook () {
168168
if test -z "$OK_TO_SKIP_PRE_REBASE" &&
169169
test -x "$GIT_DIR/hooks/pre-rebase"
170170
then
171-
"$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || {
172-
echo >&2 "The pre-rebase hook refused to rebase."
173-
exit 1
174-
}
171+
"$GIT_DIR/hooks/pre-rebase" ${1+"$@"} ||
172+
die "The pre-rebase hook refused to rebase."
175173
fi
176174
}
177175

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

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

http.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ char curl_errorstr[CURL_ERROR_SIZE];
2020

2121
static int curl_ssl_verify = -1;
2222
static const char *ssl_cert;
23-
#if LIBCURL_VERSION_NUM >= 0x070902
23+
#if LIBCURL_VERSION_NUM >= 0x070903
2424
static const char *ssl_key;
2525
#endif
2626
#if LIBCURL_VERSION_NUM >= 0x070908
@@ -126,7 +126,7 @@ static int http_options(const char *var, const char *value, void *cb)
126126
}
127127
if (!strcmp("http.sslcert", var))
128128
return git_config_string(&ssl_cert, var, value);
129-
#if LIBCURL_VERSION_NUM >= 0x070902
129+
#if LIBCURL_VERSION_NUM >= 0x070903
130130
if (!strcmp("http.sslkey", var))
131131
return git_config_string(&ssl_key, var, value);
132132
#endif
@@ -196,7 +196,7 @@ static CURL *get_curl_handle(void)
196196

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

315315
set_from_env(&ssl_cert, "GIT_SSL_CERT");
316-
#if LIBCURL_VERSION_NUM >= 0x070902
316+
#if LIBCURL_VERSION_NUM >= 0x070903
317317
set_from_env(&ssl_key, "GIT_SSL_KEY");
318318
#endif
319319
#if LIBCURL_VERSION_NUM >= 0x070908

0 commit comments

Comments
 (0)