rugged 0.24.0b11 → 0.24.0b12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35c31e3f98a02a4d6608d6ef7f8b6456e4cccd50
4
- data.tar.gz: 80737d111cc76ea74882b0c65ee2eac6e01bbf44
3
+ metadata.gz: 4bd70b6169b13b2a50eff47a4d3b01e333388f12
4
+ data.tar.gz: cfb572bc347939bab52487dff98b4c75650bea53
5
5
  SHA512:
6
- metadata.gz: 5f804e4bdc3a71f54c4b0dd7aa73adf2e9fdb9e5ca4d01b167a338a171496c2b06ceacf4b9f99092cea3d9e175ec081bd22a0703335822545f329db0d16c5f47
7
- data.tar.gz: 330afdcb7d42082175e3d174aabbc41743156e535a97358d312e1ebbbcb2cb5822dde0e6641bba7c938edc89907ab500ca83ebb441414e4c93772394105ae95f
6
+ metadata.gz: f43d9d0c6618f4a2d490bfc7e39a810bc1753741e93671d427c38f4d9dd235061ec37f4f6430c553bb9d9ad1aa1fc331cc27aee7ea659e3ba479ceb7ae2b98ed
7
+ data.tar.gz: 2700a84afcd1c5647917597154ff348c7884657d4df03a040dc8e322e536d7086548d5b92a22acd8bb91b6f3ca58e2a32be10be681af8b49ecbd2f36bc137510
@@ -15,6 +15,10 @@ def sys(cmd)
15
15
  ret
16
16
  end
17
17
 
18
+ def windows?
19
+ RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
20
+ end
21
+
18
22
  if !(MAKE = find_executable('gmake') || find_executable('make'))
19
23
  abort "ERROR: GNU make is required to build Rugged."
20
24
  end
@@ -55,7 +59,7 @@ else
55
59
  abort "ERROR: CMake is required to build Rugged."
56
60
  end
57
61
 
58
- if !find_executable('pkg-config')
62
+ if !windows? && !find_executable('pkg-config')
59
63
  abort "ERROR: pkg-config is required to build Rugged."
60
64
  end
61
65
 
@@ -66,8 +70,16 @@ else
66
70
  sys("cmake .. -DBUILD_CLAR=OFF -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=RelWithDebInfo -G \"Unix Makefiles\"")
67
71
  sys(MAKE)
68
72
 
69
- pcfile = File.join(LIBGIT2_DIR, "build", "libgit2.pc")
70
- $LDFLAGS << " " + `pkg-config --libs --static #{pcfile}`.strip
73
+ # "normal" libraries (and libgit2 builds) get all these when they build but we're doing it
74
+ # statically so we put the libraries in by hand. It's important that we put the libraries themselves
75
+ # in $LIBS or the final linking stage won't pick them up
76
+ if windows?
77
+ $LDFLAGS << " " + "-L#{Dir.pwd}/deps/winhttp"
78
+ $LIBS << " -lwinhttp -lcrypt32 -lrpcrt4 -lole32"
79
+ else
80
+ pcfile = File.join(LIBGIT2_DIR, "build", "libgit2.pc")
81
+ $LDFLAGS << " " + `pkg-config --libs --static #{pcfile}`.strip
82
+ end
71
83
  end
72
84
  end
73
85
 
@@ -23,6 +23,7 @@
23
23
  */
24
24
 
25
25
  #include "rugged.h"
26
+ #include "git2/commit.h"
26
27
 
27
28
  extern VALUE rb_mRugged;
28
29
  extern VALUE rb_cRuggedObject;
@@ -556,6 +557,51 @@ static VALUE rb_git_commit_to_mbox(int argc, VALUE *argv, VALUE self)
556
557
  return rb_email_patch;
557
558
  }
558
559
 
