rugged 0.22.0b4 → 0.22.0b5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rugged/rugged.c +8 -7
- data/ext/rugged/rugged_note.c +1 -1
- data/ext/rugged/rugged_remote.c +0 -5
- data/ext/rugged/rugged_tree.c +23 -25
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/include/git2/blame.h +0 -1
- data/vendor/libgit2/include/git2/branch.h +1 -1
- data/vendor/libgit2/include/git2/buffer.h +1 -1
- data/vendor/libgit2/include/git2/cherrypick.h +5 -2
- data/vendor/libgit2/include/git2/clone.h +0 -1
- data/vendor/libgit2/include/git2/common.h +6 -1
- data/vendor/libgit2/include/git2/config.h +13 -4
- data/vendor/libgit2/include/git2/filter.h +3 -0
- data/vendor/libgit2/include/git2/global.h +10 -4
- data/vendor/libgit2/include/git2/index.h +3 -0
- data/vendor/libgit2/include/git2/merge.h +20 -5
- data/vendor/libgit2/include/git2/net.h +3 -2
- data/vendor/libgit2/include/git2/notes.h +5 -7
- data/vendor/libgit2/include/git2/push.h +7 -14
- data/vendor/libgit2/include/git2/rebase.h +14 -1
- data/vendor/libgit2/include/git2/refs.h +7 -1
- data/vendor/libgit2/include/git2/remote.h +6 -1
- data/vendor/libgit2/include/git2/repository.h +6 -0
- data/vendor/libgit2/include/git2/revert.h +5 -2
- data/vendor/libgit2/include/git2/stash.h +15 -6
- data/vendor/libgit2/include/git2/submodule.h +1 -1
- data/vendor/libgit2/include/git2/sys/diff.h +5 -2
- data/vendor/libgit2/include/git2/sys/hashsig.h +3 -0
- data/vendor/libgit2/include/git2/sys/mempack.h +1 -1
- data/vendor/libgit2/include/git2/sys/stream.h +40 -0
- data/vendor/libgit2/include/git2/sys/transport.h +17 -4
- data/vendor/libgit2/include/git2/tree.h +3 -3
- data/vendor/libgit2/src/checkout.c +27 -1
- data/vendor/libgit2/src/commit_list.c +1 -1
- data/vendor/libgit2/src/common.h +1 -1
- data/vendor/libgit2/src/config_cache.c +2 -0
- data/vendor/libgit2/src/config_file.c +1 -1
- data/vendor/libgit2/src/describe.c +2 -2
- data/vendor/libgit2/src/global.c +31 -14
- data/vendor/libgit2/src/ignore.c +86 -3
- data/vendor/libgit2/src/index.c +48 -25
- data/vendor/libgit2/src/indexer.c +1 -0
- data/vendor/libgit2/src/netops.c +18 -474
- data/vendor/libgit2/src/netops.h +3 -8
- data/vendor/libgit2/src/notes.c +3 -3
- data/vendor/libgit2/src/odb.c +1 -0
- data/vendor/libgit2/src/odb_loose.c +1 -1
- data/vendor/libgit2/src/openssl_stream.c +375 -0
- data/vendor/libgit2/src/openssl_stream.h +14 -0
- data/vendor/libgit2/src/path.c +256 -0
- data/vendor/libgit2/src/path.h +44 -1
- data/vendor/libgit2/src/pool.c +1 -1
- data/vendor/libgit2/src/push.c +5 -5
- data/vendor/libgit2/src/rebase.c +2 -2
- data/vendor/libgit2/src/refdb_fs.c +11 -1
- data/vendor/libgit2/src/remote.c +2 -7
- data/vendor/libgit2/src/repository.c +25 -0
- data/vendor/libgit2/src/repository.h +26 -2
- data/vendor/libgit2/src/socket_stream.c +212 -0
- data/vendor/libgit2/src/socket_stream.h +21 -0
- data/vendor/libgit2/src/stream.h +48 -0
- data/vendor/libgit2/src/tag.c +1 -1
- data/vendor/libgit2/src/transports/git.c +71 -57
- data/vendor/libgit2/src/transports/http.c +40 -62
- data/vendor/libgit2/src/transports/local.c +6 -11
- data/vendor/libgit2/src/transports/smart.c +3 -3
- data/vendor/libgit2/src/transports/ssh.c +12 -8
- data/vendor/libgit2/src/transports/winhttp.c +68 -47
- data/vendor/libgit2/src/tree.c +16 -14
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/util.c +91 -0
- data/vendor/libgit2/src/util.h +12 -0
- data/vendor/libgit2/src/win32/findfile.c +1 -0
- data/vendor/libgit2/src/win32/path_w32.c +305 -0
- data/vendor/libgit2/src/win32/path_w32.h +80 -0
- data/vendor/libgit2/src/win32/posix.h +1 -0
- data/vendor/libgit2/src/win32/posix_w32.c +25 -42
- data/vendor/libgit2/src/win32/utf-conv.c +36 -6
- data/vendor/libgit2/src/win32/utf-conv.h +0 -39
- data/vendor/libgit2/src/win32/w32_util.h +1 -0
- data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
- data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
- metadata +10 -2
@@ -0,0 +1,80 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
#ifndef INCLUDE_git_path_w32_h__
|
8
|
+
#define INCLUDE_git_path_w32_h__
|
9
|
+
|
10
|
+
/*
|
11
|
+
* Provides a large enough buffer to support Windows paths: MAX_PATH is
|
12
|
+
* 260, corresponding to a maximum path length of 259 characters plus a
|
13
|
+
* NULL terminator. Prefixing with "\\?\" adds 4 characters, but if the
|
14
|
+
* original was a UNC path, then we turn "\\server\share" into
|
15
|
+
* "\\?\UNC\server\share". So we replace the first two characters with
|
16
|
+
* 8 characters, a net gain of 6, so the maximum length is MAX_PATH+6.
|
17
|
+
*/
|
18
|
+
#define GIT_WIN_PATH_UTF16 MAX_PATH+6
|
19
|
+
|
20
|
+
/* Maximum size of a UTF-8 Win32 path. We remove the "\\?\" or "\\?\UNC\"
|
21
|
+
* prefixes for presentation, bringing us back to 259 (non-NULL)
|
22
|
+
* characters. UTF-8 does have 4-byte sequences, but they are encoded in
|
23
|
+
* UTF-16 using surrogate pairs, which takes up the space of two characters.
|
24
|
+
* Two characters in the range U+0800 -> U+FFFF take up more space in UTF-8
|
25
|
+
* (6 bytes) than one surrogate pair (4 bytes).
|
26
|
+
*/
|
27
|
+
#define GIT_WIN_PATH_UTF8 (259 * 3 + 1)
|
28
|
+
|
29
|
+
/*
|
30
|
+
* The length of a Windows "shortname", for 8.3 compatibility.
|
31
|
+
*/
|
32
|
+
#define GIT_WIN_PATH_SHORTNAME 13
|
33
|
+
|
34
|
+
/* Win32 path types */
|
35
|
+
typedef wchar_t git_win32_path[GIT_WIN_PATH_UTF16];
|
36
|
+
typedef char git_win32_utf8_path[GIT_WIN_PATH_UTF8];
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Create a Win32 path (in UCS-2 format) from a UTF-8 string.
|
40
|
+
*
|
41
|
+
* @param dest The buffer to receive the wide string.
|
42
|
+
* @param src The UTF-8 string to convert.
|
43
|
+
* @return The length of the wide string, in characters (not counting the NULL terminator), or < 0 for failure
|
44
|
+
*/
|
45
|
+
extern int git_win32_path_from_utf8(git_win32_path dest, const char *src);
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Canonicalize a Win32 UCS-2 path so that it is suitable for delivery to the
|
49
|
+
* Win32 APIs: remove multiple directory separators, squashing to a single one,
|
50
|
+
* strip trailing directory separators, ensure directory separators are all
|
51
|
+
* canonical (always backslashes, never forward slashes) and process any
|
52
|
+
* directory entries of '.' or '..'.
|
53
|
+
*
|
54
|
+
* This processes the buffer in place.
|
55
|
+
*
|
56
|
+
* @param path The buffer to process
|
57
|
+
* @return The new length of the buffer, in wchar_t's (not counting the NULL terminator)
|
58
|
+
*/
|
59
|
+
extern int git_win32_path_canonicalize(git_win32_path path);
|
60
|
+
|
61
|
+
/**
|
62
|
+
* Create an internal format (posix-style) UTF-8 path from a Win32 UCS-2 path.
|
63
|
+
*
|
64
|
+
* @param dest The buffer to receive the UTF-8 string.
|
65
|
+
* @param src The wide string to convert.
|
66
|
+
* @return The length of the UTF-8 string, in bytes (not counting the NULL terminator), or < 0 for failure
|
67
|
+
*/
|
68
|
+
extern int git_win32_path_to_utf8(git_win32_utf8_path dest, const wchar_t *src);
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Get the short name for the terminal path component in the given path.
|
72
|
+
* For example, given "C:\Foo\Bar\Asdf.txt", this will return the short name
|
73
|
+
* for the file "Asdf.txt".
|
74
|
+
*
|
75
|
+
* @param path The given path in UTF-8
|
76
|
+
* @return The name of the shortname for the given path
|
77
|
+
*/
|
78
|
+
extern char *git_win32_path_8dot3_name(const char *path);
|
79
|
+
|
80
|
+
#endif
|
@@ -7,6 +7,7 @@
|
|
7
7
|
#include "../posix.h"
|
8
8
|
#include "../fileops.h"
|
9
9
|
#include "path.h"
|
10
|
+
#include "path_w32.h"
|
10
11
|
#include "utf-conv.h"
|
11
12
|
#include "repository.h"
|
12
13
|
#include "reparse.h"
|
@@ -35,22 +36,6 @@
|
|
35
36
|
/* GetFinalPathNameByHandleW signature */
|
36
37
|
typedef DWORD(WINAPI *PFGetFinalPathNameByHandleW)(HANDLE, LPWSTR, DWORD, DWORD);
|
37
38
|
|
38
|
-
/* Helper function which converts UTF-8 paths to UTF-16.
|
39
|
-
* On failure, errno is set. */
|
40
|
-
static int utf8_to_16_with_errno(git_win32_path dest, const char *src)
|
41
|
-
{
|
42
|
-
int len = git_win32_path_from_utf8(dest, src);
|
43
|
-
|
44
|
-
if (len < 0) {
|
45
|
-
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
46
|
-
errno = ENAMETOOLONG;
|
47
|
-
else
|
48
|
-
errno = EINVAL; /* Bad code point, presumably */
|
49
|
-
}
|
50
|
-
|
51
|
-
return len;
|
52
|
-
}
|
53
|
-
|
54
39
|
int p_ftruncate(int fd, long size)
|
55
40
|
{
|
56
41
|
#if defined(_MSC_VER) && _MSC_VER >= 1500
|
@@ -66,7 +51,7 @@ int p_mkdir(const char *path, mode_t mode)
|
|
66
51
|
|
67
52
|
GIT_UNUSED(mode);
|
68
53
|
|
69
|
-
if (
|
54
|
+
if (git_win32_path_from_utf8(buf, path) < 0)
|
70
55
|
return -1;
|
71
56
|
|
72
57
|
return _wmkdir(buf);
|
@@ -85,7 +70,7 @@ int p_unlink(const char *path)
|
|
85
70
|
git_win32_path buf;
|
86
71
|
int error;
|
87
72
|
|
88
|
-
if (
|
73
|
+
if (git_win32_path_from_utf8(buf, path) < 0)
|
89
74
|
return -1;
|
90
75
|
|
91
76
|
error = _wunlink(buf);
|
@@ -292,7 +277,7 @@ static int do_lstat(const char *path, struct stat *buf, bool posixly_correct)
|
|
292
277
|
git_win32_path path_w;
|
293
278
|
int len;
|
294
279
|
|
295
|
-
if ((len =
|
280
|
+
if ((len = git_win32_path_from_utf8(path_w, path)) < 0)
|
296
281
|
return -1;
|
297
282
|
|
298
283
|
git_win32__path_trim_end(path_w, len);
|
@@ -323,7 +308,7 @@ int p_readlink(const char *path, char *buf, size_t bufsiz)
|
|
323
308
|
* could occur in the middle of the encoding of a code point,
|
324
309
|
* we need to buffer the result on the stack. */
|
325
310
|
|
326
|
-
if (
|
311
|
+
if (git_win32_path_from_utf8(path_w, path) < 0 ||
|
327
312
|
readlink_w(target_w, path_w) < 0 ||
|
328
313
|
(len = git_win32_path_to_utf8(target, target_w)) < 0)
|
329
314
|
return -1;
|
@@ -347,7 +332,7 @@ int p_open(const char *path, int flags, ...)
|
|
347
332
|
git_win32_path buf;
|
348
333
|
mode_t mode = 0;
|
349
334
|
|
350
|
-
if (
|
335
|
+
if (git_win32_path_from_utf8(buf, path) < 0)
|
351
336
|
return -1;
|
352
337
|
|
353
338
|
if (flags & O_CREAT) {
|
@@ -365,7 +350,7 @@ int p_creat(const char *path, mode_t mode)
|
|
365
350
|
{
|
366
351
|
git_win32_path buf;
|
367
352
|
|
368
|
-
if (
|
353
|
+
if (git_win32_path_from_utf8(buf, path) < 0)
|
369
354
|
return -1;
|
370
355
|
|
371
356
|
return _wopen(buf, _O_WRONLY | _O_CREAT | _O_TRUNC | STANDARD_OPEN_FLAGS, mode);
|
@@ -463,7 +448,7 @@ int p_stat(const char* path, struct stat* buf)
|
|
463
448
|
git_win32_path path_w;
|
464
449
|
int len;
|
465
450
|
|
466
|
-
if ((len =
|
451
|
+
if ((len = git_win32_path_from_utf8(path_w, path)) < 0)
|
467
452
|
return -1;
|
468
453
|
|
469
454
|
git_win32__path_trim_end(path_w, len);
|
@@ -483,7 +468,7 @@ int p_chdir(const char* path)
|
|
483
468
|
{
|
484
469
|
git_win32_path buf;
|
485
470
|
|
486
|
-
if (
|
471
|
+
if (git_win32_path_from_utf8(buf, path) < 0)
|
487
472
|
return -1;
|
488
473
|
|
489
474
|
return _wchdir(buf);
|
@@ -493,7 +478,7 @@ int p_chmod(const char* path, mode_t mode)
|
|
493
478
|
{
|
494
479
|
git_win32_path buf;
|
495
480
|
|
496
|
-
if (
|
481
|
+
if (git_win32_path_from_utf8(buf, path) < 0)
|
497
482
|
return -1;
|
498
483
|
|
499
484
|
return _wchmod(buf, mode);
|
@@ -504,7 +489,7 @@ int p_rmdir(const char* path)
|
|
504
489
|
git_win32_path buf;
|
505
490
|
int error;
|
506
491
|
|
507
|
-
if (
|
492
|
+
if (git_win32_path_from_utf8(buf, path) < 0)
|
508
493
|
return -1;
|
509
494
|
|
510
495
|
error = _wrmdir(buf);
|
@@ -533,7 +518,7 @@ char *p_realpath(const char *orig_path, char *buffer)
|
|
533
518
|
{
|
534
519
|
git_win32_path orig_path_w, buffer_w;
|
535
520
|
|
536
|
-
if (
|
521
|
+
if (git_win32_path_from_utf8(orig_path_w, orig_path) < 0)
|
537
522
|
return NULL;
|
538
523
|
|
539
524
|
/* Note that if the path provided is a relative path, then the current directory
|
@@ -554,20 +539,17 @@ char *p_realpath(const char *orig_path, char *buffer)
|
|
554
539
|
return NULL;
|
555
540
|
}
|
556
541
|
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
* characters in size. If it isn't, then we may overflow. */
|
561
|
-
if (git__utf16_to_8(buffer, GIT_WIN_PATH_UTF8, buffer_w) < 0)
|
562
|
-
return NULL;
|
563
|
-
} else {
|
564
|
-
/* If the caller did not provide a buffer, then we allocate one for the caller
|
565
|
-
* from the heap. */
|
566
|
-
if (git__utf16_to_8_alloc(&buffer, buffer_w) < 0)
|
567
|
-
return NULL;
|
542
|
+
if (!buffer && !(buffer = git__malloc(GIT_WIN_PATH_UTF8))) {
|
543
|
+
errno = ENOMEM;
|
544
|
+
return NULL;
|
568
545
|
}
|
569
546
|
|
570
|
-
/* Convert
|
547
|
+
/* Convert the path to UTF-8. If the caller provided a buffer, then it
|
548
|
+
* is assumed to be GIT_WIN_PATH_UTF8 characters in size. If it isn't,
|
549
|
+
* then we may overflow. */
|
550
|
+
if (git_win32_path_to_utf8(buffer, buffer_w) < 0)
|
551
|
+
return NULL;
|
552
|
+
|
571
553
|
git_path_mkposix(buffer);
|
572
554
|
|
573
555
|
return buffer;
|
@@ -608,6 +590,7 @@ int p_snprintf(char *buffer, size_t count, const char *format, ...)
|
|
608
590
|
return r;
|
609
591
|
}
|
610
592
|
|
593
|
+
/* TODO: wut? */
|
611
594
|
int p_mkstemp(char *tmp_path)
|
612
595
|
{
|
613
596
|
#if defined(_MSC_VER) && _MSC_VER >= 1500
|
@@ -625,7 +608,7 @@ int p_access(const char* path, mode_t mode)
|
|
625
608
|
{
|
626
609
|
git_win32_path buf;
|
627
610
|
|
628
|
-
if (
|
611
|
+
if (git_win32_path_from_utf8(buf, path) < 0)
|
629
612
|
return -1;
|
630
613
|
|
631
614
|
return _waccess(buf, mode);
|
@@ -664,8 +647,8 @@ int p_rename(const char *from, const char *to)
|
|
664
647
|
int rename_succeeded;
|
665
648
|
int error;
|
666
649
|
|
667
|
-
if (
|
668
|
-
|
650
|
+
if (git_win32_path_from_utf8(wfrom, from) < 0 ||
|
651
|
+
git_win32_path_from_utf8(wto, to) < 0)
|
669
652
|
return -1;
|
670
653
|
|
671
654
|
/* wait up to 50ms if file is locked by another thread or process */
|
@@ -26,6 +26,14 @@ GIT_INLINE(DWORD) get_wc_flags(void)
|
|
26
26
|
return flags;
|
27
27
|
}
|
28
28
|
|
29
|
+
GIT_INLINE(void) git__set_errno(void)
|
30
|
+
{
|
31
|
+
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
32
|
+
errno = ENAMETOOLONG;
|
33
|
+
else
|
34
|
+
errno = EINVAL;
|
35
|
+
}
|
36
|
+
|
29
37
|
/**
|
30
38
|
* Converts a UTF-8 string to wide characters.
|
31
39
|
*
|
@@ -36,10 +44,15 @@ GIT_INLINE(DWORD) get_wc_flags(void)
|
|
36
44
|
*/
|
37
45
|
int git__utf8_to_16(wchar_t *dest, size_t dest_size, const char *src)
|
38
46
|
{
|
47
|
+
int len;
|
48
|
+
|
39
49
|
/* Length of -1 indicates NULL termination of the input string. Subtract 1 from the result to
|
40
50
|
* turn 0 into -1 (an error code) and to not count the NULL terminator as part of the string's
|
41
51
|
* length. MultiByteToWideChar never returns int's minvalue, so underflow is not possible */
|
42
|
-
|
52
|
+
if ((len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, src, -1, dest, (int)dest_size) - 1) < 0)
|
53
|
+
git__set_errno();
|
54
|
+
|
55
|
+
return len;
|
43
56
|
}
|
44
57
|
|
45
58
|
/**
|
@@ -52,10 +65,15 @@ int git__utf8_to_16(wchar_t *dest, size_t dest_size, const char *src)
|
|
52
65
|
*/
|
53
66
|
int git__utf16_to_8(char *dest, size_t dest_size, const wchar_t *src)
|
54
67
|
{
|
68
|
+
int len;
|
69
|
+
|
55
70
|
/* Length of -1 indicates NULL termination of the input string. Subtract 1 from the result to
|
56
71
|
* turn 0 into -1 (an error code) and to not count the NULL terminator as part of the string's
|
57
72
|
* length. WideCharToMultiByte never returns int's minvalue, so underflow is not possible */
|
58
|
-
|
73
|
+
if ((len = WideCharToMultiByte(CP_UTF8, get_wc_flags(), src, -1, dest, (int)dest_size, NULL, NULL) - 1) < 0)
|
74
|
+
git__set_errno();
|
75
|
+
|
76
|
+
return len;
|
59
77
|
}
|
60
78
|
|
61
79
|
/**
|
@@ -76,17 +94,23 @@ int git__utf8_to_16_alloc(wchar_t **dest, const char *src)
|
|
76
94
|
/* Length of -1 indicates NULL termination of the input string */
|
77
95
|
utf16_size = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, src, -1, NULL, 0);
|
78
96
|
|
79
|
-
if (!utf16_size)
|
97
|
+
if (!utf16_size) {
|
98
|
+
git__set_errno();
|
80
99
|
return -1;
|
100
|
+
}
|
81
101
|
|
82
102
|
*dest = git__malloc(utf16_size * sizeof(wchar_t));
|
83
103
|
|
84
|
-
if (!*dest)
|
104
|
+
if (!*dest) {
|
105
|
+
errno = ENOMEM;
|
85
106
|
return -1;
|
107
|
+
}
|
86
108
|
|
87
109
|
utf16_size = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, src, -1, *dest, utf16_size);
|
88
110
|
|
89
111
|
if (!utf16_size) {
|
112
|
+
git__set_errno();
|
113
|
+
|
90
114
|
git__free(*dest);
|
91
115
|
*dest = NULL;
|
92
116
|
}
|
@@ -116,17 +140,23 @@ int git__utf16_to_8_alloc(char **dest, const wchar_t *src)
|
|
116
140
|
/* Length of -1 indicates NULL termination of the input string */
|
117
141
|
utf8_size = WideCharToMultiByte(CP_UTF8, dwFlags, src, -1, NULL, 0, NULL, NULL);
|
118
142
|
|
119
|
-
if (!utf8_size)
|
143
|
+
if (!utf8_size) {
|
144
|
+
git__set_errno();
|
120
145
|
return -1;
|
146
|
+
}
|
121
147
|
|
122
148
|
*dest = git__malloc(utf8_size);
|
123
149
|
|
124
|
-
if (!*dest)
|
150
|
+
if (!*dest) {
|
151
|
+
errno = ENOMEM;
|
125
152
|
return -1;
|
153
|
+
}
|
126
154
|
|
127
155
|
utf8_size = WideCharToMultiByte(CP_UTF8, dwFlags, src, -1, *dest, utf8_size, NULL, NULL);
|
128
156
|
|
129
157
|
if (!utf8_size) {
|
158
|
+
git__set_errno();
|
159
|
+
|
130
160
|
git__free(*dest);
|
131
161
|
*dest = NULL;
|
132
162
|
}
|
@@ -10,21 +10,6 @@
|
|
10
10
|
#include <wchar.h>
|
11
11
|
#include "common.h"
|
12
12
|
|
13
|
-
/* Equal to the Win32 MAX_PATH constant. The maximum path length is 259
|
14
|
-
* characters plus a NULL terminator. */
|
15
|
-
#define GIT_WIN_PATH_UTF16 260
|
16
|
-
|
17
|
-
/* Maximum size of a UTF-8 Win32 path. UTF-8 does have 4-byte sequences,
|
18
|
-
* but they are encoded in UTF-16 using surrogate pairs, which takes up
|
19
|
-
* the space of two characters. Two characters in the range U+0800 ->
|
20
|
-
* U+FFFF take up more space in UTF-8 (6 bytes) than one surrogate pair
|
21
|
-
* (4 bytes). */
|
22
|
-
#define GIT_WIN_PATH_UTF8 (259 * 3 + 1)
|
23
|
-
|
24
|
-
/* Win32 path types */
|
25
|
-
typedef wchar_t git_win32_path[GIT_WIN_PATH_UTF16];
|
26
|
-
typedef char git_win32_utf8_path[GIT_WIN_PATH_UTF8];
|
27
|
-
|
28
13
|
/**
|
29
14
|
* Converts a UTF-8 string to wide characters.
|
30
15
|
*
|
@@ -67,28 +52,4 @@ int git__utf8_to_16_alloc(wchar_t **dest, const char *src);
|
|
67
52
|
*/
|
68
53
|
int git__utf16_to_8_alloc(char **dest, const wchar_t *src);
|
69
54
|
|
70
|
-
/**
|
71
|
-
* Converts a UTF-8 Win32 path to wide characters.
|
72
|
-
*
|
73
|
-
* @param dest The buffer to receive the wide string.
|
74
|
-
* @param src The UTF-8 string to convert.
|
75
|
-
* @return The length of the wide string, in characters (not counting the NULL terminator), or < 0 for failure
|
76
|
-
*/
|
77
|
-
GIT_INLINE(int) git_win32_path_from_utf8(git_win32_path dest, const char *src)
|
78
|
-
{
|
79
|
-
return git__utf8_to_16(dest, GIT_WIN_PATH_UTF16, src);
|
80
|
-
}
|
81
|
-
|
82
|
-
/**
|
83
|
-
* Converts a wide Win32 path to UTF-8.
|
84
|
-
*
|
85
|
-
* @param dest The buffer to receive the UTF-8 string.
|
86
|
-
* @param src The wide string to convert.
|
87
|
-
* @return The length of the UTF-8 string, in bytes (not counting the NULL terminator), or < 0 for failure
|
88
|
-
*/
|
89
|
-
GIT_INLINE(int) git_win32_path_to_utf8(git_win32_utf8_path dest, const wchar_t *src)
|
90
|
-
{
|
91
|
-
return git__utf16_to_8(dest, GIT_WIN_PATH_UTF8, src);
|
92
|
-
}
|
93
|
-
|
94
55
|
#endif
|
@@ -490,7 +490,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
|
|
490
490
|
|
491
491
|
/*
|
492
492
|
* Try to move back the possibly merged group of changes, to match
|
493
|
-
* the recorded
|
493
|
+
* the recorded position in the other file.
|
494
494
|
*/
|
495
495
|
while (ixref < ix) {
|
496
496
|
rchg[--ixs] = 1;
|