rugged 0.99.0 → 1.0.0

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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/CMakeLists.txt +1 -0
  4. data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +4 -37
  5. data/vendor/libgit2/cmake/Modules/SanitizeBool.cmake +20 -0
  6. data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +3 -0
  7. data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +3 -0
  8. data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +3 -0
  9. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +2 -0
  10. data/vendor/libgit2/deps/ntlmclient/compat.h +22 -0
  11. data/vendor/libgit2/include/git2/deprecated.h +7 -0
  12. data/vendor/libgit2/include/git2/repository.h +5 -4
  13. data/vendor/libgit2/include/git2/sys/refdb_backend.h +109 -2
  14. data/vendor/libgit2/include/git2/version.h +4 -4
  15. data/vendor/libgit2/src/CMakeLists.txt +11 -13
  16. data/vendor/libgit2/src/blame.c +1 -1
  17. data/vendor/libgit2/src/cache.c +8 -4
  18. data/vendor/libgit2/src/indexer.c +3 -3
  19. data/vendor/libgit2/src/notes.c +6 -3
  20. data/vendor/libgit2/src/odb_pack.c +0 -1
  21. data/vendor/libgit2/src/pack-objects.c +3 -1
  22. data/vendor/libgit2/src/pack.c +21 -1
  23. data/vendor/libgit2/src/push.c +3 -2
  24. data/vendor/libgit2/src/refdb_fs.c +3 -0
  25. data/vendor/libgit2/src/repository.c +63 -50
  26. data/vendor/libgit2/src/revwalk.c +1 -1
  27. data/vendor/libgit2/src/streams/openssl.c +1 -1
  28. data/vendor/libgit2/src/transports/auth_ntlm.c +2 -2
  29. data/vendor/libgit2/src/transports/httpclient.c +13 -2
  30. data/vendor/libgit2/src/unix/posix.h +1 -1
  31. data/vendor/libgit2/src/win32/path_w32.c +28 -1
  32. data/vendor/libgit2/src/win32/path_w32.h +16 -1
  33. data/vendor/libgit2/src/win32/posix_w32.c +1 -2
  34. data/vendor/libgit2/src/worktree.c +44 -28
  35. metadata +4 -6
  36. data/vendor/libgit2/src/sha1_lookup.c +0 -35
  37. data/vendor/libgit2/src/sha1_lookup.h +0 -19
@@ -21,14 +21,8 @@ SET(LIBGIT2_INCLUDES
21
21
  SET(LIBGIT2_SYSTEM_INCLUDES "")
22
22
  SET(LIBGIT2_LIBS "")
23
23
 
24
- # Installation paths
25
- #
26
- SET(BIN_INSTALL_DIR bin CACHE PATH "Where to install binaries to.")
27
- SET(LIB_INSTALL_DIR lib CACHE PATH "Where to install libraries to.")
28
- SET(INCLUDE_INSTALL_DIR include CACHE PATH "Where to install headers to.")
29
-
30
24
  # Enable tracing
31
- IF (ENABLE_TRACE STREQUAL "ON")
25
+ IF(ENABLE_TRACE)
32
26
  SET(GIT_TRACE 1)
33
27
  ENDIF()
34
28
  ADD_FEATURE_INFO(tracing GIT_TRACE "tracing support")
@@ -140,7 +134,7 @@ ELSEIF(REGEX_BACKEND STREQUAL "pcre2")
140
134
 
141
135
  LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${PCRE2_INCLUDE_DIRS})
142
136
  LIST(APPEND LIBGIT2_LIBS ${PCRE2_LIBRARIES})
143
- LIST(APPEND LIBGIT2_PC_REQUIRES "libpcre2")
137
+ LIST(APPEND LIBGIT2_PC_REQUIRES "libpcre2-8")
144
138
  ELSEIF(REGEX_BACKEND STREQUAL "pcre")
145
139
  ADD_FEATURE_INFO(regex ON "using system PCRE")
146
140
  SET(GIT_REGEX_PCRE 1)