560
+ /*
561
+ * call-seq:
562
+ * commit.header_field(field_name) -> str
563
+ *
564
+ * Returns +commit+'s header field value.
565
+ */
566
+ static VALUE rb_git_commit_header_field(VALUE self, VALUE rb_field) {
567
+ git_buf header_field = { 0 };
568
+ VALUE rb_result;
569
+ git_commit *commit;
570
+
571
+ Check_Type(rb_field, T_STRING);
572
+
573
+ Data_Get_Struct(self, git_commit, commit);
574
+
575
+ rugged_exception_check(
576
+ git_commit_header_field(&header_field, commit, StringValueCStr(rb_field))
577
+ );
578
+
579
+ rb_result = rb_enc_str_new(header_field.ptr, header_field.size, rb_utf8_encoding());
580
+
581
+ git_buf_free(&header_field);
582
+
583
+ return rb_result;
584
+ }
585
+
586
+ /*
587
+ * call-seq:
588
+ * commit.header -> str
589
+ *
590
+ * Returns +commit+'s entire raw header.
591
+ */
592
+ static VALUE rb_git_commit_header(VALUE self) {
593
+ VALUE rb_result;
594
+ git_commit *commit;
595
+ const char *raw_header;
596
+
597
+ Data_Get_Struct(self, git_commit, commit);
598
+
599
+ raw_header = git_commit_raw_header(commit);
600
+
601
+ rb_result = rb_enc_str_new(raw_header, strlen(raw_header), rb_utf8_encoding());
602
+
603
+ return rb_result;
604
+ }
559
605
 
560
606
  void Init_rugged_commit(void)
561
607
  {
@@ -579,4 +625,7 @@ void Init_rugged_commit(void)
579
625
  rb_define_method(rb_cRuggedCommit, "amend", rb_git_commit_amend, 1);
580
626
 
581
627
  rb_define_method(rb_cRuggedCommit, "to_mbox", rb_git_commit_to_mbox, -1);
628
+
629
+ rb_define_method(rb_cRuggedCommit, "header_field", rb_git_commit_header_field, 1);
630
+ rb_define_method(rb_cRuggedCommit, "header", rb_git_commit_header, 0);
582
631
  }
@@ -1,3 +1,3 @@
1
1
  module Rugged
2
- Version = VERSION = '0.24.0b11'
2
+ Version = VERSION = '0.24.0b12'
3
3
  end
@@ -258,6 +258,7 @@ IF (WIN32 AND WINHTTP)
258
258
  ENDIF ()
259
259
 
260
260
  LINK_LIBRARIES(winhttp rpcrt4 crypt32)
261
+ LIST(APPEND LIBGIT2_PC_LIBS "-lwinhttp" "-lrpcrt4" "-lcrypt32" "-lole32")
261
262
  ELSE ()
262
263
  IF (CURL)
263
264
  PKG_CHECK_MODULES(CURL libcurl)
@@ -339,8 +340,7 @@ IF (LIBSSH2_FOUND)
339
340
  ADD_DEFINITIONS(-DGIT_SSH)
340
341
  INCLUDE_DIRECTORIES(${LIBSSH2_INCLUDE_DIRS})
341
342
  LINK_DIRECTORIES(${LIBSSH2_LIBRARY_DIRS})
342
- LIST(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS})
343
- #SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} ${LIBSSH2_LDFLAGS}")
343
+ SET(LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} libssh2")
344
344
  SET(SSH_LIBRARIES ${LIBSSH2_LIBRARIES})
345
345
 
346
346
  CHECK_LIBRARY_EXISTS("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS)
@@ -68,7 +68,7 @@ GIT_EXTERN(int) git_stash_save(
68
68
  git_repository *repo,
69
69
  const git_signature *stasher,
70
70
  const char *message,
71
- unsigned int flags);
71
+ uint32_t flags);
72
72
 
73
73
  /** Stash application flags. */
