rugged 0.22.2 → 0.23.0b1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/rugged.c +1 -2
  3. data/ext/rugged/rugged_branch_collection.c +6 -44
  4. data/ext/rugged/rugged_config.c +7 -3
  5. data/ext/rugged/rugged_diff_delta.c +1 -1
  6. data/ext/rugged/rugged_diff_line.c +1 -1
  7. data/ext/rugged/rugged_object.c +2 -2
  8. data/ext/rugged/rugged_reference_collection.c +12 -56
  9. data/ext/rugged/rugged_remote.c +4 -33
  10. data/ext/rugged/rugged_remote_collection.c +1 -1
  11. data/ext/rugged/rugged_repo.c +10 -36
  12. data/ext/rugged/rugged_settings.c +3 -3
  13. data/ext/rugged/rugged_tree.c +1 -1
  14. data/lib/rugged/version.rb +1 -1
  15. data/vendor/libgit2/CMakeLists.txt +10 -3
  16. data/vendor/libgit2/COPYING +15 -21
  17. data/vendor/libgit2/include/git2/annotated_commit.h +20 -3
  18. data/vendor/libgit2/include/git2/branch.h +20 -16
  19. data/vendor/libgit2/include/git2/checkout.h +32 -18
  20. data/vendor/libgit2/include/git2/cherrypick.h +2 -2
  21. data/vendor/libgit2/include/git2/clone.h +4 -10
  22. data/vendor/libgit2/include/git2/config.h +66 -12
  23. data/vendor/libgit2/include/git2/describe.h +3 -2
  24. data/vendor/libgit2/include/git2/diff.h +3 -3
  25. data/vendor/libgit2/include/git2/errors.h +1 -0
  26. data/vendor/libgit2/include/git2/filter.h +21 -5
  27. data/vendor/libgit2/include/git2/index.h +32 -0
  28. data/vendor/libgit2/include/git2/merge.h +20 -3
  29. data/vendor/libgit2/include/git2/oid.h +1 -1
  30. data/vendor/libgit2/include/git2/pack.h +13 -0
  31. data/vendor/libgit2/include/git2/patch.h +3 -6
  32. data/vendor/libgit2/include/git2/rebase.h +8 -12
  33. data/vendor/libgit2/include/git2/refs.h +19 -29
  34. data/vendor/libgit2/include/git2/remote.h +5 -11
  35. data/vendor/libgit2/include/git2/repository.h +44 -15
  36. data/vendor/libgit2/include/git2/reset.h +19 -10
  37. data/vendor/libgit2/include/git2/revert.h +2 -2
  38. data/vendor/libgit2/include/git2/submodule.h +3 -9
  39. data/vendor/libgit2/include/git2/sys/config.h +3 -1
  40. data/vendor/libgit2/include/git2/sys/filter.h +10 -2
  41. data/vendor/libgit2/include/git2/sys/hashsig.h +49 -22
  42. data/vendor/libgit2/include/git2/transport.h +1 -1
  43. data/vendor/libgit2/include/git2/types.h +10 -3
  44. data/vendor/libgit2/include/git2/version.h +3 -2
  45. data/vendor/libgit2/src/annotated_commit.c +28 -0
  46. data/vendor/libgit2/src/array.h +19 -8
  47. data/vendor/libgit2/src/attr.c +95 -35
  48. data/vendor/libgit2/src/attr_file.c +51 -17
  49. data/vendor/libgit2/src/attr_file.h +37 -10
  50. data/vendor/libgit2/src/attrcache.c +13 -7
  51. data/vendor/libgit2/src/attrcache.h +1 -0
  52. data/vendor/libgit2/src/blame.c +26 -2
  53. data/vendor/libgit2/src/blame_git.c +6 -2
  54. data/vendor/libgit2/src/blob.c +6 -8
  55. data/vendor/libgit2/src/branch.c +55 -43
  56. data/vendor/libgit2/src/buf_text.c +13 -6
  57. data/vendor/libgit2/src/buffer.c +110 -25
  58. data/vendor/libgit2/src/buffer.h +18 -0
  59. data/vendor/libgit2/src/checkout.c +164 -92
  60. data/vendor/libgit2/src/checkout.h +0 -7
  61. data/vendor/libgit2/src/cherrypick.c +13 -7
  62. data/vendor/libgit2/src/clone.c +23 -25
  63. data/vendor/libgit2/src/commit.c +3 -3
  64. data/vendor/libgit2/src/common.h +23 -1
  65. data/vendor/libgit2/src/config.c +137 -19
  66. data/vendor/libgit2/src/config.h +2 -2
  67. data/vendor/libgit2/src/config_cache.c +2 -1
  68. data/vendor/libgit2/src/config_file.c +39 -18
  69. data/vendor/libgit2/src/config_file.h +1 -1
  70. data/vendor/libgit2/src/crlf.c +1 -1
  71. data/vendor/libgit2/src/delta-apply.c +3 -2
  72. data/vendor/libgit2/src/delta.c +25 -6
  73. data/vendor/libgit2/src/describe.c +2 -0
  74. data/vendor/libgit2/src/diff.c +8 -5
  75. data/vendor/libgit2/src/diff_driver.c +39 -18
  76. data/vendor/libgit2/src/diff_file.c +1 -1
  77. data/vendor/libgit2/src/diff_patch.c +12 -6
  78. data/vendor/libgit2/src/diff_tform.c +21 -24
  79. data/vendor/libgit2/src/filebuf.c +14 -12
  80. data/vendor/libgit2/src/fileops.c +61 -18
  81. data/vendor/libgit2/src/fileops.h +11 -2
  82. data/vendor/libgit2/src/filter.c +351 -99
  83. data/vendor/libgit2/src/filter.h +17 -0
  84. data/vendor/libgit2/src/global.c +38 -9
  85. data/vendor/libgit2/src/hash/hash_generic.c +1 -1
  86. data/vendor/libgit2/src/hashsig.c +28 -16
  87. data/vendor/libgit2/src/ignore.c +2 -2
  88. data/vendor/libgit2/src/index.c +159 -42
  89. data/vendor/libgit2/src/index.h +29 -0
  90. data/vendor/libgit2/src/indexer.c +11 -2
  91. data/vendor/libgit2/src/integer.h +96 -0
  92. data/vendor/libgit2/src/iterator.c +5 -3
  93. data/vendor/libgit2/src/khash.h +41 -29
  94. data/vendor/libgit2/src/merge.c +48 -35
  95. data/vendor/libgit2/src/merge.h +0 -1
  96. data/vendor/libgit2/src/merge_file.c +13 -0
  97. data/vendor/libgit2/src/mwindow.c +1 -1
  98. data/vendor/libgit2/src/notes.c +1 -1
  99. data/vendor/libgit2/src/odb.c +13 -11
  100. data/vendor/libgit2/src/odb_loose.c +22 -10
  101. data/vendor/libgit2/src/odb_mempack.c +4 -2
  102. data/vendor/libgit2/src/offmap.h +3 -2
  103. data/vendor/libgit2/src/oid.c +1 -1
  104. data/vendor/libgit2/src/oidmap.h +2 -1
  105. data/vendor/libgit2/src/openssl_stream.c +6 -3
  106. data/vendor/libgit2/src/pack-objects.c +273 -12
  107. data/vendor/libgit2/src/pack-objects.h +10 -0
  108. data/vendor/libgit2/src/pack.c +17 -6
  109. data/vendor/libgit2/src/pack.h +1 -3
  110. data/vendor/libgit2/src/path.c +68 -38
  111. data/vendor/libgit2/src/pathspec.c +3 -0
  112. data/vendor/libgit2/src/pool.c +9 -8
  113. data/vendor/libgit2/src/posix.c +11 -1
  114. data/vendor/libgit2/src/push.c +15 -17
  115. data/vendor/libgit2/src/push.h +1 -6
  116. data/vendor/libgit2/src/rebase.c +77 -35
  117. data/vendor/libgit2/src/refdb_fs.c +2 -2
  118. data/vendor/libgit2/src/refs.c +107 -81
  119. data/vendor/libgit2/src/refs.h +2 -2
  120. data/vendor/libgit2/src/refspec.c +3 -0
  121. data/vendor/libgit2/src/remote.c +19 -21
  122. data/vendor/libgit2/src/repository.c +258 -67
  123. data/vendor/libgit2/src/repository.h +31 -16
  124. data/vendor/libgit2/src/reset.c +28 -12
  125. data/vendor/libgit2/src/revert.c +12 -7
  126. data/vendor/libgit2/src/revwalk.c +3 -5
  127. data/vendor/libgit2/src/revwalk.h +1 -1
  128. data/vendor/libgit2/src/sortedcache.c +5 -3
  129. data/vendor/libgit2/src/stash.c +3 -5
  130. data/vendor/libgit2/src/strmap.h +2 -1
  131. data/vendor/libgit2/src/submodule.c +5 -6
  132. data/vendor/libgit2/src/tag.c +7 -5
  133. data/vendor/libgit2/src/transaction.c +1 -1
  134. data/vendor/libgit2/src/transports/cred.c +5 -2
  135. data/vendor/libgit2/src/transports/git.c +2 -3
  136. data/vendor/libgit2/src/transports/local.c +15 -34
  137. data/vendor/libgit2/src/transports/smart.c +1 -1
  138. data/vendor/libgit2/src/transports/smart_pkt.c +58 -18
  139. data/vendor/libgit2/src/transports/smart_protocol.c +2 -2
  140. data/vendor/libgit2/src/transports/winhttp.c +2 -2
  141. data/vendor/libgit2/src/tree.c +7 -5
  142. data/vendor/libgit2/src/tsort.c +3 -1
  143. data/vendor/libgit2/src/util.c +25 -0
  144. data/vendor/libgit2/src/util.h +31 -27
  145. data/vendor/libgit2/src/vector.c +2 -7
  146. data/vendor/libgit2/src/win32/dir.c +5 -3
  147. data/vendor/libgit2/src/win32/git2.rc +8 -4
  148. data/vendor/libgit2/src/win32/mingw-compat.h +7 -0
  149. data/vendor/libgit2/src/win32/msvc-compat.h +3 -0
  150. data/vendor/libgit2/src/win32/posix.h +1 -3
  151. data/vendor/libgit2/src/win32/posix_w32.c +31 -7
  152. data/vendor/libgit2/src/win32/utf-conv.c +1 -3
  153. data/vendor/libgit2/src/zstream.c +1 -1
  154. metadata +5 -5
  155. data/vendor/libgit2/src/bswap.h +0 -97
