rugged 0.22.0b4 → 0.22.0b5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/rugged.c +8 -7
  3. data/ext/rugged/rugged_note.c +1 -1
  4. data/ext/rugged/rugged_remote.c +0 -5
  5. data/ext/rugged/rugged_tree.c +23 -25
  6. data/lib/rugged/version.rb +1 -1
  7. data/vendor/libgit2/include/git2/blame.h +0 -1
  8. data/vendor/libgit2/include/git2/branch.h +1 -1
  9. data/vendor/libgit2/include/git2/buffer.h +1 -1
  10. data/vendor/libgit2/include/git2/cherrypick.h +5 -2
  11. data/vendor/libgit2/include/git2/clone.h +0 -1
  12. data/vendor/libgit2/include/git2/common.h +6 -1
  13. data/vendor/libgit2/include/git2/config.h +13 -4
  14. data/vendor/libgit2/include/git2/filter.h +3 -0
  15. data/vendor/libgit2/include/git2/global.h +10 -4
  16. data/vendor/libgit2/include/git2/index.h +3 -0
  17. data/vendor/libgit2/include/git2/merge.h +20 -5
  18. data/vendor/libgit2/include/git2/net.h +3 -2
  19. data/vendor/libgit2/include/git2/notes.h +5 -7
  20. data/vendor/libgit2/include/git2/push.h +7 -14
  21. data/vendor/libgit2/include/git2/rebase.h +14 -1
  22. data/vendor/libgit2/include/git2/refs.h +7 -1
  23. data/vendor/libgit2/include/git2/remote.h +6 -1
  24. data/vendor/libgit2/include/git2/repository.h +6 -0
  25. data/vendor/libgit2/include/git2/revert.h +5 -2
  26. data/vendor/libgit2/include/git2/stash.h +15 -6
  27. data/vendor/libgit2/include/git2/submodule.h +1 -1
  28. data/vendor/libgit2/include/git2/sys/diff.h +5 -2
  29. data/vendor/libgit2/include/git2/sys/hashsig.h +3 -0
  30. data/vendor/libgit2/include/git2/sys/mempack.h +1 -1
  31. data/vendor/libgit2/include/git2/sys/stream.h +40 -0
  32. data/vendor/libgit2/include/git2/sys/transport.h +17 -4
  33. data/vendor/libgit2/include/git2/tree.h +3 -3
  34. data/vendor/libgit2/src/checkout.c +27 -1
  35. data/vendor/libgit2/src/commit_list.c +1 -1
  36. data/vendor/libgit2/src/common.h +1 -1
  37. data/vendor/libgit2/src/config_cache.c +2 -0
  38. data/vendor/libgit2/src/config_file.c +1 -1
  39. data/vendor/libgit2/src/describe.c +2 -2
  40. data/vendor/libgit2/src/global.c +31 -14
  41. data/vendor/libgit2/src/ignore.c +86 -3
  42. data/vendor/libgit2/src/index.c +48 -25
  43. data/vendor/libgit2/src/indexer.c +1 -0
  44. data/vendor/libgit2/src/netops.c +18 -474
  45. data/vendor/libgit2/src/netops.h +3 -8
  46. data/vendor/libgit2/src/notes.c +3 -3
  47. data/vendor/libgit2/src/odb.c +1 -0
  48. data/vendor/libgit2/src/odb_loose.c +1 -1
  49. data/vendor/libgit2/src/openssl_stream.c +375 -0
  50. data/vendor/libgit2/src/openssl_stream.h +14 -0
  51. data/vendor/libgit2/src/path.c +256 -0
  52. data/vendor/libgit2/src/path.h +44 -1
  53. data/vendor/libgit2/src/pool.c +1 -1
  54. data/vendor/libgit2/src/push.c +5 -5
  55. data/vendor/libgit2/src/rebase.c +2 -2
  56. data/vendor/libgit2/src/refdb_fs.c +11 -1
  57. data/vendor/libgit2/src/remote.c +2 -7
  58. data/vendor/libgit2/src/repository.c +25 -0
  59. data/vendor/libgit2/src/repository.h +26 -2
  60. data/vendor/libgit2/src/socket_stream.c +212 -0
  61. data/vendor/libgit2/src/socket_stream.h +21 -0
  62. data/vendor/libgit2/src/stream.h +48 -0
  63. data/vendor/libgit2/src/tag.c +1 -1
  64. data/vendor/libgit2/src/transports/git.c +71 -57
  65. data/vendor/libgit2/src/transports/http.c +40 -62
  66. data/vendor/libgit2/src/transports/local.c +6 -11
  67. data/vendor/libgit2/src/transports/smart.c +3 -3
  68. data/vendor/libgit2/src/transports/ssh.c +12 -8
  69. data/vendor/libgit2/src/transports/winhttp.c +68 -47
  70. data/vendor/libgit2/src/tree.c +16 -14
  71. data/vendor/libgit2/src/tree.h +1 -0
  72. data/vendor/libgit2/src/util.c +91 -0
  73. data/vendor/libgit2/src/util.h +12 -0
  74. data/vendor/libgit2/src/win32/findfile.c +1 -0
  75. data/vendor/libgit2/src/win32/path_w32.c +305 -0
  76. data/vendor/libgit2/src/win32/path_w32.h +80 -0
  77. data/vendor/libgit2/src/win32/posix.h +1 -0
  78. data/vendor/libgit2/src/win32/posix_w32.c +25 -42
  79. data/vendor/libgit2/src/win32/utf-conv.c +36 -6
  80. data/vendor/libgit2/src/win32/utf-conv.h +0 -39
  81. data/vendor/libgit2/src/win32/w32_util.h +1 -0
  82. data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
  83. data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
  84. metadata +10 -2