74
74
  typedef enum {
@@ -6,7 +6,7 @@ Name: libgit2
6
6
  Description: The git library, take 2
7
7
  Version: @LIBGIT2_VERSION_STRING@
8
8
 
9
- Libs: -L${libdir} -lgit2
9
+ Libs: -L"${libdir}" -lgit2
10
10
  Libs.private: @LIBGIT2_PC_LIBS@
11
11
  Requires.private: @LIBGIT2_PC_REQUIRES@
12
12
 
@@ -356,28 +356,6 @@ static unsigned int index_merge_mode(
356
356
  return git_index__create_mode(mode);
357
357
  }
358
358
 
359
- static int index_sort_if_needed(git_index *index, bool need_lock)
360
- {
361
- /* not truly threadsafe because between when this checks and/or
362
- * sorts the array another thread could come in and unsort it
363
- */
364
-
365
- if (git_vector_is_sorted(&index->entries))
366
- return 0;
367
-
368
- if (need_lock && git_mutex_lock(&index->lock) < 0) {
369
- giterr_set(GITERR_OS, "Unable to lock index");
370
- return -1;
371
- }
372
-
373
- git_vector_sort(&index->entries);
374
-
375
- if (need_lock)
376
- git_mutex_unlock(&index->lock);
377
-
378
- return 0;
379
- }
380
-
381
359
  GIT_INLINE(int) index_find_in_entries(
382
360
  size_t *out, git_vector *entries, git_vector_cmp entry_srch,
383
361
  const char *path, size_t path_len, int stage)
@@ -391,10 +369,9 @@ GIT_INLINE(int) index_find_in_entries(
391
369
 
392
370
  GIT_INLINE(int) index_find(
393
371
  size_t *out, git_index *index,
394
- const char *path, size_t path_len, int stage, bool need_lock)
372
+ const char *path, size_t path_len, int stage)
395
373
  {
396
- if (index_sort_if_needed(index, need_lock) < 0)
397
- return -1;
374
+ git_vector_sort(&index->entries);
398
375
 
399
376
  return index_find_in_entries(
400
377
  out, &index->entries, index->entries_search, path, path_len, stage);
@@ -418,7 +395,7 @@ void git_index__set_ignore_case(git_index *index, bool ignore_case)
418
395
 
419
396
  git_vector_set_cmp(&index->entries,
420
397
  ignore_case ? git_index_entry_icmp : git_index_entry_cmp);
421
- index_sort_if_needed(index, true);
398
+ git_vector_sort(&index->entries);
422
399
 
423
400
  git_vector_set_cmp(&index->reuc, ignore_case ? reuc_icmp : reuc_cmp);
424
401
  git_vector_sort(&index->reuc);
@@ -434,12 +411,6 @@ int git_index_open(git_index **index_out, const char *index_path)
434
411
  index = git__calloc(1, sizeof(git_index));
435
412
  GITERR_CHECK_ALLOC(index);
436
413
 
437
- if (git_mutex_init(&index->lock)) {
438
- giterr_set(GITERR_OS, "Failed to initialize lock");
439
- git__free(index);
440
- return -1;
441
- }
442
-
443
414
  git_pool_init(&index->tree_pool, 1);
444
415
 
445
416
  if (index_path != NULL) {
@@ -498,7 +469,6 @@ static void index_free(git_index *index)
498
469
  git_vector_free(&index->deleted);
499
470
 
500
471
  git__free(index->index_file_path);
501
- git_mutex_free(&index->lock);
502
472
 
503
473
  git__memzero(index, sizeof(*index));
504
474
  git__free(index);
@@ -561,11 +531,6 @@ int git_index_clear(git_index *index)
561
531
  index->tree = NULL;
562
532
  git_pool_clear(&index->tree_pool);
563
533
 
564
- if (git_mutex_lock(&index->lock) < 0) {
565
- giterr_set(GITERR_OS, "Failed to lock index");
566
- return -1;
567
- }
568
-
569
534
  git_idxmap_clear(index->entries_map);
570
535
  while (!error && index->entries.length > 0)
571
536
  error = index_remove_entry(index, index->entries.length - 1);
@@ -576,8 +541,6 @@ int git_index_clear(git_index *index)
576
541
 
577
542
  git_futils_filestamp_set(&index->stamp, NULL);
578
543
 
579
- git_mutex_unlock(&index->lock);
580
-
581
544
  return error;
582
545
  }
583
546
 
@@ -836,8 +799,7 @@ const git_index_entry *git_index_get_byindex(
836
799
  git_index *index, size_t n)
837
800
  {
838
801
  assert(index);
839
- if (index_sort_if_needed(index, true) < 0)
840
- return NULL;
802
+ git_vector_sort(&index->entries);
841
803
  return git_vector_get(&index->entries, n);
842
804
  }
843
805
 
@@ -1094,7 +1056,7 @@ static int has_dir_name(git_index *index,
1094
1056
  }
1095
1057
  len = slash - name;
1096
1058
 
1097
- if (!index_find(&pos, index, name, len, stage, false)) {
1059
+ if (!index_find(&pos, index, name, len, stage)) {
1098
1060
  retval = -1;
1099
1061
  if (!ok_to_replace)
1100
1062
  break;
@@ -1231,7 +1193,7 @@ static void index_existing_and_best(
1231
1193
  int error;
1232
1194
 
1233
1195
  error = index_find(&pos,
1234
- index, entry->path, 0, GIT_IDXENTRY_STAGE(entry), false);
1196
+ index, entry->path, 0, GIT_IDXENTRY_STAGE(entry));
1235
1197
 
1236
1198
  if (error == 0) {
1237
1199
  *existing = index->entries.contents[pos];
@@ -1296,11 +1258,6 @@ static int index_insert(
1296
1258
  /* this entry is now up-to-date and should not be checked for raciness */
1297
1259
  entry->flags_extended |= GIT_IDXENTRY_UPTODATE;
1298
1260
 
1299
- if (git_mutex_lock(&index->lock) < 0) {
1300
- giterr_set(GITERR_OS, "Unable to acquire index lock");
1301
- return -1;
1302
- }
1303
-
1304
1261
  git_vector_sort(&index->entries);
1305
1262
 
1306
1263
  /* look if an entry with this path already exists, either staged, or (if
@@ -1355,8 +1312,6 @@ static int index_insert(
1355
1312
  *entry_ptr = NULL;
1356
1313
  }
1357
1314
 
1358
- git_mutex_unlock(&index->lock);
1359
-
1360
1315
  return error;
1361
1316
  }
1362
1317
 
@@ -1559,11 +1514,6 @@ int git_index__fill(git_index *index, const git_vector *source_entries)
1559
1514
  if (!source_entries->length)
1560
1515
  return 0;
1561
1516
 
1562
- if (git_mutex_lock(&index->lock) < 0) {
1563
- giterr_set(GITERR_OS, "Unable to acquire index lock");
1564
- return -1;
1565
- }
1566
-
1567
1517
  git_vector_size_hint(&index->entries, source_entries->length);
1568
1518
  git_idxmap_resize(index->entries_map, source_entries->length * 1.3);
1569
1519
 
@@ -1588,7 +1538,6 @@ int git_index__fill(git_index *index, const git_vector *source_entries)
1588
1538
  if (!ret)
1589
1539
  git_vector_sort(&index->entries);
1590
1540
 
1591
- git_mutex_unlock(&index->lock);
1592
1541
  return ret;
1593
1542
  }
1594
1543
 
@@ -1619,17 +1568,12 @@ int git_index_remove(git_index *index, const char *path, int stage)
1619
1568
  size_t position;
1620
1569
  git_index_entry remove_key = {{ 0 }};
1621
1570
 
1622
- if (git_mutex_lock(&index->lock) < 0) {
1623
- giterr_set(GITERR_OS, "Failed to lock index");
1624
- return -1;
1625
- }
1626
-
1627
1571
  remove_key.path = path;
1628
1572
  GIT_IDXENTRY_STAGE_SET(&remove_key, stage);
1629
1573
 
1630
1574
  DELETE_IN_MAP(index, &remove_key);
1631
1575
 
1632
- if (index_find(&position, index, path, 0, stage, false) < 0) {
1576
+ if (index_find(&position, index, path, 0, stage) < 0) {
1633
1577
  giterr_set(
1634
1578
  GITERR_INDEX, "Index does not contain %s at stage %d", path, stage);
1635
1579
  error = GIT_ENOTFOUND;
@@ -1637,7 +1581,6 @@ int git_index_remove(git_index *index, const char *path, int stage)
1637
1581
  error = index_remove_entry(index, position);
1638
1582
  }
1639
1583
 
1640
- git_mutex_unlock(&index->lock);
1641
1584
  return error;
1642
1585
  }
1643
1586
 
@@ -1648,14 +1591,9 @@ int git_index_remove_directory(git_index *index, const char *dir, int stage)
1648
1591
  size_t pos;
1649
1592
  git_index_entry *entry;
1650
1593
 
1651
- if (git_mutex_lock(&index->lock) < 0) {
1652
- giterr_set(GITERR_OS, "Failed to lock index");
1653
- return -1;
1654
- }
1655
-
1656
1594
  if (!(error = git_buf_sets(&pfx, dir)) &&
1657
1595
  !(error = git_path_to_dir(&pfx)))
1658
- index_find(&pos, index, pfx.ptr, pfx.size, GIT_INDEX_STAGE_ANY, false);
1596
+ index_find(&pos, index, pfx.ptr, pfx.size, GIT_INDEX_STAGE_ANY);
1659
1597
 
1660
1598
  while (!error) {
1661
1599
  entry = git_vector_get(&index->entries, pos);
@@ -1672,7 +1610,6 @@ int git_index_remove_directory(git_index *index, const char *dir, int stage)
1672
1610
  /* removed entry at 'pos' so we don't need to increment */
1673
1611
  }
1674
1612
 
1675
- git_mutex_unlock(&index->lock);
1676
1613
  git_buf_free(&pfx);
1677
1614
 
1678
1615
  return error;
@@ -1684,12 +1621,7 @@ int git_index_find_prefix(size_t *at_pos, git_index *index, const char *prefix)
1684
1621
  size_t pos;
1685
1622
  const git_index_entry *entry;
1686
1623
 
1687
- if (git_mutex_lock(&index->lock) < 0) {
1688
- giterr_set(GITERR_OS, "Failed to lock index");
1689
- return -1;
1690
- }
1691
-
1692
- index_find(&pos, index, prefix, strlen(prefix), GIT_INDEX_STAGE_ANY, false);
1624
+ index_find(&pos, index, prefix, strlen(prefix), GIT_INDEX_STAGE_ANY);
1693
1625
  entry = git_vector_get(&index->entries, pos);
1694
1626
  if (!entry || git__prefixcmp(entry->path, prefix) != 0)
1695
1627
  error = GIT_ENOTFOUND;
@@ -1697,8 +1629,6 @@ int git_index_find_prefix(size_t *at_pos, git_index *index, const char *prefix)
1697
1629
  if (!error && at_pos)
1698
1630
  *at_pos = pos;
1699
1631
 
1700
- git_mutex_unlock(&index->lock);
1701
-
1702
1632
  return error;
1703
1633
  }
1704
1634
 
@@ -1706,7 +1636,7 @@ int git_index__find_pos(
1706
1636
  size_t *out, git_index *index, const char *path, size_t path_len, int stage)
1707
1637
  {
1708
1638
  assert(index && path);
1709
- return index_find(out, index, path, path_len, stage, true);
1639
+ return index_find(out, index, path, path_len, stage);
1710
1640
  }
1711
1641
 
1712
1642
  int git_index_find(size_t *at_pos, git_index *index, const char *path)
@@ -1715,14 +1645,8 @@ int git_index_find(size_t *at_pos, git_index *index, const char *path)
1715
1645
 
1716
1646
  assert(index && path);
1717
1647
 
1718
- if (git_mutex_lock(&index->lock) < 0) {
1719
- giterr_set(GITERR_OS, "Failed to lock index");
1720
- return -1;
1721
- }
1722
-
1723
1648
  if (git_vector_bsearch2(
1724
1649
  &pos, &index->entries, index->entries_search_path, path) < 0) {
1725
- git_mutex_unlock(&index->lock);
1726
1650
  giterr_set(GITERR_INDEX, "Index does not contain %s", path);
1727
1651
  return GIT_ENOTFOUND;
1728
1652
  }
@@ -1740,7 +1664,6 @@ int git_index_find(size_t *at_pos, git_index *index, const char *path)
1740
1664
  if (at_pos)
1741
1665
  *at_pos = pos;
1742
1666
 
1743
- git_mutex_unlock(&index->lock);
1744
1667
  return 0;
1745
1668
  }
1746
1669
 
@@ -1896,11 +1819,6 @@ static int index_conflict_remove(git_index *index, const char *path)
1896
1819
  if (path != NULL && git_index_find(&pos, index, path) < 0)
1897
1820
  return GIT_ENOTFOUND;
1898
1821
 
1899
- if (git_mutex_lock(&index->lock) < 0) {
1900
- giterr_set(GITERR_OS, "Unable to lock index");
1901
- return -1;
1902
- }
1903
-
1904
1822
  while ((conflict_entry = git_vector_get(&index->entries, pos)) != NULL) {
1905
1823
 
1906
1824
  if (path != NULL &&
@@ -1916,8 +1834,6 @@ static int index_conflict_remove(git_index *index, const char *path)
1916
1834
  break;
1917
1835
  }
1918
1836
 
1919
- git_mutex_unlock(&index->lock);
1920
-
1921
1837
  return error;
1922
1838
  }
1923
1839
 
@@ -2456,11 +2372,6 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
2456
2372
 
2457
2373
  seek_forward(INDEX_HEADER_SIZE);
2458
2374
 
2459
- if (git_mutex_lock(&index->lock) < 0) {
2460
- giterr_set(GITERR_OS, "Unable to acquire index lock");
2461
- return -1;
2462
- }
2463
-
2464
2375
  assert(!index->entries.length);
2465
2376
 
2466
2377
  if (index->ignore_case)
@@ -2490,6 +2401,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
2490
2401
  index_entry_free(entry);
2491
2402
  goto done;
2492
2403
  }
2404
+ error = 0;
2493
2405
 
2494
2406
  seek_forward(entry_size);
2495
2407
  }
@@ -2537,10 +2449,9 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
2537
2449
  * in-memory index is supposed to be case-insensitive
2538
2450
  */
2539
2451
  git_vector_set_sorted(&index->entries, !index->ignore_case);
2540
- error = index_sort_if_needed(index, false);
2452
+ git_vector_sort(&index->entries);
2541
2453
 
2542
2454
  done:
2543
- git_mutex_unlock(&index->lock);
2544
2455
  return error;
2545
2456
  }