@@ -300,6 +294,10 @@ FILE(GLOB SRC_GIT2 *.c *.h
300
294
  streams/*.c streams/*.h
301
295
  transports/*.c transports/*.h
302
296
  xdiff/*.c xdiff/*.h)
297
+ IF(APPLE)
298
+ # The old Secure Transport API has been deprecated in macOS 10.15.
299
+ SET_SOURCE_FILES_PROPERTIES(streams/stransport.c PROPERTIES COMPILE_FLAGS -Wno-deprecated)
300
+ ENDIF()
303
301
 
304
302
  # the xdiff dependency is not (yet) warning-free, disable warnings as
305
303
  # errors for the xdiff sources until we've sorted them out
@@ -387,9 +385,9 @@ ENDIF ()
387
385
 
388
386
  # Install
389
387
  INSTALL(TARGETS git2
390
- RUNTIME DESTINATION ${BIN_INSTALL_DIR}
391
- LIBRARY DESTINATION ${LIB_INSTALL_DIR}
392
- ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
388
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
389
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
390
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
393
391
  )
394
- INSTALL(DIRECTORY ${libgit2_SOURCE_DIR}/include/git2 DESTINATION ${INCLUDE_INSTALL_DIR} )
395
- INSTALL(FILES ${libgit2_SOURCE_DIR}/include/git2.h DESTINATION ${INCLUDE_INSTALL_DIR} )
392
+ INSTALL(DIRECTORY ${libgit2_SOURCE_DIR}/include/git2 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
393
+ INSTALL(FILES ${libgit2_SOURCE_DIR}/include/git2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
@@ -415,7 +415,7 @@ on_error:
415
415
 
416
416
  static bool hunk_is_bufferblame(git_blame_hunk *hunk)
417
417
  {
418
- return git_oid_is_zero(&hunk->final_commit_id);
418
+ return hunk && git_oid_is_zero(&hunk->final_commit_id);
419
419
  }
420
420
 
421
421
  static int buffer_hunk_cb(
@@ -208,10 +208,14 @@ static void *cache_store(git_cache *cache, git_cached_obj *entry)
208
208
  entry = stored_entry;
209
209
  } else if (stored_entry->flags == GIT_CACHE_STORE_RAW &&
210
210
  entry->flags == GIT_CACHE_STORE_PARSED) {
211
- git_cached_obj_decref(stored_entry);
212
- git_cached_obj_incref(entry);
213
-
214
- git_oidmap_set(cache->map, &entry->oid, entry);
211
+ if (git_oidmap_set(cache->map, &entry->oid, entry) == 0) {
212
+ git_cached_obj_decref(stored_entry);
213
+ git_cached_obj_incref(entry);
214
+ } else {
215
+ git_cached_obj_decref(entry);
216
+ git_cached_obj_incref(stored_entry);
217
+ entry = stored_entry;
218
+ }
215
219
  } else {
216
220
  /* NO OP */
217
221
  }