@@ -128,12 +128,14 @@ GIT_EXTERN(int) git_push_update_tips(
128
128
  const char *reflog_message);
129
129
 
130
130
  /**
131
- * Actually push all given refspecs
131
+ * Perform the push
132
132
  *
133
- * Note: To check if the push was successful (i.e. all remote references
134
- * have been updated as requested), you need to call both
135
- * `git_push_unpack_ok` and `git_push_status_foreach`. The remote
136
- * repository might have refused to update some or all of the references.
133
+ * This function will return an error in case of a protocol error or
134
+ * the server being unable to unpack the data we sent.
135
+ *
136
+ * The return value does not reflect whether the server accepted or
137
+ * refused any reference updates. Use `git_push_status_foreach()` in
138
+ * order to find out which updates were accepted or rejected.
137
139
  *
138
140
  * @param push The push object
139
141
  *
@@ -141,15 +143,6 @@ GIT_EXTERN(int) git_push_update_tips(
141
143
  */
142
144
  GIT_EXTERN(int) git_push_finish(git_push *push);
143
145
 
144
- /**
145
- * Check if remote side successfully unpacked
146
- *
147
- * @param push The push object
148
- *
149
- * @return true if remote side successfully unpacked, false otherwise
150
- */
151
- GIT_EXTERN(int) git_push_unpack_ok(const git_push *push);
152
-
153
146
  /**
154
147
  * Invoke callback `cb' on each status entry
155
148
  *
@@ -21,6 +21,11 @@
21
21
  */
22
22
  GIT_BEGIN_DECL
23
23
 