@@ -157,7 +157,7 @@ static VALUE rb_git_remote_collection__each(VALUE self, int only_names)
157
157
 
158
158
  VALUE rb_repo;
159
159
 
160
- if (!rb_block_given_p()) {
160
+ if (!rb_block_given_p()) {
161
161
  if (only_names)
162
162
  return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_name"));
163
163
  else
@@ -235,7 +235,7 @@ static void rugged_repo_new_with_backend(git_repository **repo, VALUE rb_path, V
235
235
 
236
236
  if (error == GIT_ENOTFOUND) {
237
237
  giterr_clear();
238
- error = git_reference_symbolic_create(&head, *repo, "HEAD", "refs/heads/master", 0, NULL, NULL);
238
+ error = git_reference_symbolic_create(&head, *repo, "HEAD", "refs/heads/master", 0, NULL);
239
239
  }
240
240
 
241
241
  if (!error) {
@@ -1194,7 +1194,7 @@ static VALUE rb_git_repo_set_head(VALUE self, VALUE rb_head)
1194
1194
  Data_Get_Struct(self, git_repository, repo);
1195
1195
 
1196
1196
  Check_Type(rb_head, T_STRING);
1197
- error = git_repository_set_head(repo, StringValueCStr(rb_head), NULL, NULL);
1197
+ error = git_repository_set_head(repo, StringValueCStr(rb_head));
1198
1198
  rugged_exception_check(error);
1199
1199
 
1200
1200
  return Qnil;
@@ -1517,7 +1517,7 @@ static int parse_reset_type(VALUE rb_reset_type)
1517
1517
 
1518
1518
  /*
1519
1519
  * call-seq:
1520
- * repo.reset(target, reset_type, options = {}) -> nil
1520
+ * repo.reset(target, reset_type) -> nil
1521
1521
  *
1522
1522
  * Sets the current head to the specified commit oid and optionally
1523
1523
  * resets the index and working tree to match.
@@ -1534,51 +1534,25 @@ static int parse_reset_type(VALUE rb_reset_type)
1534
1534
  * replaced with the content of the index. (Untracked and ignored files
1535
1535
  * will be left alone)
1536
1536
  *
1537
- * The following options can be passed in the +options+ Hash:
1538
- *
1539
- * :message ::
1540
- * A single line log message to be appended to the reflog.
1541
- *
1542
- * :signature ::
1543
- * The signature to be used for populating the reflog entry.
1544
- *
1545
1537
  * Examples:
1546
1538
  *
1547
1539
  * repo.reset('origin/master', :hard) #=> nil
1548
1540
  */
1549
- static VALUE rb_git_repo_reset(int argc, VALUE *argv, VALUE self)
1541
+ static VALUE rb_git_repo_reset(VALUE self, VALUE rb_target, VALUE rb_reset_type)
1550
1542
  {
1551
- VALUE rb_target, rb_reset_type, rb_options;
1552
1543
  git_repository *repo;
1553
1544
  int reset_type;
1554
1545
  git_object *target = NULL;
1555
- char *log_message = NULL;
1556
- git_signature *signature = NULL;
1557
1546
  int error;
1558
1547
 
1559
- rb_scan_args(argc, argv, "20:", &rb_target, &rb_reset_type, &rb_options);
1560
-
1561
1548
  Data_Get_Struct(self, git_repository, repo);
1562
1549
 
1563
1550
  reset_type = parse_reset_type(rb_reset_type);
1564
1551
  target = rugged_object_get(repo, rb_target, GIT_OBJ_ANY);
1565
1552
 
1566
- if (!NIL_P(rb_options)) {
1567
- VALUE rb_val;
1568
-
1569
- rb_val = rb_hash_aref(rb_options, CSTR2SYM("signature"));
1570
- if (!NIL_P(rb_val))
1571
- signature = rugged_signature_get(rb_val, repo);
1572
-
1573
- rb_val = rb_hash_aref(rb_options, CSTR2SYM("message"));
1574
- if (!NIL_P(rb_val))
1575
- log_message = StringValueCStr(rb_val);
1576
- }
1577
-
1578
- error = git_reset(repo, target, reset_type, NULL, signature, log_message);
1553
+ error = git_reset(repo, target, reset_type, NULL);
1579
1554
 
1580
1555
  git_object_free(target);
1581
- git_signature_free(signature);
1582
1556
 
1583
1557
  rugged_exception_check(error);
1584
1558
 
@@ -1866,10 +1840,10 @@ static void rugged_parse_checkout_options(git_checkout_options *opts, VALUE rb_o
1866
1840
 
1867
1841
  if (rb_strategy == CSTR2SYM("safe")) {
1868
1842
  opts->checkout_strategy |= GIT_CHECKOUT_SAFE;
1869
- } else if (rb_strategy == CSTR2SYM("safe_create")) {
1870
- opts->checkout_strategy |= GIT_CHECKOUT_SAFE_CREATE;
1871
1843
  } else if (rb_strategy == CSTR2SYM("force")) {
1872
1844
  opts->checkout_strategy |= GIT_CHECKOUT_FORCE;
1845
+ } else if (rb_strategy == CSTR2SYM("recreate_missing")) {
1846
+ opts->checkout_strategy |= GIT_CHECKOUT_RECREATE_MISSING;
1873
1847
  } else if (rb_strategy == CSTR2SYM("allow_conflicts")) {
1874
1848
  opts->checkout_strategy |= GIT_CHECKOUT_ALLOW_CONFLICTS;
1875
1849
  } else if (rb_strategy == CSTR2SYM("remove_untracked")) {
@@ -1999,8 +1973,8 @@ static void rugged_parse_checkout_options(git_checkout_options *opts, VALUE rb_o
1999
1973
  * :safe ::
2000
1974
  * Allow safe updates that cannot overwrite uncommitted data.
2001
1975
  *
2002
- * :safe_create ::
2003
- * Allow safe updates plus creation of missing files.
1976
+ * :recreate_missing ::
1977
+ * Allow checkout to recreate missing files.
2004
1978
  *
2005
1979
  * :force ::
2006
1980
  * Allow all updates to force working directory to look like index.
@@ -2429,7 +2403,7 @@ void Init_rugged_repo(void)
2429
2403
 
2430
2404
  rb_define_method(rb_cRuggedRepo, "path_ignored?", rb_git_repo_is_path_ignored, 1);
2431
2405
 
2432
- rb_define_method(rb_cRuggedRepo, "reset", rb_git_repo_reset, -1);
2406
+ rb_define_method(rb_cRuggedRepo, "reset", rb_git_repo_reset, 2);
2433
2407
  rb_define_method(rb_cRuggedRepo, "reset_path", rb_git_repo_reset_path, -1);
2434
2408
 
2435
2409
  rb_define_method(rb_cRuggedRepo, "namespace=", rb_git_repo_set_namespace, 1);
@@ -78,7 +78,7 @@ static VALUE rb_git_set_option(VALUE self, VALUE option, VALUE value)
78
78
  val = NUM2SIZET(value);
79
79
  git_libgit2_opts(GIT_OPT_SET_MWINDOW_SIZE, val);
80
80
  }
81
-
81
+
82
82
  else if (strcmp(opt, "mwindow_mapped_limit") == 0) {
83
83
  size_t val;
84
84
  Check_Type(value, T_FIXNUM);
@@ -123,13 +123,13 @@ static VALUE rb_git_get_option(VALUE self, VALUE option)
123
123
  git_libgit2_opts(GIT_OPT_GET_MWINDOW_SIZE, &val);
124
124
  return SIZET2NUM(val);
125
125
  }
126
-
126
+
127
127
  else if (strcmp(opt, "mwindow_mapped_limit") == 0) {
128
128
  size_t val;
129
129
  git_libgit2_opts(GIT_OPT_GET_MWINDOW_MAPPED_LIMIT, &val);
130
130
  return SIZET2NUM(val);
131
131
  }
132
-
132
+
133
133
  else if (strcmp(opt, "search_path_global") == 0) {
134
134
  return get_search_path(GIT_CONFIG_LEVEL_GLOBAL);
135
135
  }
@@ -614,7 +614,7 @@ void rugged_parse_merge_options(git_merge_options *opts, VALUE rb_options)
614
614
  }
615
615
 
616
616
  if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("renames")))) {
617
- opts->flags |= GIT_MERGE_TREE_FIND_RENAMES;
617
+ opts->tree_flags |= GIT_MERGE_TREE_FIND_RENAMES;
618
618
  }
619
619
  }
620
620
  }
@@ -1,3 +1,3 @@
1
1
  module Rugged
2
- Version = VERSION = '0.22.2'
2
+ Version = VERSION = '0.23.0b1'
3
3
  end
@@ -35,6 +35,7 @@ OPTION( LIBGIT2_FILENAME "Name of the produced binary" OFF )
35
35
 
36
36
  OPTION( ANDROID "Build for android NDK" OFF )
37
37
 
38
+ OPTION( USE_OPENSSL "Link with and use openssl library" ON )
38
39
  OPTION( USE_ICONV "Link with and use iconv library" OFF )
39
40
  OPTION( USE_SSH "Link with libssh to enable SSH support" ON )
40
41
  OPTION( USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF )
@@ -151,7 +152,7 @@ IF (WIN32 AND WINHTTP AND NOT MINGW)
151
152
  INCLUDE_DIRECTORIES(deps/http-parser)
152
153
  FILE(GLOB SRC_HTTP deps/http-parser/*.c deps/http-parser/*.h)
153
154
  ELSE ()
154
- IF (NOT AMIGA)
155
+ IF (NOT AMIGA AND USE_OPENSSL)
155
156
  FIND_PACKAGE(OpenSSL)
156
157
  ENDIF ()
157
158
 
@@ -222,6 +223,8 @@ IF (LIBSSH2_FOUND)
222
223
  LINK_DIRECTORIES(${LIBSSH2_LIBRARY_DIRS})
223
224
  SET(LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} libssh2")
224
225
  SET(SSH_LIBRARIES ${LIBSSH2_LIBRARIES})
226
+ ELSE()
227
+ MESSAGE(STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.")
225
228
  ENDIF()
226
229
 
227
230
  # Optional external dependency: libgssapi
@@ -462,7 +465,7 @@ IF (BUILD_CLAR)
462
465
 
463
466
  INCLUDE_DIRECTORIES(${CLAR_PATH})
464
467
  FILE(GLOB_RECURSE SRC_TEST ${CLAR_PATH}/*/*.c ${CLAR_PATH}/*/*.h)
465
- SET(SRC_CLAR "${CLAR_PATH}/main.c" "${CLAR_PATH}/clar_libgit2.c" "${CLAR_PATH}/clar.c")
468
+ SET(SRC_CLAR "${CLAR_PATH}/main.c" "${CLAR_PATH}/clar_libgit2.c" "${CLAR_PATH}/clar_libgit2_trace.c" "${CLAR_PATH}/clar_libgit2_timer.c" "${CLAR_PATH}/clar.c")
466
469
 
467
470
  ADD_CUSTOM_COMMAND(
468
471
  OUTPUT ${CLAR_PATH}/clar.suite
@@ -490,7 +493,11 @@ IF (BUILD_CLAR)
490
493
  ENDIF ()
491
494
 
492
495
  ENABLE_TESTING()
493
- ADD_TEST(libgit2_clar libgit2_clar -ionline)
496
+ IF (WINHTTP OR OPENSSL_FOUND)
497
+ ADD_TEST(libgit2_clar libgit2_clar -ionline)
498
+ ELSE ()
499
+ ADD_TEST(libgit2_clar libgit2_clar -v)
500
+ ENDIF ()
494
501
  ENDIF ()
495
502
 
496
503
  IF (TAGS)
@@ -388,27 +388,21 @@ Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
388
388
 
389
389
  ----------------------------------------------------------------------
390
390
 
391
- The Clar framework is licensed under the MIT license:
392
-
393
- Copyright (C) 2011 by Vicent Marti
394
-
395
- Permission is hereby granted, free of charge, to any person obtaining a copy
396
- of this software and associated documentation files (the "Software"), to deal
397
- in the Software without restriction, including without limitation the rights
398
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
399
- copies of the Software, and to permit persons to whom the Software is
400
- furnished to do so, subject to the following conditions:
401
-
402
- The above copyright notice and this permission notice shall be included in
403
- all copies or substantial portions of the Software.
404
-
405
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
406
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
407
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
408
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
409
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
410
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
411
- THE SOFTWARE.
391
+ The Clar framework is licensed under the ISC license:
392
+
393
+ Copyright (c) 2011-2015 Vicent Marti
394
+
395
+ Permission to use, copy, modify, and/or distribute this software for any
396
+ purpose with or without fee is hereby granted, provided that the above
397
+ copyright notice and this permission notice appear in all copies.
398
+
399
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
400
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
401
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
402
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
403
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
404
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
405
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
412
406
 
413
407
  ----------------------------------------------------------------------
414
408
 
@@ -44,7 +44,7 @@ GIT_EXTERN(int) git_annotated_commit_from_ref(
44
44
  * @param repo repository that contains the given commit
45
45
  * @param branch_name name of the (remote) branch
46
46
  * @param remote_url url of the remote
47
- * @param oid the commit object id of the remote branch
47
+ * @param id the commit object id of the remote branch
48
48
  * @return 0 on success or error code
49
49
  */
50
50
  GIT_EXTERN(int) git_annotated_commit_from_fetchhead(
@@ -77,10 +77,27 @@ GIT_EXTERN(int) git_annotated_commit_lookup(
77
77
  git_repository *repo,
78
78
  const git_oid *id);
79
79
 
80
+ /**
81
+ * Creates a `git_annotated_comit` from a revision string.
82
+ *
83
+ * See `man gitrevisions`, or
84
+ * http://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for
85
+ * information on the syntax accepted.
86
+ *
87
+ * @param out pointer to store the git_annotated_commit result in
88
+ * @param repo repository that contains the given commit
89
+ * @param revspec the extended sha syntax string to use to lookup the commit
90
+ * @return 0 on success or error code
91
+ */
92
+ GIT_EXTERN(int) git_annotated_commit_from_revspec(
93
+ git_annotated_commit **out,
94
+ git_repository *repo,
95
+ const char *revspec);
96
+
80
97
  /**
81
98
  * Gets the commit ID that the given `git_annotated_commit` refers to.
82
99
  *
83
- * @param head the given annotated commit
100
+ * @param commit the given annotated commit
84
101
  * @return commit id
85
102
  */
86
103
  GIT_EXTERN(const git_oid *) git_annotated_commit_id(
@@ -89,7 +106,7 @@ GIT_EXTERN(const git_oid *) git_annotated_commit_id(
89
106
  /**
90
107
  * Frees a `git_annotated_commit`.
91
108
  *
92
- * @param annotated_commit annotated commit to free
109
+ * @param commit annotated commit to free
93
110
  */
94
111
  GIT_EXTERN(void) git_annotated_commit_free(
95
112
  git_annotated_commit *commit);
@@ -43,12 +43,6 @@ GIT_BEGIN_DECL
43
43
  *
44
44
  * @param force Overwrite existing branch.
45
45
  *
46
- * @param signature The identity that will used to populate the reflog entry
47
- *
48
- * @param log_message The one line long message to be appended to the reflog.
49
- * If NULL, the default is "Branch: created"; if you want something more
50
- * useful, provide a message.
51
- *
52
46
  * @return 0, GIT_EINVALIDSPEC or an error code.
53
47
  * A proper reference is written in the refs/heads namespace
54
48
  * pointing to the provided target commit.
@@ -58,9 +52,25 @@ GIT_EXTERN(int) git_branch_create(
58
52
  git_repository *repo,
59
53
  const char *branch_name,
60
54
  const git_commit *target,
61
- int force,
62
- const git_signature *signature,
63
- const char *log_message);
55
+ int force);
56
+
57
+ /**
58
+ * Create a new branch pointing at a target commit
59
+ *
60
+ * This behaves like `git_branch_create()` but takes an annotated
61
+ * commit, which lets you specify which extended sha syntax string was
62
+ * specified by a user, allowing for more exact reflog messages.
63
+ *
64
+ * See the documentation for `git_branch_create()`.
65
+ *
66
+ * @see git_branch_create
67
+ */
68
+ GIT_EXTERN(int) git_branch_create_from_annotated(
69
+ git_reference **ref_out,
70
+ git_repository *repository,
71
+ const char *branch_name,
72
+ const git_annotated_commit *commit,
73
+ int force);
64
74
 
65
75
  /**
66
76
  * Delete an existing branch reference.
@@ -123,19 +133,13 @@ GIT_EXTERN(void) git_branch_iterator_free(git_branch_iterator *iter);
123
133
  *
124
134
  * @param force Overwrite existing branch.
125
135
  *
126
- * @param signature The identity that will used to populate the reflog entry
127
- *
128
- * @param log_message The one line long message to be appended to the reflog
129
- *
130
136
  * @return 0 on success, GIT_EINVALIDSPEC or an error code.
131
137
  */
132
138
  GIT_EXTERN(int) git_branch_move(
133
139
  git_reference **out,
134
140
  git_reference *branch,
135
141
  const char *new_branch_name,
136
- int force,
137
- const git_signature *signature,
138
- const char *log_message);
142
+ int force);
139
143
 
140
144
  /**
141
145
  * Lookup a branch by its name in a repository.
@@ -31,7 +31,7 @@ GIT_BEGIN_DECL
31
31
  * check out, the "baseline" tree of what was checked out previously, the
32
32
  * working directory for actual files, and the index for staged changes.
33
33
  *
34
- * You give checkout one of four strategies for update:
34
+ * You give checkout one of three strategies for update:
35
35
  *
36
36
  * - `GIT_CHECKOUT_NONE` is a dry-run strategy that checks for conflicts,
37
37
  * etc., but doesn't make any actual changes.
@@ -40,8 +40,8 @@ GIT_BEGIN_DECL
40
40
  * make the working directory match the target (including potentially
41
41
  * discarding modified files).
42
42
  *
43
- * In between those are `GIT_CHECKOUT_SAFE` and `GIT_CHECKOUT_SAFE_CREATE`
44
- * both of which only make modifications that will not lose changes.
43
+ * - `GIT_CHECKOUT_SAFE` is between these two options, it will only make
44
+ * modifications that will not lose changes.
45
45
  *
46
46
  * | target == baseline | target != baseline |
47
47
  * ---------------------|-----------------------|----------------------|
@@ -51,28 +51,21 @@ GIT_BEGIN_DECL
51
51
  * workdir exists and | no action | conflict (notify |
52
52
  * is != baseline | notify dirty MODIFIED | and cancel checkout) |
53
53
  * ---------------------|-----------------------|----------------------|
54
- * workdir missing, | create if SAFE_CREATE | create file |
55
- * baseline present | notify dirty DELETED | |
54
+ * workdir missing, | notify dirty DELETED | create file |
55
+ * baseline present | | |
56
56
  * ---------------------|-----------------------|----------------------|
57
57
  *
58
- * The only difference between SAFE and SAFE_CREATE is that SAFE_CREATE
59
- * will cause a file to be checked out if it is missing from the working
60
- * directory even if it is not modified between the target and baseline.
61
- *
62
- *
63
58
  * To emulate `git checkout`, use `GIT_CHECKOUT_SAFE` with a checkout
64
59
  * notification callback (see below) that displays information about dirty
65
60
  * files. The default behavior will cancel checkout on conflicts.
66
61
  *
67
- * To emulate `git checkout-index`, use `GIT_CHECKOUT_SAFE_CREATE` with a
62
+ * To emulate `git checkout-index`, use `GIT_CHECKOUT_SAFE` with a
68
63
  * notification callback that cancels the operation if a dirty-but-existing
69
64
  * file is found in the working directory. This core git command isn't
70
65
  * quite "force" but is sensitive about some types of changes.
71
66
  *
72
67
  * To emulate `git checkout -f`, use `GIT_CHECKOUT_FORCE`.
73
68
  *
74
- * To emulate `git clone` use `GIT_CHECKOUT_SAFE_CREATE` in the options.
75
- *
76
69
  *
77
70
  * There are some additional flags to modified the behavior of checkout:
78
71
  *
@@ -116,12 +109,12 @@ typedef enum {
116
109
  /** Allow safe updates that cannot overwrite uncommitted data */
117
110
  GIT_CHECKOUT_SAFE = (1u << 0),
118
111
 
119
- /** Allow safe updates plus creation of missing files */
120
- GIT_CHECKOUT_SAFE_CREATE = (1u << 1),
121
-
122
112
  /** Allow all updates to force working directory to look like index */
123
- GIT_CHECKOUT_FORCE = (1u << 2),
113
+ GIT_CHECKOUT_FORCE = (1u << 1),
114
+
124
115
 
116
+ /** Allow checkout to recreate missing files */
117
+ GIT_CHECKOUT_RECREATE_MISSING = (1u << 2),
125
118
 
126
119
  /** Allow checkout to make safe updates even if conflicts are found */
127
120
  GIT_CHECKOUT_ALLOW_CONFLICTS = (1u << 4),
@@ -135,7 +128,10 @@ typedef enum {
135
128
  /** Only update existing files, don't create new ones */
136
129
  GIT_CHECKOUT_UPDATE_ONLY = (1u << 7),
137
130
 
138
- /** Normally checkout updates index entries as it goes; this stops that */
131
+ /**
132
+ * Normally checkout updates index entries as it goes; this stops that.
133
+ * Implies `GIT_CHECKOUT_DONT_WRITE_INDEX`.
134
+ */
139
135
  GIT_CHECKOUT_DONT_UPDATE_INDEX = (1u << 8),
140
136
 
141
137
  /** Don't refresh index/config/etc before doing checkout */
@@ -166,6 +162,9 @@ typedef enum {
166
162
  /** Don't overwrite existing files or folders */
167
163
  GIT_CHECKOUT_DONT_REMOVE_EXISTING = (1u << 22),
168
164
 
165
+ /** Normally checkout writes the index upon completion; this prevents that. */
166
+ GIT_CHECKOUT_DONT_WRITE_INDEX = (1u << 23),
167
+
169
168
  /**
170
169
  * THE FOLLOWING OPTIONS ARE NOT YET IMPLEMENTED
171
170
  */
@@ -214,6 +213,12 @@ typedef enum {
214
213
  GIT_CHECKOUT_NOTIFY_ALL = 0x0FFFFu
215
214
  } git_checkout_notify_t;
216
215
 
216
+ typedef struct {
217
+ size_t mkdir_calls;
218
+ size_t stat_calls;
219
+ size_t chmod_calls;
220
+ } git_checkout_perfdata;
221
+
217
222
  /** Checkout notification callback function */
218
223
  typedef int (*git_checkout_notify_cb)(
219
224
  git_checkout_notify_t why,
@@ -230,6 +235,11 @@ typedef void (*git_checkout_progress_cb)(
230
235
  size_t total_steps,
231
236
  void *payload);
232
237
 
238
+ /** Checkout perfdata notification function */
239
+ typedef void (*git_checkout_perfdata_cb)(
240
+ const git_checkout_perfdata *perfdata,
241
+ void *payload);
242
+
233
243
  /**
234
244
  * Checkout options structure
235
245
  *
@@ -269,6 +279,10 @@ typedef struct git_checkout_options {
269
279
  const char *ancestor_label; /**< the name of the common ancestor side of conflicts */
270
280
  const char *our_label; /**< the name of the "our" side of conflicts */
271
281
  const char *their_label; /**< the name of the "their" side of conflicts */
282
+
283
+ /** Optional callback to notify the consumer of performance data. */
284
+ git_checkout_perfdata_cb perfdata_cb;
285
+ void *perfdata_payload;
272
286
  } git_checkout_options;
273
287
 
274
288
  #define GIT_CHECKOUT_OPTIONS_VERSION 1