@@ -150,11 +150,11 @@ int git_indexer_new(
150
150
  idx->progress_cb = opts.progress_cb;
151
151
  idx->progress_payload = opts.progress_cb_payload;
152
152
  idx->mode = mode ? mode : GIT_PACK_FILE_MODE;
153
- git_hash_ctx_init(&idx->hash_ctx);
154
- git_hash_ctx_init(&idx->trailer);
155
153
  git_buf_init(&idx->entry_data, 0);
156
154
 
157
- if ((error = git_oidmap_new(&idx->expected_oids)) < 0)
155
+ if ((error = git_hash_ctx_init(&idx->hash_ctx)) < 0 ||
156
+ (error = git_hash_ctx_init(&idx->trailer)) < 0 ||
157
+ (error = git_oidmap_new(&idx->expected_oids)) < 0)
158
158
  goto cleanup;
159
159
 
160
160
  idx->do_verify = opts.verify;
@@ -808,8 +808,11 @@ int git_note_next(
808
808
 
809
809
  git_oid_cpy(note_id, &item->id);
810
810
 
811
- if (!(error = process_entry_path(item->path, annotated_id)))
812
- git_iterator_advance(NULL, it);
811
+ if ((error = process_entry_path(item->path, annotated_id)) < 0)
812
+ return error;
813
813
 
814
- return error;
814
+ if ((error = git_iterator_advance(NULL, it)) < 0 && error != GIT_ITEROVER)
815
+ return error;
816
+
817
+ return 0;
815
818
  }
@@ -15,7 +15,6 @@
15
15
  #include "hash.h"
16
16
  #include "odb.h"
17
17
  #include "delta.h"
18
- #include "sha1_lookup.h"
19
18
  #include "mwindow.h"
20
19
  #include "pack.h"
21
20
 
@@ -374,7 +374,9 @@ static int write_object(
374
374
  GIT_ERROR_CHECK_ALLOC(zbuf);
375
375
 
376
376
  git_zstream_reset(&pb->zstream);
377
- git_zstream_set_input(&pb->zstream, data, data_len);
377
+
378
+ if ((error = git_zstream_set_input(&pb->zstream, data, data_len)) < 0)
379
+ goto done;
378
380
 
379
381
  while (!git_zstream_done(&pb->zstream)) {
380
382
  if ((error = git_zstream_get_output(zbuf, &zbuf_len, &pb->zstream)) < 0 ||
@@ -12,7 +12,6 @@
12
12
  #include "mwindow.h"
13
13
  #include "odb.h"
14
14
  #include "oid.h"
15
- #include "sha1_lookup.h"
16
15
 
17
16
  /* Option to bypass checking existence of '.keep' files */
18
17
  bool git_disable_pack_keep_file_checks = false;
@@ -1239,6 +1238,27 @@ int git_pack_foreach_entry(
1239
1238
  return error;
1240
1239
  }
1241
1240
 
1241
+ static int sha1_position(const void *table, size_t stride, unsigned lo,
1242
+ unsigned hi, const unsigned char *key)
1243
+ {
1244
+ const unsigned char *base = table;
1245
+
1246
+ while (lo < hi) {
1247
+ unsigned mi = (lo + hi) / 2;
1248
+ int cmp = git_oid__hashcmp(base + mi * stride, key);
1249
+
1250
+ if (!cmp)
1251
+ return mi;
1252
+
1253
+ if (cmp > 0)
1254
+ hi = mi;
1255
+ else
1256
+ lo = mi+1;
1257
+ }
1258
+
1259
+ return -((int)lo)-1;
1260
+ }
1261
+
1242
1262
  static int pack_entry_find_offset(
1243
1263
  off64_t *offset_out,
1244
1264
  git_oid *found_oid,
@@ -349,8 +349,9 @@ static int queue_objects(git_push *push)
349
349
  if (git_oid_is_zero(&head->oid))
350
350
  continue;
351
351
 
352
- /* TODO */
353
- git_revwalk_hide(rw, &head->oid);
352
+ if ((error = git_revwalk_hide(rw, &head->oid)) < 0 &&
353
+ error != GIT_ENOTFOUND && error != GIT_EINVALIDSPEC && error != GIT_EPEEL)
354
+ goto on_error;
354
355
  }
355
356
 
356
357
  error = git_packbuilder_insert_walk(push->pb, rw);
@@ -2129,6 +2129,9 @@ int git_refdb_backend_fs(
2129
2129
  backend = git__calloc(1, sizeof(refdb_fs_backend));
2130
2130
  GIT_ERROR_CHECK_ALLOC(backend);
2131
2131
 
2132
+ if (git_refdb_init_backend(&backend->parent, GIT_REFDB_BACKEND_VERSION) < 0)
2133
+ goto fail;
2134
+
2132
2135
  backend->repo = repository;
2133
2136
 
2134
2137
  if (repository->gitdir) {
@@ -189,19 +189,25 @@ void git_repository_free(git_repository *repo)
189
189
  *
190
190
  * Open a repository object from its path
191
191
  */
192
- static bool valid_repository_path(git_buf *repository_path, git_buf *common_path)
192
+ static int is_valid_repository_path(bool *out, git_buf *repository_path, git_buf *common_path)
193
193
  {
194
+ int error;
195
+
196
+ *out = false;
197
+
194
198
  /* Check if we have a separate commondir (e.g. we have a
195
199
  * worktree) */
196
200
  if (git_path_contains_file(repository_path, GIT_COMMONDIR_FILE)) {
197
201
  git_buf common_link = GIT_BUF_INIT;
198
- git_buf_joinpath(&common_link, repository_path->ptr, GIT_COMMONDIR_FILE);
199
202
 
200
- git_futils_readbuffer(&common_link, common_link.ptr);
201
- git_buf_rtrim(&common_link);
203
+ if ((error = git_buf_joinpath(&common_link, repository_path->ptr, GIT_COMMONDIR_FILE)) < 0 ||
204
+ (error = git_futils_readbuffer(&common_link, common_link.ptr)) < 0)
205
+ return error;
202
206
 
207
+ git_buf_rtrim(&common_link);
203
208
  if (git_path_is_relative(common_link.ptr)) {
204
- git_buf_joinpath(common_path, repository_path->ptr, common_link.ptr);
209
+ if ((error = git_buf_joinpath(common_path, repository_path->ptr, common_link.ptr)) < 0)
210
+ return error;
205
211
  } else {
206
212
  git_buf_swap(common_path, &common_link);
207
213
  }
@@ -209,24 +215,26 @@ static bool valid_repository_path(git_buf *repository_path, git_buf *common_path
209
215
  git_buf_dispose(&common_link);
210
216
  }
211
217
  else {
212
- git_buf_set(common_path, repository_path->ptr, repository_path->size);
218
+ if ((error = git_buf_set(common_path, repository_path->ptr, repository_path->size)) < 0)
219
+ return error;
213
220
  }
214
221
 
215
222
  /* Make sure the commondir path always has a trailing * slash */
216
223
  if (git_buf_rfind(common_path, '/') != (ssize_t)common_path->size - 1)
217
- git_buf_putc(common_path, '/');
224
+ if ((error = git_buf_putc(common_path, '/')) < 0)
225
+ return error;
218
226
 
219
227
  /* Ensure HEAD file exists */
220
228
  if (git_path_contains_file(repository_path, GIT_HEAD_FILE) == false)
221
- return false;
222
-
229
+ return 0;
223
230
  /* Check files in common dir */
224
231
  if (git_path_contains_dir(common_path, GIT_OBJECTS_DIR) == false)
225
- return false;
232
+ return 0;
226
233
  if (git_path_contains_dir(common_path, GIT_REFS_DIR) == false)
227
- return false;
234
+ return 0;
228
235
 
229
- return true;
236
+ *out = true;
237
+ return 0;
230
238
  }
231
239
 
232
240
  static git_repository *repository_alloc(void)
@@ -441,15 +449,15 @@ static int find_repo(
441
449
  uint32_t flags,
442
450
  const char *ceiling_dirs)
443
451
  {
444
- int error;
445
452
  git_buf path = GIT_BUF_INIT;
446
453
  git_buf repo_link = GIT_BUF_INIT;
447
454
  git_buf common_link = GIT_BUF_INIT;
448
455
  struct stat st;
449
456
  dev_t initial_device = 0;
450
457
  int min_iterations;
451
- bool in_dot_git;
458
+ bool in_dot_git, is_valid;
452
459
  size_t ceiling_offset = 0;
460
+ int error;
453
461
 
454
462
  git_buf_clear(gitdir_path);
455
463
 
@@ -475,9 +483,8 @@ static int find_repo(
475
483
  for (;;) {
476
484
  if (!(flags & GIT_REPOSITORY_OPEN_NO_DOTGIT)) {
477
485
  if (!in_dot_git) {
478
- error = git_buf_joinpath(&path, path.ptr, DOT_GIT);
479
- if (error < 0)
480
- break;
486
+ if ((error = git_buf_joinpath(&path, path.ptr, DOT_GIT)) < 0)
487
+ goto out;
481
488
  }
482
489
  in_dot_git = !in_dot_git;
483
490
  }
@@ -491,28 +498,33 @@ static int find_repo(
491
498
  break;
492
499
 
493
500
  if (S_ISDIR(st.st_mode)) {
494
- if (valid_repository_path(&path, &common_link)) {
495
- git_path_to_dir(&path);
496
- git_buf_set(gitdir_path, path.ptr, path.size);
501
+ if ((error = is_valid_repository_path(&is_valid, &path, &common_link)) < 0)
502
+ goto out;
503
+
504
+ if (is_valid) {
505
+ if ((error = git_path_to_dir(&path)) < 0 ||
506
+ (error = git_buf_set(gitdir_path, path.ptr, path.size)) < 0)
507
+ goto out;
497
508
 
498
509
  if (gitlink_path)
499
- git_buf_attach(gitlink_path,
500
- git_worktree__read_link(path.ptr, GIT_GITDIR_FILE), 0);
510
+ if ((error = git_buf_attach(gitlink_path, git_worktree__read_link(path.ptr, GIT_GITDIR_FILE), 0)) < 0)
511
+ goto out;
501
512
  if (commondir_path)
502
513
  git_buf_swap(&common_link, commondir_path);
503
514
 
504
515
  break;
505
516
  }
506
- }
507
- else if (S_ISREG(st.st_mode) && git__suffixcmp(path.ptr, "/" DOT_GIT) == 0) {
508
- error = read_gitfile(&repo_link, path.ptr);
509
- if (error < 0)
510
- break;
511
- if (valid_repository_path(&repo_link, &common_link)) {
517
+ } else if (S_ISREG(st.st_mode) && git__suffixcmp(path.ptr, "/" DOT_GIT) == 0) {
518
+ if ((error = read_gitfile(&repo_link, path.ptr)) < 0 ||
519
+ (error = is_valid_repository_path(&is_valid, &repo_link, &common_link)) < 0)
520
+ goto out;
521
+
522
+ if (is_valid) {
512
523
  git_buf_swap(gitdir_path, &repo_link);
513
524
 
514
525
  if (gitlink_path)
515
- error = git_buf_put(gitlink_path, path.ptr, path.size);
526
+ if ((error = git_buf_put(gitlink_path, path.ptr, path.size)) < 0)
527
+ goto out;
516
528
  if (commondir_path)
517
529
  git_buf_swap(&common_link, commondir_path);
518
530
  }
@@ -523,10 +535,8 @@ static int find_repo(
523
535
  /* Move up one directory. If we're in_dot_git, we'll search the
524
536
  * parent itself next. If we're !in_dot_git, we'll search .git
525
537
  * in the parent directory next (added at the top of the loop). */
526
- if (git_path_dirname_r(&path, path.ptr) < 0) {
527
- error = -1;
528
- break;
529
- }
538
+ if ((error = git_path_dirname_r(&path, path.ptr)) < 0)
539
+ goto out;
530
540
 
531
541
  /* Once we've checked the directory (and .git if applicable),
532
542
  * find the ceiling for a search. */
@@ -534,31 +544,28 @@ static int find_repo(
534
544
  ceiling_offset = find_ceiling_dir_offset(path.ptr, ceiling_dirs);
535
545
 
536
546
  /* Check if we should stop searching here. */
537
- if (min_iterations == 0
538
- && (path.ptr[ceiling_offset] == 0
539
- || (flags & GIT_REPOSITORY_OPEN_NO_SEARCH)))
547
+ if (min_iterations == 0 &&
548
+ (path.ptr[ceiling_offset] == 0 || (flags & GIT_REPOSITORY_OPEN_NO_SEARCH)))
540
549
  break;
541
550
  }
542
551
 
543
- if (!error && workdir_path && !(flags & GIT_REPOSITORY_OPEN_BARE)) {
552
+ if (workdir_path && !(flags & GIT_REPOSITORY_OPEN_BARE)) {
544
553
  if (!git_buf_len(gitdir_path))
545
554
  git_buf_clear(workdir_path);
546
- else {
547
- git_path_dirname_r(workdir_path, path.ptr);
548
- git_path_to_dir(workdir_path);
549
- }
550
- if (git_buf_oom(workdir_path))
551
- return -1;
555
+ else if ((error = git_path_dirname_r(workdir_path, path.ptr)) < 0 ||
556
+ (error = git_path_to_dir(workdir_path)) < 0)
557
+ goto out;
552
558
  }
553
559
 
554
560
  /* If we didn't find the repository, and we don't have any other error
555
561
  * to report, report that. */
556
- if (!git_buf_len(gitdir_path) && !error) {
557
- git_error_set(GIT_ERROR_REPOSITORY,
558
- "could not find repository from '%s'", start_path);
562
+ if (!git_buf_len(gitdir_path)) {
563
+ git_error_set(GIT_ERROR_REPOSITORY, "could not find repository from '%s'", start_path);
559
564
  error = GIT_ENOTFOUND;
565
+ goto out;
560
566
  }
561
567
 
568
+ out:
562
569
  git_buf_dispose(&path);
563
570
  git_buf_dispose(&repo_link);
564
571
  git_buf_dispose(&common_link);
@@ -569,14 +576,16 @@ int git_repository_open_bare(
569
576
  git_repository **repo_ptr,
570
577
  const char *bare_path)
571
578
  {
572
- int error;
573
579
  git_buf path = GIT_BUF_INIT, common_path = GIT_BUF_INIT;
574
580
  git_repository *repo = NULL;
581
+ bool is_valid;
582
+ int error;
575
583
 
576
- if ((error = git_path_prettify_dir(&path, bare_path, NULL)) < 0)
584
+ if ((error = git_path_prettify_dir(&path, bare_path, NULL)) < 0 ||
585
+ (error = is_valid_repository_path(&is_valid, &path, &common_path)) < 0)
577
586
  return error;
578
587
 
579
- if (!valid_repository_path(&path, &common_path)) {
588
+ if (!is_valid) {
580
589
  git_buf_dispose(&path);
581
590
  git_buf_dispose(&common_path);
582
591
  git_error_set(GIT_ERROR_REPOSITORY, "path is not a repository: %s", bare_path);
@@ -2055,6 +2064,7 @@ int git_repository_init_ext(
2055
2064
  git_buf repo_path = GIT_BUF_INIT, wd_path = GIT_BUF_INIT,
2056
2065
  common_path = GIT_BUF_INIT, head_path = GIT_BUF_INIT;
2057
2066
  const char *wd;
2067
+ bool is_valid;
2058
2068
  int error;
2059
2069
 
2060
2070
  assert(out && given_repo && opts);
@@ -2066,7 +2076,10 @@ int git_repository_init_ext(
2066
2076
 
2067
2077
  wd = (opts->flags & GIT_REPOSITORY_INIT_BARE) ? NULL : git_buf_cstr(&wd_path);
2068
2078
 
2069
- if (valid_repository_path(&repo_path, &common_path)) {
2079
+ if ((error = is_valid_repository_path(&is_valid, &repo_path, &common_path)) < 0)
2080
+ goto out;
2081
+
2082
+ if (is_valid) {
2070
2083
  if ((opts->flags & GIT_REPOSITORY_INIT_NO_REINIT) != 0) {
2071
2084
  git_error_set(GIT_ERROR_REPOSITORY,
2072
2085
  "attempt to reinitialize '%s'", given_repo);
@@ -58,7 +58,7 @@ int git_revwalk__push_commit(git_revwalk *walk, const git_oid *oid, const git_re
58
58
  return 0;
59
59
 
60
60
  git_error_set(GIT_ERROR_INVALID, "object is not a committish");
61
- return -1;
61
+ return error;
62
62
  }
63
63
  if (error < 0)
64
64
  return error;
@@ -156,7 +156,7 @@ static void openssl_locking_function(
156
156
  lock = mode & CRYPTO_LOCK;
157
157
 
158
158
  if (lock) {
159
- git_mutex_lock(&openssl_locks[n]);
159
+ (void)git_mutex_lock(&openssl_locks[n]);
160
160
  } else {
161
161
  git_mutex_unlock(&openssl_locks[n]);
162
162
  }
@@ -50,10 +50,10 @@ static int ntlm_set_credentials(http_auth_ntlm_context *ctx, git_credential *_cr
50
50
  cred = (git_credential_userpass_plaintext *)_cred;
51
51
 
52
52
  if ((sep = strchr(cred->username, '\\')) != NULL) {
53
- domain = strndup(cred->username, (sep - cred->username));
53
+ domain = git__strndup(cred->username, (sep - cred->username));
54
54
  GIT_ERROR_CHECK_ALLOC(domain);
55
55
 
56
- domainuser = strdup(sep + 1);
56
+ domainuser = git__strdup(sep + 1);
57
57
  GIT_ERROR_CHECK_ALLOC(domainuser);
58
58
 
59
59
  username = domainuser;