rugged 0.24.0b8 → 0.24.0b9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/rugged/rugged_tree.c +7 -3
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +27 -1
- data/vendor/libgit2/include/git2/common.h +12 -7
- data/vendor/libgit2/include/git2/diff.h +24 -5
- data/vendor/libgit2/include/git2/merge.h +31 -13
- data/vendor/libgit2/include/git2/repository.h +2 -0
- data/vendor/libgit2/include/git2/submodule.h +12 -1
- data/vendor/libgit2/include/git2/sys/stream.h +13 -0
- data/vendor/libgit2/include/git2/sys/transport.h +1 -0
- data/vendor/libgit2/src/annotated_commit.c +71 -18
- data/vendor/libgit2/src/annotated_commit.h +26 -1
- data/vendor/libgit2/src/checkout.c +1 -2
- data/vendor/libgit2/src/commit.c +25 -10
- data/vendor/libgit2/src/common.h +1 -0
- data/vendor/libgit2/src/config_file.c +5 -10
- data/vendor/libgit2/src/diff.c +18 -21
- data/vendor/libgit2/src/diff.h +0 -1
- data/vendor/libgit2/src/diff_file.c +25 -0
- data/vendor/libgit2/src/filebuf.c +6 -0
- data/vendor/libgit2/src/fileops.c +54 -29
- data/vendor/libgit2/src/fileops.h +3 -2
- data/vendor/libgit2/src/global.c +5 -0
- data/vendor/libgit2/src/global.h +2 -0
- data/vendor/libgit2/src/index.c +105 -58
- data/vendor/libgit2/src/index.h +39 -0
- data/vendor/libgit2/src/merge.c +303 -104
- data/vendor/libgit2/src/merge.h +2 -2
- data/vendor/libgit2/src/object.c +0 -2
- data/vendor/libgit2/src/pool.c +16 -8
- data/vendor/libgit2/src/refdb_fs.c +15 -5
- data/vendor/libgit2/src/refs.h +5 -0
- data/vendor/libgit2/src/repository.c +10 -3
- data/vendor/libgit2/src/reset.c +6 -6
- data/vendor/libgit2/src/settings.c +31 -3
- data/vendor/libgit2/src/stream.h +3 -0
- data/vendor/libgit2/src/submodule.c +19 -25
- data/vendor/libgit2/src/tls_stream.c +13 -0
- data/vendor/libgit2/src/transports/http.c +12 -1
- data/vendor/libgit2/src/transports/winhttp.c +34 -2
- data/vendor/libgit2/src/tree.c +75 -21
- data/vendor/libgit2/src/tree.h +5 -2
- data/vendor/libgit2/src/win32/mingw-compat.h +0 -6
- data/vendor/libgit2/src/win32/msvc-compat.h +0 -3
- data/vendor/libgit2/src/win32/w32_util.h +14 -8
- data/vendor/libgit2/src/win32/win32-compat.h +42 -0
- metadata +3 -2
@@ -7,11 +7,31 @@
|
|
7
7
|
#ifndef INCLUDE_annotated_commit_h__
|
8
8
|
#define INCLUDE_annotated_commit_h__
|
9
9
|
|
10
|
+
#include "oidarray.h"
|
11
|
+
|
10
12
|
#include "git2/oid.h"
|
11
13
|
|
12
|
-
|
14
|
+
typedef enum {
|
15
|
+
GIT_ANNOTATED_COMMIT_REAL = 1,
|
16
|
+
GIT_ANNOTATED_COMMIT_VIRTUAL = 2,
|
17
|
+
} git_annotated_commit_t;
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Internal structure for merge inputs. An annotated commit is generally
|
21
|
+
* "real" and backed by an actual commit in the repository, but merge will
|
22
|
+
* internally create "virtual" commits that are in-memory intermediate
|
23
|
+
* commits backed by an index.
|
24
|
+
*/
|
13
25
|
struct git_annotated_commit {
|
26
|
+
git_annotated_commit_t type;
|
27
|
+
|
28
|
+
/* real commit */
|
14
29
|
git_commit *commit;
|
30
|
+
git_tree *tree;
|
31
|
+
|
32
|
+
/* virtual commit structure */
|
33
|
+
git_index *index;
|
34
|
+
git_array_oid_t parents;
|
15
35
|
|
16
36
|
char *ref_name;
|
17
37
|
char *remote_url;
|
@@ -19,4 +39,9 @@ struct git_annotated_commit {
|
|
19
39
|
char id_str[GIT_OID_HEXSZ+1];
|
20
40
|
};
|
21
41
|
|
42
|
+
extern int git_annotated_commit_from_head(git_annotated_commit **out,
|
43
|
+
git_repository *repo);
|
44
|
+
extern int git_annotated_commit_from_commit(git_annotated_commit **out,
|
45
|
+
git_commit *commit);
|
46
|
+
|
22
47
|
#endif
|
@@ -200,8 +200,7 @@ static bool checkout_is_workdir_modified(
|
|
200
200
|
* out.)
|
201
201
|
*/
|
202
202
|
if ((ie = git_index_get_bypath(data->index, wditem->path, 0)) != NULL) {
|
203
|
-
if (wditem->mtime
|
204
|
-
wditem->mtime.nanoseconds == ie->mtime.nanoseconds &&
|
203
|
+
if (git_index_time_eq(&wditem->mtime, &ie->mtime) &&
|
205
204
|
wditem->file_size == ie->file_size)
|
206
205
|
return !is_workdir_base_or_new(&ie->id, baseitem, newitem);
|
207
206
|
}
|
data/vendor/libgit2/src/commit.c
CHANGED
@@ -431,22 +431,37 @@ const char *git_commit_summary(git_commit *commit)
|
|
431
431
|
{
|
432
432
|
git_buf summary = GIT_BUF_INIT;
|
433
433
|
const char *msg, *space;
|
434
|
+
bool space_contains_newline = false;
|
434
435
|
|
435
436
|
assert(commit);
|
436
437
|
|
437
438
|
if (!commit->summary) {
|
438
439
|
for (msg = git_commit_message(commit), space = NULL; *msg; ++msg) {
|
439
|
-
|
440
|
+
char next_character = msg[0];
|
441
|
+
/* stop processing at the end of the first paragraph */
|
442
|
+
if (next_character == '\n' && (!msg[1] || msg[1] == '\n'))
|
440
443
|
break;
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
}
|
449
|
-
|
444
|
+
/* record the beginning of contiguous whitespace runs */
|
445
|
+
else if (git__isspace(next_character)) {
|
446
|
+
if(space == NULL) {
|
447
|
+
space = msg;
|
448
|
+
space_contains_newline = false;
|
449
|
+
}
|
450
|
+
space_contains_newline |= next_character == '\n';
|
451
|
+
}
|
452
|
+
/* the next character is non-space */
|
453
|
+
else {
|
454
|
+
/* process any recorded whitespace */
|
455
|
+
if (space) {
|
456
|
+
if(space_contains_newline)
|
457
|
+
git_buf_putc(&summary, ' '); /* if the space contains a newline, collapse to ' ' */
|
458
|
+
else
|
459
|
+
git_buf_put(&summary, space, (msg - space)); /* otherwise copy it */
|
460
|
+
space = NULL;
|
461
|
+
}
|
462
|
+
/* copy the next character */
|
463
|
+
git_buf_putc(&summary, next_character);
|
464
|
+
}
|
450
465
|
}
|
451
466
|
|
452
467
|
commit->summary = git_buf_detach(&summary);
|
data/vendor/libgit2/src/common.h
CHANGED
@@ -77,8 +77,7 @@ typedef struct git_config_file_iter {
|
|
77
77
|
(iter) = (tmp))
|
78
78
|
|
79
79
|
struct reader {
|
80
|
-
|
81
|
-
size_t file_size;
|
80
|
+
git_oid checksum;
|
82
81
|
char *file_path;
|
83
82
|
git_buf buffer;
|
84
83
|
char *read_ptr;
|
@@ -285,7 +284,7 @@ static int config_open(git_config_backend *cfg, git_config_level_t level)
|
|
285
284
|
|
286
285
|
git_buf_init(&reader->buffer, 0);
|
287
286
|
res = git_futils_readbuffer_updated(
|
288
|
-
&reader->buffer, b->file_path, &reader->
|
287
|
+
&reader->buffer, b->file_path, &reader->checksum, NULL);
|
289
288
|
|
290
289
|
/* It's fine if the file doesn't exist */
|
291
290
|
if (res == GIT_ENOTFOUND)
|
@@ -345,7 +344,7 @@ static int config_refresh(git_config_backend *cfg)
|
|
345
344
|
reader = git_array_get(b->readers, i);
|
346
345
|
error = git_futils_readbuffer_updated(
|
347
346
|
&reader->buffer, reader->file_path,
|
348
|
-
&reader->
|
347
|
+
&reader->checksum, &updated);
|
349
348
|
|
350
349
|
if (error < 0 && error != GIT_ENOTFOUND)
|
351
350
|
return error;
|
@@ -1618,7 +1617,7 @@ static int read_on_variable(
|
|
1618
1617
|
git_buf_init(&r->buffer, 0);
|
1619
1618
|
|
1620
1619
|
result = git_futils_readbuffer_updated(
|
1621
|
-
&r->buffer, r->file_path, &r->
|
1620
|
+
&r->buffer, r->file_path, &r->checksum, NULL);
|
1622
1621
|
|
1623
1622
|
if (result == 0) {
|
1624
1623
|
result = config_read(parse_data->values, parse_data->cfg_file, r, parse_data->level, parse_data->depth+1);
|
@@ -1894,7 +1893,7 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p
|
|
1894
1893
|
} else {
|
1895
1894
|
/* Lock the file */
|
1896
1895
|
if ((result = git_filebuf_open(
|
1897
|
-
&file, cfg->file_path,
|
1896
|
+
&file, cfg->file_path, GIT_FILEBUF_HASH_CONTENTS, GIT_CONFIG_FILE_MODE)) < 0) {
|
1898
1897
|
git_buf_free(&reader->buffer);
|
1899
1898
|
return result;
|
1900
1899
|
}
|
@@ -1945,10 +1944,6 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p
|
|
1945
1944
|
git_buf_attach(&cfg->locked_content, git_buf_detach(&buf), len);
|
1946
1945
|
} else {
|
1947
1946
|
git_filebuf_write(&file, git_buf_cstr(&buf), git_buf_len(&buf));
|
1948
|
-
|
1949
|
-
/* refresh stats - if this errors, then commit will error too */
|
1950
|
-
(void)git_filebuf_stats(&reader->file_mtime, &reader->file_size, &file);
|
1951
|
-
|
1952
1947
|
result = git_filebuf_commit(&file);
|
1953
1948
|
}
|
1954
1949
|
|
data/vendor/libgit2/src/diff.c
CHANGED
@@ -56,7 +56,7 @@ static int diff_insert_delta(
|
|
56
56
|
|
57
57
|
if (diff->opts.notify_cb) {
|
58
58
|
error = diff->opts.notify_cb(
|
59
|
-
diff, delta, matched_pathspec, diff->opts.
|
59
|
+
diff, delta, matched_pathspec, diff->opts.payload);
|
60
60
|
|
61
61
|
if (error) {
|
62
62
|
git__free(delta);
|
@@ -79,7 +79,7 @@ static bool diff_pathspec_match(
|
|
79
79
|
git_diff *diff,
|
80
80
|
const git_index_entry *entry)
|
81
81
|
{
|
82
|
-
bool disable_pathspec_match =
|
82
|
+
bool disable_pathspec_match =
|
83
83
|
DIFF_FLAG_IS_SET(diff, GIT_DIFF_DISABLE_PATHSPEC_MATCH);
|
84
84
|
|
85
85
|
/* If we're disabling fnmatch, then the iterator has already applied
|
@@ -131,7 +131,7 @@ static int diff_delta__from_one(
|
|
131
131
|
if (status == GIT_DELTA_UNTRACKED &&
|
132
132
|
DIFF_FLAG_ISNT_SET(diff, GIT_DIFF_INCLUDE_UNTRACKED))
|
133
133
|
return 0;
|
134
|
-
|
134
|
+
|
135
135
|
if (status == GIT_DELTA_UNREADABLE &&
|
136
136
|
DIFF_FLAG_ISNT_SET(diff, GIT_DIFF_INCLUDE_UNREADABLE))
|
137
137
|
return 0;
|
@@ -494,11 +494,6 @@ static int diff_list_apply_options(
|
|
494
494
|
|
495
495
|
/* Don't set GIT_DIFFCAPS_USE_DEV - compile time option in core git */
|
496
496
|
|
497
|
-
/* Don't trust nanoseconds; we do not load nanos from disk */
|
498
|
-
#ifdef GIT_USE_NSEC
|
499
|
-
diff->diffcaps = diff->diffcaps | GIT_DIFFCAPS_TRUST_NANOSECS;
|
500
|
-
#endif
|
501
|
-
|
502
497
|
/* If not given explicit `opts`, check `diff.xyz` configs */
|
503
498
|
if (!opts) {
|
504
499
|
int context = git_config__get_int_force(cfg, "diff.context", 3);
|
@@ -699,13 +694,6 @@ int git_diff__oid_for_entry(
|
|
699
694
|
return error;
|
700
695
|
}
|
701
696
|
|
702
|
-
static bool diff_time_eq(
|
703
|
-
const git_index_time *a, const git_index_time *b, bool use_nanos)
|
704
|
-
{
|
705
|
-
return a->seconds == b->seconds &&
|
706
|
-
(!use_nanos || a->nanoseconds == b->nanoseconds);
|
707
|
-
}
|
708
|
-
|
709
697
|
typedef struct {
|
710
698
|
git_repository *repo;
|
711
699
|
git_iterator *old_iter;
|
@@ -838,7 +826,6 @@ static int maybe_modified(
|
|
838
826
|
*/
|
839
827
|
} else if (git_oid_iszero(&nitem->id) && new_is_workdir) {
|
840
828
|
bool use_ctime = ((diff->diffcaps & GIT_DIFFCAPS_TRUST_CTIME) != 0);
|
841
|
-
bool use_nanos = ((diff->diffcaps & GIT_DIFFCAPS_TRUST_NANOSECS) != 0);
|
842
829
|
git_index *index;
|
843
830
|
git_iterator_index(&index, info->new_iter);
|
844
831
|
|
@@ -857,13 +844,12 @@ static int maybe_modified(
|
|
857
844
|
modified_uncertain =
|
858
845
|
(oitem->file_size <= 0 && nitem->file_size > 0);
|
859
846
|
}
|
860
|
-
else if (!
|
861
|
-
(use_ctime &&
|
862
|
-
!diff_time_eq(&oitem->ctime, &nitem->ctime, use_nanos)) ||
|
847
|
+
else if (!git_index_time_eq(&oitem->mtime, &nitem->mtime) ||
|
848
|
+
(use_ctime && !git_index_time_eq(&oitem->ctime, &nitem->ctime)) ||
|
863
849
|
oitem->ino != nitem->ino ||
|
864
850
|
oitem->uid != nitem->uid ||
|
865
851
|
oitem->gid != nitem->gid ||
|
866
|
-
(
|
852
|
+
git_index_entry_newer_than_index(nitem, index))
|
867
853
|
{
|
868
854
|
status = GIT_DELTA_MODIFIED;
|
869
855
|
modified_uncertain = true;
|
@@ -1260,7 +1246,18 @@ int git_diff__from_iterators(
|
|
1260
1246
|
|
1261
1247
|
/* run iterators building diffs */
|
1262
1248
|
while (!error && (info.oitem || info.nitem)) {
|
1263
|
-
int cmp
|
1249
|
+
int cmp;
|
1250
|
+
|
1251
|
+
/* report progress */
|
1252
|
+
if (opts && opts->progress_cb) {
|
1253
|
+
if ((error = opts->progress_cb(diff,
|
1254
|
+
info.oitem ? info.oitem->path : NULL,
|
1255
|
+
info.nitem ? info.nitem->path : NULL,
|
1256
|
+
opts->payload)))
|
1257
|
+
break;
|
1258
|
+
}
|
1259
|
+
|
1260
|
+
cmp = info.oitem ?
|
1264
1261
|
(info.nitem ? diff->entrycomp(info.oitem, info.nitem) : -1) : 1;
|
1265
1262
|
|
1266
1263
|
/* create DELETED records for old items not matched in new */
|
data/vendor/libgit2/src/diff.h
CHANGED
@@ -28,7 +28,6 @@ enum {
|
|
28
28
|
GIT_DIFFCAPS_TRUST_MODE_BITS = (1 << 2), /* use st_mode? */
|
29
29
|
GIT_DIFFCAPS_TRUST_CTIME = (1 << 3), /* use st_ctime? */
|
30
30
|
GIT_DIFFCAPS_USE_DEV = (1 << 4), /* use st_dev? */
|
31
|
-
GIT_DIFFCAPS_TRUST_NANOSECS = (1 << 5), /* use stat time nanoseconds */
|
32
31
|
};
|
33
32
|
|
34
33
|
#define DIFF_FLAGS_KNOWN_BINARY (GIT_DIFF_FLAG_BINARY|GIT_DIFF_FLAG_NOT_BINARY)
|
@@ -259,10 +259,35 @@ static int diff_file_content_load_blob(
|
|
259
259
|
return error;
|
260
260
|
}
|
261
261
|
|
262
|
+
static int diff_file_content_load_workdir_symlink_fake(
|
263
|
+
git_diff_file_content *fc, git_buf *path)
|
264
|
+
{
|
265
|
+
git_buf target = GIT_BUF_INIT;
|
266
|
+
int error;
|
267
|
+
|
268
|
+
if ((error = git_futils_readbuffer(&target, path->ptr)) < 0)
|
269
|
+
return error;
|
270
|
+
|
271
|
+
fc->map.len = git_buf_len(&target);
|
272
|
+
fc->map.data = git_buf_detach(&target);
|
273
|
+
fc->flags |= GIT_DIFF_FLAG__FREE_DATA;
|
274
|
+
|
275
|
+
git_buf_free(&target);
|
276
|
+
return error;
|
277
|
+
}
|
278
|
+
|
262
279
|
static int diff_file_content_load_workdir_symlink(
|
263
280
|
git_diff_file_content *fc, git_buf *path)
|
264
281
|
{
|
265
282
|
ssize_t alloc_len, read_len;
|
283
|
+
int symlink_supported, error;
|
284
|
+
|
285
|
+
if ((error = git_repository__cvar(
|
286
|
+
&symlink_supported, fc->repo, GIT_CVAR_SYMLINKS)) < 0)
|
287
|
+
return -1;
|
288
|
+
|
289
|
+
if (!symlink_supported)
|
290
|
+
return diff_file_content_load_workdir_symlink_fake(fc, path);
|
266
291
|
|
267
292
|
/* link path on disk could be UTF-16, so prepare a buffer that is
|
268
293
|
* big enough to handle some UTF-8 data expansion
|
@@ -357,6 +357,12 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags, mode_t mode
|
|
357
357
|
memcpy(file->path_lock, file->path_original, path_len);
|
358
358
|
memcpy(file->path_lock + path_len, GIT_FILELOCK_EXTENSION, GIT_FILELOCK_EXTLENGTH);
|
359
359
|
|
360
|
+
if (git_path_isdir(file->path_original)) {
|
361
|
+
giterr_set(GITERR_FILESYSTEM, "path '%s' is a directory", file->path_original);
|
362
|
+
error = GIT_EDIRECTORY;
|
363
|
+
goto cleanup;
|
364
|
+
}
|
365
|
+
|
360
366
|
/* open the file for locking */
|
361
367
|
if ((error = lock_file(file, flags, mode)) < 0)
|
362
368
|
goto cleanup;
|
@@ -13,6 +13,12 @@
|
|
13
13
|
#include "win32/findfile.h"
|
14
14
|
#endif
|
15
15
|
|
16
|
+
#ifdef GIT_USE_STAT_ATIMESPEC
|
17
|
+
#define st_atim st_atimespec
|
18
|
+
#define st_ctim st_ctimespec
|
19
|
+
#define st_mtim st_mtimespec
|
20
|
+
#endif
|
21
|
+
|
16
22
|
GIT__USE_STRMAP
|
17
23
|
|
18
24
|
int git_futils_mkpath2file(const char *file_path, const mode_t mode)
|
@@ -153,13 +159,15 @@ int git_futils_readbuffer_fd(git_buf *buf, git_file fd, size_t len)
|
|
153
159
|
}
|
154
160
|
|
155
161
|
int git_futils_readbuffer_updated(
|
156
|
-
git_buf *
|
162
|
+
git_buf *out, const char *path, git_oid *checksum, int *updated)
|
157
163
|
{
|
164
|
+
int error;
|
158
165
|
git_file fd;
|
159
166
|
struct stat st;
|
160
|
-
|
167
|
+
git_buf buf = GIT_BUF_INIT;
|
168
|
+
git_oid checksum_new;
|
161
169
|
|
162
|
-
assert(
|
170
|
+
assert(out && path && *path);
|
163
171
|
|
164
172
|
if (updated != NULL)
|
165
173
|
*updated = 0;
|
@@ -178,45 +186,50 @@ int git_futils_readbuffer_updated(
|
|
178
186
|
return -1;
|
179
187
|
}
|
180
188
|
|
181
|
-
/*
|
182
|
-
* If we were given a time and/or a size, we only want to read the file
|
183
|
-
* if it has been modified.
|
184
|
-
*/
|
185
|
-
if (size && *size != (size_t)st.st_size)
|
186
|
-
changed = true;
|
187
|
-
if (mtime && *mtime != (time_t)st.st_mtime)
|
188
|
-
changed = true;
|
189
|
-
if (!size && !mtime)
|
190
|
-
changed = true;
|
191
|
-
|
192
|
-
if (!changed) {
|
193
|
-
return 0;
|
194
|
-
}
|
195
|
-
|
196
|
-
if (mtime != NULL)
|
197
|
-
*mtime = st.st_mtime;
|
198
|
-
if (size != NULL)
|
199
|
-
*size = (size_t)st.st_size;
|
200
|
-
|
201
189
|
if ((fd = git_futils_open_ro(path)) < 0)
|
202
190
|
return fd;
|
203
191
|
|
204
|
-
if (git_futils_readbuffer_fd(buf, fd, (size_t)st.st_size) < 0) {
|
192
|
+
if (git_futils_readbuffer_fd(&buf, fd, (size_t)st.st_size) < 0) {
|
205
193
|
p_close(fd);
|
206
194
|
return -1;
|
207
195
|
}
|
208
196
|
|
209
197
|
p_close(fd);
|
210
198
|
|
199
|
+
if ((error = git_hash_buf(&checksum_new, buf.ptr, buf.size)) < 0) {
|
200
|
+
git_buf_free(&buf);
|
201
|
+
return error;
|
202
|
+
}
|
203
|
+
|
204
|
+
/*
|
205
|
+
* If we were given a checksum, we only want to use it if it's different
|
206
|
+
*/
|
207
|
+
if (checksum && !git_oid__cmp(checksum, &checksum_new)) {
|
208
|
+
git_buf_free(&buf);
|
209
|
+
if (updated)
|
210
|
+
*updated = 0;
|
211
|
+
|
212
|
+
return 0;
|
213
|
+
}
|
214
|
+
|
215
|
+
/*
|
216
|
+
* If we're here, the file did change, or the user didn't have an old version
|
217
|
+
*/
|
218
|
+
if (checksum)
|
219
|
+
git_oid_cpy(checksum, &checksum_new);
|
220
|
+
|
211
221
|
if (updated != NULL)
|
212
222
|
*updated = 1;
|
213
223
|
|
224
|
+
git_buf_swap(out, &buf);
|
225
|
+
git_buf_free(&buf);
|
226
|
+
|
214
227
|
return 0;
|
215
228
|
}
|
216
229
|
|
217
230
|
int git_futils_readbuffer(git_buf *buf, const char *path)
|
218
231
|
{
|
219
|
-
return git_futils_readbuffer_updated(buf, path, NULL, NULL
|
232
|
+
return git_futils_readbuffer_updated(buf, path, NULL, NULL);
|
220
233
|
}
|
221
234
|
|
222
235
|
int git_futils_writebuffer(
|
@@ -359,7 +372,7 @@ GIT_INLINE(int) mkdir_validate_mode(
|
|
359
372
|
|
360
373
|
return 0;
|
361
374
|
}
|
362
|
-
|
375
|
+
|
363
376
|
GIT_INLINE(int) mkdir_canonicalize(
|
364
377
|
git_buf *path,
|
365
378
|
uint32_t flags)
|
@@ -1027,6 +1040,7 @@ int git_futils_filestamp_check(
|
|
1027
1040
|
git_futils_filestamp *stamp, const char *path)
|
1028
1041
|
{
|
1029
1042
|
struct stat st;
|
1043
|
+
const struct timespec *statmtime = &st.st_mtim;
|
1030
1044
|
|
1031
1045
|
/* if the stamp is NULL, then always reload */
|
1032
1046
|
if (stamp == NULL)
|
@@ -1035,12 +1049,18 @@ int git_futils_filestamp_check(
|
|
1035
1049
|
if (p_stat(path, &st) < 0)
|
1036
1050
|
return GIT_ENOTFOUND;
|
1037
1051
|
|
1038
|
-
if (stamp->mtime ==
|
1052
|
+
if (stamp->mtime.tv_sec == statmtime->tv_sec &&
|
1053
|
+
#if defined(GIT_USE_NSEC)
|
1054
|
+
stamp->mtime.tv_nsec == statmtime->tv_nsec &&
|
1055
|
+
#endif
|
1039
1056
|
stamp->size == (git_off_t)st.st_size &&
|
1040
1057
|
stamp->ino == (unsigned int)st.st_ino)
|
1041
1058
|
return 0;
|
1042
1059
|
|
1043
|
-
stamp->mtime =
|
1060
|
+
stamp->mtime.tv_sec = statmtime->tv_sec;
|
1061
|
+
#if defined(GIT_USE_NSEC)
|
1062
|
+
stamp->mtime.tv_nsec = statmtime->tv_nsec;
|
1063
|
+
#endif
|
1044
1064
|
stamp->size = (git_off_t)st.st_size;
|
1045
1065
|
stamp->ino = (unsigned int)st.st_ino;
|
1046
1066
|
|
@@ -1062,8 +1082,13 @@ void git_futils_filestamp_set(
|
|
1062
1082
|
void git_futils_filestamp_set_from_stat(
|
1063
1083
|
git_futils_filestamp *stamp, struct stat *st)
|
1064
1084
|
{
|
1085
|
+
const struct timespec *statmtime = &st->st_mtim;
|
1086
|
+
|
1065
1087
|
if (st) {
|
1066
|
-
stamp->mtime =
|
1088
|
+
stamp->mtime = *statmtime;
|
1089
|
+
#if !defined(GIT_USE_NSEC)
|
1090
|
+
stamp->mtime.tv_nsec = 0;
|
1091
|
+
#endif
|
1067
1092
|
stamp->size = (git_off_t)st->st_size;
|
1068
1093
|
stamp->ino = (unsigned int)st->st_ino;
|
1069
1094
|
} else {
|