24
+ /**
25
+ * Rebase options
26
+ *
27
+ * Use to tell the rebase machinery how to operate.
28
+ */
24
29
  typedef struct {
25
30
  unsigned int version;
26
31
 
@@ -40,7 +45,9 @@ typedef struct {
40
45
  const char *rewrite_notes_ref;
41
46
  } git_rebase_options;
42
47
 
43
- /** Type of rebase operation in-progress after calling `git_rebase_next`. */
48
+ /**
49
+ * Type of rebase operation in-progress after calling `git_rebase_next`.
50
+ */
44
51
  typedef enum {
45
52
  /**
46
53
  * The given commit is to be cherry-picked. The client should commit
@@ -82,6 +89,12 @@ typedef enum {
82
89
  #define GIT_REBASE_OPTIONS_VERSION 1
83
90
  #define GIT_REBASE_OPTIONS_INIT {GIT_REBASE_OPTIONS_VERSION}
84
91
 
92
+ /**
93
+ * A rebase operation
94
+ *
95
+ * Describes a single instruction/operation to be performed during the
96
+ * rebase.
97
+ */
85
98
  typedef struct {
86
99
  /** The type of rebase operation. */
87
100
  git_rebase_operation_t type;
@@ -58,7 +58,7 @@ GIT_EXTERN(int) git_reference_name_to_id(
58
58
  * Lookup a reference by DWIMing its short name
59
59
  *
60
60
  * Apply the git precendence rules to the given shorthand to determine
61
- * which reference the user is refering to.
61
+ * which reference the user is referring to.
62
62
  *
63
63
  * @param out pointer in which to store the reference
64
64
  * @param repo the repository in which to look
@@ -629,7 +629,13 @@ GIT_EXTERN(int) git_reference_is_tag(const git_reference *ref);
629
629
  */
630
630
  GIT_EXTERN(int) git_reference_is_note(const git_reference *ref);
631
631
 
632
+ /**
633
+ * Normalization options for reference lookup
634
+ */
632
635
  typedef enum {
636
+ /**
637
+ * No particular normalization.
638
+ */
633
639
  GIT_REF_FORMAT_NORMAL = 0u,
634
640
 
635
641
  /**
@@ -555,6 +555,11 @@ GIT_EXTERN(const git_remote_callbacks *) git_remote_get_callbacks(git_remote *re
555
555
  */
556
556
  GIT_EXTERN(const git_transfer_progress *) git_remote_stats(git_remote *remote);
557
557
 
558
+ /**
559
+ * Automatic tag following option
560
+ *
561
+ * Lets us select the --tags option to use.
562
+ */
558
563
  typedef enum {
559
564
  GIT_REMOTE_DOWNLOAD_TAGS_AUTO = 0,
560
565
  GIT_REMOTE_DOWNLOAD_TAGS_NONE = 1,
@@ -593,7 +598,7 @@ GIT_EXTERN(void) git_remote_set_autotag(
593
598
  *
594
599
  * @param problems non-default refspecs cannot be renamed and will be
595
600
  * stored here for further processing by the caller. Always free this
596
- * strarray on succesful return.
601
+ * strarray on successful return.
597
602
  * @param repo the repository in which to rename
598
603
  * @param name the current name of the reamote
599
604
  * @param new_name the new name the remote should bear
@@ -661,6 +661,12 @@ GIT_EXTERN(int) git_repository_detach_head(
661
661
  const git_signature *signature,
662
662
  const char *reflog_message);
663
663
 
664
+ /**
665
+ * Repository state
666
+ *
667
+ * These values represent possible states for the repository to be in,
668
+ * based on the current operation which is ongoing.
669
+ */
664
670
  typedef enum {
665
671
  GIT_REPOSITORY_STATE_NONE,
666
672
  GIT_REPOSITORY_STATE_MERGE,
@@ -20,14 +20,17 @@
20
20
  */
21
21
  GIT_BEGIN_DECL
22
22
 
23
+ /**
24
+ * Options for revert
25
+ */
23
26
  typedef struct {
24
27
  unsigned int version;
25
28
 
26
29
  /** For merge commits, the "mainline" is treated as the parent. */
27
30
  unsigned int mainline;
28
31
 
29
- git_merge_options merge_opts;
30
- git_checkout_options checkout_opts;
32
+ git_merge_options merge_opts; /*< Options for the merging */
33
+ git_checkout_options checkout_opts; /*< Options for the checkout */
31
34
  } git_revert_options;
32
35
 
33
36
  #define GIT_REVERT_OPTIONS_VERSION 1
@@ -18,21 +18,30 @@
18
18
  */
19
19
  GIT_BEGIN_DECL
20
20
 
21
+ /**
22
+ * Stash flags
23
+ */
21
24
  typedef enum {
25
+ /**
26
+ * No option, default
27
+ */
22
28
  GIT_STASH_DEFAULT = 0,
23
29
 
24
- /* All changes already added to the index
25
- * are left intact in the working directory
30
+ /**
31
+ * All changes already added to the index are left intact in
32
+ * the working directory
26
33
  */
27
34
  GIT_STASH_KEEP_INDEX = (1 << 0),
28
35
 
29
- /* All untracked files are also stashed and then
30
- * cleaned up from the working directory
36
+ /**
37
+ * All untracked files are also stashed and then cleaned up
38
+ * from the working directory
31
39
  */
32
40
  GIT_STASH_INCLUDE_UNTRACKED = (1 << 1),
33
41
 
34
- /* All ignored files are also stashed and then
35
- * cleaned up from the working directory
42
+ /**
43
+ * All ignored files are also stashed and then cleaned up from
44
+ * the working directory
36
45
  */
37
46
  GIT_STASH_INCLUDE_IGNORED = (1 << 2),
38
47
  } git_stash_flags;
@@ -148,7 +148,7 @@ GIT_EXTERN(void) git_submodule_free(git_submodule *submodule);
148
148
  * Iterate over all tracked submodules of a repository.
149
149
  *
150
150
  * See the note on `git_submodule` above. This iterates over the tracked
151
- * submodules as decribed therein.
151
+ * submodules as described therein.
152
152
  *
153
153
  * If you are concerned about items in the working directory that look like
154
154
  * submodules but are not tracked, the diff API will generate a diff record
@@ -61,10 +61,13 @@ GIT_EXTERN(int) git_diff_print_callback__to_file_handle(
61
61
  void *payload); /*< payload must be a `FILE *` */
62
62
 
63
63
 
64
+ /**
65
+ * Performance data from diffing
66
+ */
64
67
  typedef struct {
65
68
  unsigned int version;
66
- size_t stat_calls;
67
- size_t oid_calculations;
69
+ size_t stat_calls; /*< Number of stat() calls performed */
70
+ size_t oid_calculations; /*< Number of ID calculations */
68
71
  } git_diff_perfdata;
69
72
 
70
73
  #define GIT_DIFF_PERFDATA_VERSION 1
@@ -16,6 +16,9 @@ GIT_BEGIN_DECL
16
16
  */
17
17
  typedef struct git_hashsig git_hashsig;
18
18
 
19
+ /**
20
+ * Options for hashsig calculation
21
+ */
19
22
  typedef enum {
20
23
  GIT_HASHSIG_NORMAL = 0, /* use all data */
21
24
  GIT_HASHSIG_IGNORE_WHITESPACE = 1, /* ignore whitespace */
@@ -47,7 +47,7 @@ int git_mempack_new(git_odb_backend **out);
47
47
  * Dump all the queued in-memory writes to a packfile.
48
48
  *
49
49
  * The contents of the packfile will be stored in the given buffer.
50
- * It is the caller's responsability to ensure that the generated
50
+ * It is the caller's responsibility to ensure that the generated
51
51
  * packfile is available to the repository (e.g. by writing it
52
52
  * to disk, or doing something crazy like distributing it across
53
53
  * several copies of the repository over a network).
@@ -0,0 +1,40 @@
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_sys_git_stream_h__
8
+ #define INCLUDE_sys_git_stream_h__
9
+
10
+ #include "git2/common.h"
11
+ #include "git2/types.h"
12
+
13
+ GIT_BEGIN_DECL
14
+
15
+ #define GIT_STREAM_VERSION 1
16
+
17
+ /**
18
+ * Every stream must have this struct as its first element, so the
19
+ * API can talk to it. You'd define your stream as
20
+ *
21
+ * struct my_stream {
22
+ * git_stream parent;
23
+ * ...
24
+ * }
25
+ *
26
+ * and fill the functions
27
+ */
28
+ typedef struct git_stream {
29
+ int version;
30
+
31
+ int encrypted;
32
+ int (*connect)(struct git_stream *);
33
+ int (*certificate)(git_cert **, struct git_stream *);
34
+ ssize_t (*read)(struct git_stream *, void *, size_t);
35
+ ssize_t (*write)(struct git_stream *, const char *, size_t, int);
36
+ int (*close)(struct git_stream *);
37
+ void (*free)(struct git_stream *);
38
+ } git_stream;
39
+
40
+ #endif
@@ -21,6 +21,11 @@
21
21
 
22
22
  GIT_BEGIN_DECL
23
23
 
24
+ /**
25
+ * Flags to pass to transport
26
+ *
27
+ * Currently unused.
28
+ */
24
29
  typedef enum {
25
30
  GIT_TRANSPORTFLAGS_NONE = 0,
26
31
  } git_transport_flags_t;
@@ -49,7 +54,7 @@ struct git_transport {
49
54
 
50
55
  /* This function may be called after a successful call to
51
56
  * connect(). The array returned is owned by the transport and
52
- * is guranteed until the next call of a transport function. */
57
+ * is guaranteed until the next call of a transport function. */
53
58
  int (*ls)(
54
59
  const git_remote_head ***out,
55
60
  size_t *size,
@@ -286,12 +291,20 @@ typedef int (*git_smart_subtransport_cb)(
286
291
  git_smart_subtransport **out,
287
292
  git_transport* owner);
288
293
 
294
+ /**
295
+ * Definition for a "subtransport"
296
+ *
297
+ * This is used to let the smart protocol code know about the protocol
298
+ * which you are implementing.
299
+ */
289
300
  typedef struct git_smart_subtransport_definition {
290
- /* The function to use to create the git_smart_subtransport */
301
+ /** The function to use to create the git_smart_subtransport */
291
302
  git_smart_subtransport_cb callback;
292
303
 
293
- /* True if the protocol is stateless; false otherwise. For example,
294
- * http:// is stateless, but git:// is not. */
304
+ /**
305
+ * True if the protocol is stateless; false otherwise. For example,
306
+ * http:// is stateless, but git:// is not.
307
+ */
295
308
  unsigned rpc;
296
309
  } git_smart_subtransport_definition;
297
310
 
@@ -247,11 +247,12 @@ GIT_EXTERN(int) git_tree_entry_to_object(
247
247
  * entries and will have to be filled manually.
248
248
  *
249
249
  * @param out Pointer where to store the tree builder
250
+ * @param repo Repository in which to store the object
250
251
  * @param source Source tree to initialize the builder (optional)
251
252
  * @return 0 on success; error code otherwise
252
253
  */
253
254
  GIT_EXTERN(int) git_treebuilder_create(
254
- git_treebuilder **out, const git_tree *source);
255
+ git_treebuilder **out, git_repository *repo, const git_tree *source);
255
256
 
256
257
  /**
257
258
  * Clear all the entires in the builder
@@ -368,12 +369,11 @@ GIT_EXTERN(void) git_treebuilder_filter(
368
369
  * identifying SHA1 hash will be stored in the `id` pointer.
369
370
  *
370
371
  * @param id Pointer to store the OID of the newly written tree
371
- * @param repo Repository in which to store the object
372
372
  * @param bld Tree builder to write
373
373
  * @return 0 or an error code
374
374
  */
375
375
  GIT_EXTERN(int) git_treebuilder_write(
376
- git_oid *id, git_repository *repo, git_treebuilder *bld);
376
+ git_oid *id, git_treebuilder *bld);
377
377
 
378
378
 
379
379
  /** Callback for the tree traversal method */
@@ -1172,6 +1172,30 @@ static int checkout_get_remove_conflicts(
1172
1172
  return checkout_conflicts_foreach(data, data->index, workdir, pathspec, checkout_conflict_append_remove, data);
1173
1173
  }
1174
1174
 
1175
+ static int checkout_verify_paths(
1176
+ git_repository *repo,
1177
+ int action,
1178
+ git_diff_delta *delta)
1179
+ {
1180
+ unsigned int flags = GIT_PATH_REJECT_DEFAULTS | GIT_PATH_REJECT_DOT_GIT;
1181
+
1182
+ if (action & CHECKOUT_ACTION__REMOVE) {
1183
+ if (!git_path_isvalid(repo, delta->old_file.path, flags)) {
1184
+ giterr_set(GITERR_CHECKOUT, "Cannot remove invalid path '%s'", delta->old_file.path);
1185
+ return -1;
1186
+ }
1187
+ }
1188
+
1189
+ if (action & ~CHECKOUT_ACTION__REMOVE) {
1190
+ if (!git_path_isvalid(repo, delta->new_file.path, flags)) {
1191
+ giterr_set(GITERR_CHECKOUT, "Cannot checkout to invalid path '%s'", delta->old_file.path);
1192
+ return -1;
1193
+ }
1194
+ }
1195
+
1196
+ return 0;
1197
+ }
1198
+
1175
1199
  static int checkout_get_actions(
1176
1200
  uint32_t **actions_ptr,
1177
1201
  size_t **counts_ptr,
@@ -1205,7 +1229,9 @@ static int checkout_get_actions(
1205
1229
  }
1206
1230
 
1207
1231
  git_vector_foreach(deltas, i, delta) {
1208
- error = checkout_action(&act, data, delta, workdir, &wditem, &pathspec);
1232
+ if ((error = checkout_action(&act, data, delta, workdir, &wditem, &pathspec)) == 0)
1233
+ error = checkout_verify_paths(data->repo, act, delta);
1234
+
1209
1235
  if (error != 0)
1210
1236
  goto fail;
1211
1237
 
@@ -151,7 +151,7 @@ static int commit_quick_parse(
151
151
  while (buffer > committer_start && git__isspace(*buffer))
152
152
  buffer--;
153
153
 
154
- /* Seek for the begining of the pack of digits */
154
+ /* Seek for the beginning of the pack of digits */
155
155
  while (buffer > committer_start && git__isdigit(*buffer))
156
156
  buffer--;
157
157
 
@@ -68,7 +68,7 @@
68
68
  #define GITERR_CHECK_ALLOC(ptr) if (ptr == NULL) { return -1; }
69
69
 
70
70
  /**
71
- * Check a return value and propogate result if non-zero.
71
+ * Check a return value and propagate result if non-zero.
72
72
  */
73
73
  #define GITERR_CHECK_ERROR(code) \
74
74
  do { int _err = (code); if (_err) return _err; } while (0)
@@ -76,6 +76,8 @@ static struct map_data _cvar_maps[] = {
76
76
  {"core.precomposeunicode", NULL, 0, GIT_PRECOMPOSE_DEFAULT },
77
77
  {"core.safecrlf", _cvar_map_safecrlf, ARRAY_SIZE(_cvar_map_safecrlf), GIT_SAFE_CRLF_DEFAULT},
78
78
  {"core.logallrefupdates", NULL, 0, GIT_LOGALLREFUPDATES_DEFAULT },
79
+ {"core.protecthfs", NULL, 0, GIT_PROTECTHFS_DEFAULT },
80
+ {"core.protectntfs", NULL, 0, GIT_PROTECTNTFS_DEFAULT },
79
81
  };
80
82
 
81
83
  int git_config__cvar(int *out, git_config *config, git_cvar_cached cvar)
@@ -1532,7 +1532,7 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p
1532
1532
  goto rewrite_fail;
1533
1533
 
1534
1534
  /* Sanity check: if we are here, and value is NULL, that means that somebody
1535
- * touched the config file after our intial read. We should probably assert()
1535
+ * touched the config file after our initial read. We should probably assert()
1536
1536
  * this, but instead we'll handle it gracefully with an error. */
1537
1537
  if (value == NULL) {
1538
1538
  giterr_set(GITERR_CONFIG,
@@ -682,9 +682,9 @@ int git_describe_commit(
682
682
  if ((error = git_object_peel((git_object **)(&commit), committish, GIT_OBJ_COMMIT)) < 0)
683
683
  goto cleanup;
684
684
 
685
- if (git_reference_foreach_name(
685
+ if ((error = git_reference_foreach_name(
686
686
  git_object_owner(committish),
687
- get_name, &data) < 0)
687
+ get_name, &data)) < 0)
688
688
  goto cleanup;
689
689
 
690
690
  if (git_oidmap_size(data.names) == 0) {