2546
2457
 
@@ -2630,11 +2541,6 @@ static int write_entries(git_index *index, git_filebuf *file)
2630
2541
  git_vector case_sorted, *entries;
2631
2542
  git_index_entry *entry;
2632
2543
 
2633
- if (git_mutex_lock(&index->lock) < 0) {
2634
- giterr_set(GITERR_OS, "Failed to lock index");
2635
- return -1;
2636
- }
2637
-
2638
2544
  /* If index->entries is sorted case-insensitively, then we need
2639
2545
  * to re-sort it case-sensitively before writing */
2640
2546
  if (index->ignore_case) {
@@ -2649,8 +2555,6 @@ static int write_entries(git_index *index, git_filebuf *file)
2649
2555
  if ((error = write_disk_entry(file, entry)) < 0)
2650
2556
  break;
2651
2557
 
2652
- git_mutex_unlock(&index->lock);
2653
-
2654
2558
  if (index->ignore_case)
2655
2559
  git_vector_free(&case_sorted);
2656
2560
 
@@ -2935,8 +2839,7 @@ int git_index_read_tree(git_index *index, const git_tree *tree)
2935
2839
  index->tree = NULL;
2936
2840
  git_pool_clear(&index->tree_pool);
2937
2841
 
2938
- if (index_sort_if_needed(index, true) < 0)
2939
- return -1;
2842
+ git_vector_sort(&index->entries);
2940
2843
 
2941
2844
  if ((error = git_tree_walk(tree, GIT_TREEWALK_POST, read_tree_cb, &data)) < 0)
2942
2845
  goto cleanup;
@@ -2959,15 +2862,11 @@ int git_index_read_tree(git_index *index, const git_tree *tree)
2959
2862
 
2960
2863
  git_vector_sort(&entries);
2961
2864
 
2962
- if ((error = git_index_clear(index)) < 0)
2865
+ if ((error = git_index_clear(index)) < 0) {
2963
2866
  /* well, this isn't good */;
2964
- else if (git_mutex_lock(&index->lock) < 0) {
2965
- giterr_set(GITERR_OS, "Unable to acquire index lock");
2966
- error = -1;
2967
2867
  } else {
2968
2868
  git_vector_swap(&entries, &index->entries);
2969
2869
  entries_map = git__swap(index->entries_map, entries_map);
2970
- git_mutex_unlock(&index->lock);
2971
2870
  }
2972
2871
 
2973
2872
  cleanup:
@@ -3367,18 +3266,11 @@ int git_index_snapshot_new(git_vector *snap, git_index *index)
3367
3266
 
3368
3267
  GIT_REFCOUNT_INC(index);
3369
3268
 
3370
- if (git_mutex_lock(&index->lock) < 0) {
3371
- giterr_set(GITERR_OS, "Failed to lock index");
3372
- return -1;
3373
- }
3374
-
3375
3269
  git_atomic_inc(&index->readers);
3376
3270
  git_vector_sort(&index->entries);
3377
3271
 
3378
3272
  error = git_vector_dup(snap, &index->entries, index->entries._cmp);
3379
3273
 
3380
- git_mutex_unlock(&index->lock);
3381
-
3382
3274
  if (error < 0)
3383
3275
  git_index_free(index);
3384
3276
 
@@ -3391,11 +3283,6 @@ void git_index_snapshot_release(git_vector *snap, git_index *index)
3391
3283
 
3392
3284
  git_atomic_dec(&index->readers);
3393
3285
 
3394
- if (!git_mutex_lock(&index->lock)) {
3395
- index_free_deleted(index); /* try to free pending deleted items */
3396
- git_mutex_unlock(&index->lock);
3397
- }
3398
-
3399
3286
  git_index_free(index);
3400
3287
  }
3401
3288
 
@@ -3460,9 +3347,7 @@ int git_indexwriter_commit(git_indexwriter *writer)
3460
3347
  if (!writer->should_write)
3461
3348
  return 0;
3462
3349
 
3463
- if (index_sort_if_needed(writer->index, true) < 0)
3464
- return -1;
3465
-
3350
+ git_vector_sort(&writer->index->entries);
3466
3351
  git_vector_sort(&writer->index->reuc);
3467
3352
 
3468
3353
  if ((error = write_index(&checksum, writer->index, &writer->file)) < 0) {
@@ -28,7 +28,6 @@ struct git_index {
28
28
  git_vector entries;
29
29
  git_idxmap *entries_map;
30
30
 
31
- git_mutex lock; /* lock held while entries is being changed */
32
31
  git_vector deleted; /* deleted entries if readers > 0 */
33
32
  git_atomic readers; /* number of active iterators */
34
33
 
@@ -1399,7 +1399,7 @@ int git_path_dirload(
1399
1399
  git_vector *contents,
1400
1400
  const char *path,
1401
1401
  size_t prefix_len,
1402
- unsigned int flags)
1402
+ uint32_t flags)
1403
1403
  {
1404
1404
  git_path_diriter iter = GIT_PATH_DIRITER_INIT;
1405
1405
  const char *name;
@@ -1438,7 +1438,9 @@ static int repo_init_structure(
1438
1438
  }
1439
1439
 
1440
1440
  if (tdir) {
1441
- uint32_t cpflags = GIT_CPDIR_COPY_SYMLINKS | GIT_CPDIR_SIMPLE_TO_MODE;
1441
+ uint32_t cpflags = GIT_CPDIR_COPY_SYMLINKS |
1442
+ GIT_CPDIR_SIMPLE_TO_MODE |
1443
+ GIT_CPDIR_COPY_DOTFILES;
1442
1444
  if (opts->mode != GIT_REPOSITORY_INIT_SHARED_UMASK)
1443
1445
  cpflags |= GIT_CPDIR_CHMOD_DIRS;
1444
1446
  error = git_futils_cp_r(tdir, repo_dir, cpflags, dmode);
@@ -358,7 +358,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
358
358
  git_odb_object_free(target_obj);
359
359
 
360
360
  /** Ensure the tag name doesn't conflict with an already existing
361
- * reference unless overwriting has explictly been requested **/
361
+ * reference unless overwriting has explicitly been requested **/
362
362
  if (error == 0 && !allow_ref_overwrite) {
363
363
  giterr_set(GITERR_TAG, "Tag already exists");
364
364
  return GIT_EEXISTS;
@@ -136,9 +136,14 @@ static int ssh_stream_read(
136
136
  * not-found error, so read from stderr and signal EOF on
137
137
  * stderr.
138
138
  */
139
- if (rc == 0 && (rc = libssh2_channel_read_stderr(s->channel, buffer, buf_size)) > 0) {
140
- giterr_set(GITERR_SSH, "%*s", rc, buffer);
141
- return GIT_EEOF;
139
+ if (rc == 0) {
140
+ if ((rc = libssh2_channel_read_stderr(s->channel, buffer, buf_size)) > 0) {
141
+ giterr_set(GITERR_SSH, "%*s", rc, buffer);
142
+ return GIT_EEOF;
143
+ } else if (rc < LIBSSH2_ERROR_NONE) {
144
+ ssh_error(s->session, "SSH could not read stderr");
145
+ return -1;
146
+ }
142
147
  }
143
148
 
144
149
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rugged
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.0b11
4
+ version: 0.24.0b12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-17 00:00:00.000000000 Z
12
+ date: 2016-01-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
@@ -530,7 +530,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
530
530
  version: 1.3.1
531
531
  requirements: []
532
532
  rubyforge_project:
533
- rubygems_version: 2.2.5
533
+ rubygems_version: 2.2.2
534
534
  signing_key:
535
535
  specification_version: 4
536
536
  summary: Rugged is a Ruby binding to the libgit2 linkable library