rugged 0.24.0b3 → 0.24.0b4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a31950be316b1d3480f1617cc75189bf90697dc2
4
- data.tar.gz: a97a557386b6875652eb2859e88da305fbb65ae3
3
+ metadata.gz: f1a251ffaf27a3d8447d1c970d5e537a3b36cf31
4
+ data.tar.gz: 432c8fee3c8af31b9878a98f243d2257b8b81208
5
5
  SHA512:
6
- metadata.gz: c6879754a8a09f93cff19b46a3faa180a091dbc5c80f0c00361da4d8661bcd837d362df6f519913501f3a878ec1f0a1fd192dcdb14d3b56d6384661769cc9144
7
- data.tar.gz: c958d72e7dfd55e54cd5b6ee6d6e9e56013919eb084759ef67354e02d48f883b93f2f2c5e876c1c48359321d8bb4458f1c5cde6a201ca6a92f19a0accab3a53d
6
+ metadata.gz: 23b487a868376093f2ef9c60e3b771c51b88fd9b40b2b5ff335462950be29833b1bbc197760fad7c25d3ed66bac5988faae145e5a3eb2be15288ae777c9e0c5a
7
+ data.tar.gz: 9d648ed4cf886ad0c217561519dfb74f7a665ac9c3be75719fafd23b2a911ed367ba4a82a162b8c7467ff5fd4cde178e657a778e1fa9dd3daf26bb3aed526cd2
@@ -846,6 +846,7 @@ static VALUE rb_git_repo_merge_commits(int argc, VALUE *argv, VALUE self)
846
846
  git_index *index;
847
847
  git_repository *repo;
848
848
  git_merge_options opts = GIT_MERGE_OPTIONS_INIT;
849
+ int error;
849
850
 
850
851
  rb_scan_args(argc, argv, "20:", &rb_our_commit, &rb_their_commit, &rb_options);
851
852
 
@@ -874,7 +875,11 @@ static VALUE rb_git_repo_merge_commits(int argc, VALUE *argv, VALUE self)
874
875
  Data_Get_Struct(rb_our_commit, git_commit, our_commit);
875
876
  Data_Get_Struct(rb_their_commit, git_commit, their_commit);
876
877
 
877
- rugged_exception_check(git_merge_commits(&index, repo, our_commit, their_commit, &opts));
878
+ error = git_merge_commits(&index, repo, our_commit, their_commit, &opts);
879
+ if (error == GIT_EMERGECONFLICT)
880
+ return Qnil;
881
+
882
+ rugged_exception_check(error);
878
883
 
879
884
  return rugged_index_new(rb_cRuggedIndex, self, index);
880
885
  }
@@ -616,6 +616,10 @@ void rugged_parse_merge_options(git_merge_options *opts, VALUE rb_options)
616
616
  if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("renames")))) {
617
617
  opts->tree_flags |= GIT_MERGE_TREE_FIND_RENAMES;
618
618
  }
619
+
620
+ if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("fail_on_conflict")))) {
621
+ opts->tree_flags |= GIT_MERGE_TREE_FAIL_ON_CONFLICT;
622
+ }
619
623
  }
620
624
  }
621
625
 
@@ -682,6 +686,9 @@ static VALUE rb_git_tree_merge(int argc, VALUE *argv, VALUE self)
682
686
  ancestor_tree = NULL;
683
687
 
684
688
  error = git_merge_trees(&index, repo, ancestor_tree, tree, other_tree, &opts);
689
+ if (error == GIT_EMERGECONFLICT)
690
+ return Qnil;
691
+
685
692
  rugged_exception_check(error);
686
693
 
687
694
  return rugged_index_new(rb_cRuggedIndex, rb_repo, index);
@@ -1,3 +1,3 @@
1
1
  module Rugged
2
- Version = VERSION = '0.24.0b3'
2
+ Version = VERSION = '0.24.0b4'
3
3
  end
@@ -10,12 +10,6 @@
10
10
  #include <time.h>
11
11
  #include <stdlib.h>
12
12
 
13
- #ifdef _MSC_VER
14
- # include "inttypes.h"
15
- #else
16
- # include <inttypes.h>
17
- #endif
18
-
19
13
  #ifdef __cplusplus
20
14
  # define GIT_BEGIN_DECL extern "C" {
21
15
  # define GIT_END_DECL }
@@ -26,6 +20,14 @@
26
20
  # define GIT_END_DECL /* empty */
27
21
  #endif
28
22
 
23
+ #ifdef _MSC_VER
24
+ GIT_BEGIN_DECL
25
+ # include "inttypes.h"
26
+ GIT_END_DECL
27
+ #else
28
+ # include <inttypes.h>
29
+ #endif
30
+
29
31
  /** Declare a public function exported for application use. */
30
32
  #if __GNUC__ >= 4
31
33
  # define GIT_EXTERN(type) extern \
@@ -29,25 +29,28 @@ GIT_BEGIN_DECL
29
29
  * priority levels as well.
30
30
  */
31
31
  typedef enum {
32
+ /** System-wide on Windows, for compatibility with portable git */
33
+ GIT_CONFIG_LEVEL_PROGRAMDATA = 1,
34
+
32
35
  /** System-wide configuration file; /etc/gitconfig on Linux systems */
33
- GIT_CONFIG_LEVEL_SYSTEM = 1,
36
+ GIT_CONFIG_LEVEL_SYSTEM = 2,
34
37
 
35
38
  /** XDG compatible configuration file; typically ~/.config/git/config */
36
- GIT_CONFIG_LEVEL_XDG = 2,
39
+ GIT_CONFIG_LEVEL_XDG = 3,
37
40
 
38
41
  /** User-specific configuration file (also called Global configuration
39
42
  * file); typically ~/.gitconfig
40
43
  */
41
- GIT_CONFIG_LEVEL_GLOBAL = 3,
44
+ GIT_CONFIG_LEVEL_GLOBAL = 4,
42
45
 
43
46
  /** Repository specific configuration file; $WORK_DIR/.git/config on
44
47
  * non-bare repos
45
48
  */
46
- GIT_CONFIG_LEVEL_LOCAL = 4,
49
+ GIT_CONFIG_LEVEL_LOCAL = 5,
47
50
 
48
51
  /** Application specific configuration file; freely defined by applications
49
52
  */
50
- GIT_CONFIG_LEVEL_APP = 5,
53
+ GIT_CONFIG_LEVEL_APP = 6,
51
54
 
52
55
  /** Represents the highest level available config file (i.e. the most
53
56
  * specific config file available that actually is loaded)
@@ -141,6 +144,17 @@ GIT_EXTERN(int) git_config_find_xdg(git_buf *out);
141
144
  */
142
145
  GIT_EXTERN(int) git_config_find_system(git_buf *out);
143
146
 
147
+ /**
148
+ * Locate the path to the configuration file in ProgramData
149
+ *
150
+ * Look for the file in %PROGRAMDATA%\Git\config used by portable git.
151
+ *
152
+ * @param out Pointer to a user-allocated git_buf in which to store the path
153
+ * @return 0 if a ProgramData configuration file has been
154
+ * found. Its path will be stored in `out`.
155
+ */
156
+ GIT_EXTERN(int) git_config_find_programdata(git_buf *out);
157
+
144
158
  /**
145
159
  * Open the global, XDG and system configuration files
146
160
  *
@@ -49,6 +49,7 @@ typedef enum {
49
49
  GIT_EINVALID = -21, /**< Invalid operation or input */
50
50
  GIT_EUNCOMMITTED = -22, /**< Uncommitted changes in index prevented operation */
51
51
  GIT_EDIRECTORY = -23, /**< The operation is not valid for a directory */
52
+ GIT_EMERGECONFLICT = -24, /**< A merge conflict exists and cannot continue */
52
53
 
53
54
  GIT_PASSTHROUGH = -30, /**< Internal only */
54
55
  GIT_ITEROVER = -31, /**< Signals end of iteration with iterator */
@@ -72,6 +72,13 @@ typedef enum {
72
72
  * the ability to merge between a modified and renamed file.
73
73
  */
74
74
  GIT_MERGE_TREE_FIND_RENAMES = (1 << 0),
75
+
76
+ /**
77
+ * If a conflict occurs, exit immediately instead of attempting to
78
+ * continue resolving conflicts. The merge operation will fail with
79
+ * GIT_EMERGECONFLICT and no index will be returned.
80
+ */
81
+ GIT_MERGE_TREE_FAIL_ON_CONFLICT = (1 << 1),
75
82
  } git_merge_tree_flag_t;
76
83
 
77
84
  /**
@@ -1086,6 +1086,12 @@ int git_config_find_system(git_buf *path)
1086
1086
  return git_sysdir_find_system_file(path, GIT_CONFIG_FILENAME_SYSTEM);
1087
1087
  }
1088
1088
 
1089
+ int git_config_find_programdata(git_buf *path)
1090
+ {
1091
+ git_buf_sanitize(path);
1092
+ return git_sysdir_find_programdata_file(path, GIT_CONFIG_FILENAME_PROGRAMDATA);
1093
+ }
1094
+
1089
1095
  int git_config__global_location(git_buf *buf)
1090
1096
  {
1091
1097
  const git_buf *paths;
@@ -1133,6 +1139,10 @@ int git_config_open_default(git_config **out)
1133
1139
  error = git_config_add_file_ondisk(cfg, buf.ptr,
1134
1140
  GIT_CONFIG_LEVEL_SYSTEM, 0);
1135
1141
 
1142
+ if (!error && !git_config_find_programdata(&buf))
1143
+ error = git_config_add_file_ondisk(cfg, buf.ptr,
1144
+ GIT_CONFIG_LEVEL_PROGRAMDATA, 0);
1145
+
1136
1146
  git_buf_free(&buf);
1137
1147
 
1138
1148
  if (error) {
@@ -12,6 +12,7 @@
12
12
  #include "vector.h"
13
13
  #include "repository.h"
14
14
 
15
+ #define GIT_CONFIG_FILENAME_PROGRAMDATA "config"
15
16
  #define GIT_CONFIG_FILENAME_SYSTEM "gitconfig"
16
17
  #define GIT_CONFIG_FILENAME_GLOBAL ".gitconfig"
17
18
  #define GIT_CONFIG_FILENAME_XDG "config"
@@ -493,8 +493,10 @@ static int diff_list_apply_options(
493
493
 
494
494
  /* Don't set GIT_DIFFCAPS_USE_DEV - compile time option in core git */
495
495
 
496
- /* Set GIT_DIFFCAPS_TRUST_NANOSECS on a platform basis */
496
+ /* Don't trust nanoseconds; we do not load nanos from disk */
497
+ #ifdef GIT_USE_NSEC
497
498
  diff->diffcaps = diff->diffcaps | GIT_DIFFCAPS_TRUST_NANOSECS;
499
+ #endif
498
500
 
499
501
  /* If not given explicit `opts`, check `diff.xyz` configs */
500
502
  if (!opts) {
@@ -1701,8 +1701,15 @@ int git_merge__iterators(
1701
1701
  if ((error = merge_conflict_resolve(&resolved, diff_list, conflict, opts.file_favor, opts.file_flags)) < 0)
1702
1702
  goto done;
1703
1703
 
1704
- if (!resolved)
1704
+ if (!resolved) {
1705
+ if ((opts.tree_flags & GIT_MERGE_TREE_FAIL_ON_CONFLICT)) {
1706
+ giterr_set(GITERR_MERGE, "merge conflicts exist");
1707
+ error = GIT_EMERGECONFLICT;
1708
+ goto done;
1709
+ }
1710
+
1705
1711
  git_vector_insert(&diff_list->conflicts, conflict);
1712
+ }
1706
1713
  }
1707
1714
 
1708
1715
  if (!given_opts || !given_opts->metric)
@@ -585,7 +585,8 @@ static int load_config(
585
585
  git_repository *repo,
586
586
  const char *global_config_path,
587
587
  const char *xdg_config_path,
588
- const char *system_config_path)
588
+ const char *system_config_path,
589
+ const char *programdata_path)
589
590
  {
590
591
  int error;
591
592
  git_buf config_path = GIT_BUF_INIT;
@@ -626,6 +627,12 @@ static int load_config(
626
627
  error != GIT_ENOTFOUND)
627
628
  goto on_error;
628
629
 
630
+ if (programdata_path != NULL &&
631
+ (error = git_config_add_file_ondisk(
632
+ cfg, programdata_path, GIT_CONFIG_LEVEL_PROGRAMDATA, 0)) < 0 &&
633
+ error != GIT_ENOTFOUND)
634
+ goto on_error;
635
+
629
636
  giterr_clear(); /* clear any lingering ENOTFOUND errors */
630
637
 
631
638
  *out = cfg;
@@ -651,11 +658,13 @@ int git_repository_config__weakptr(git_config **out, git_repository *repo)
651
658
  git_buf global_buf = GIT_BUF_INIT;
652
659
  git_buf xdg_buf = GIT_BUF_INIT;
653
660
  git_buf system_buf = GIT_BUF_INIT;
661
+ git_buf programdata_buf = GIT_BUF_INIT;
654
662
  git_config *config;
655
663
 
656
664
  git_config_find_global(&global_buf);
657
665
  git_config_find_xdg(&xdg_buf);
658
666
  git_config_find_system(&system_buf);
667
+ git_config_find_programdata(&programdata_buf);
659
668
 
660
669
  /* If there is no global file, open a backend for it anyway */
661
670
  if (git_buf_len(&global_buf) == 0)
@@ -665,7 +674,8 @@ int git_repository_config__weakptr(git_config **out, git_repository *repo)
665
674
  &config, repo,
666
675
  path_unless_empty(&global_buf),
667
676
  path_unless_empty(&xdg_buf),
668
- path_unless_empty(&system_buf));
677
+ path_unless_empty(&system_buf),
678
+ path_unless_empty(&programdata_buf));
669
679
  if (!error) {
670
680
  GIT_REFCOUNT_OWN(config, repo);
671
681
 
@@ -15,6 +15,16 @@
15
15
  #include "win32/findfile.h"
16
16
  #endif
17
17
 
18
+ static int git_sysdir_guess_programdata_dirs(git_buf *out)
19
+ {
20
+ #ifdef GIT_WIN32
21
+ return git_win32__find_programdata_dirs(out);
22
+ #else
23
+ git_buf_clear(out);
24
+ return 0;
25
+ #endif
26
+ }
27
+
18
28
  static int git_sysdir_guess_system_dirs(git_buf *out)
19
29
  {
20
30
  #ifdef GIT_WIN32
@@ -76,12 +86,13 @@ static int git_sysdir_guess_template_dirs(git_buf *out)
76
86
  typedef int (*git_sysdir_guess_cb)(git_buf *out);
77
87
 
78
88
  static git_buf git_sysdir__dirs[GIT_SYSDIR__MAX] =
79
- { GIT_BUF_INIT, GIT_BUF_INIT, GIT_BUF_INIT, GIT_BUF_INIT };
89
+ { GIT_BUF_INIT, GIT_BUF_INIT, GIT_BUF_INIT, GIT_BUF_INIT, GIT_BUF_INIT };
80
90
 
81
91
  static git_sysdir_guess_cb git_sysdir__dir_guess[GIT_SYSDIR__MAX] = {
82
92
  git_sysdir_guess_system_dirs,
83
93
  git_sysdir_guess_global_dirs,
84
94
  git_sysdir_guess_xdg_dirs,
95
+ git_sysdir_guess_programdata_dirs,
85
96
  git_sysdir_guess_template_dirs,
86
97
  };
87
98
 
@@ -258,6 +269,12 @@ int git_sysdir_find_xdg_file(git_buf *path, const char *filename)
258
269
  path, filename, GIT_SYSDIR_XDG, "global/xdg");
259
270
  }
260
271
 
272
+ int git_sysdir_find_programdata_file(git_buf *path, const char *filename)
273
+ {
274
+ return git_sysdir_find_in_dirlist(
275
+ path, filename, GIT_SYSDIR_PROGRAMDATA, "ProgramData");
276
+ }
277
+
261
278
  int git_sysdir_find_template_dir(git_buf *path)
262
279
  {
263
280
  return git_sysdir_find_in_dirlist(
@@ -38,6 +38,15 @@ extern int git_sysdir_find_xdg_file(git_buf *path, const char *filename);
38
38
  */
39
39
  extern int git_sysdir_find_system_file(git_buf *path, const char *filename);
40
40
 
41
+ /**
42
+ * Find a "ProgramData" file (i.e. one in %PROGRAMDATA%)
43
+ *
44
+ * @param path buffer to write the full path into
45
+ * @param filename name of file to find in the ProgramData directory
46
+ * @return 0 if found, GIT_ENOTFOUND if not found, or -1 on other OS error
47
+ */
48
+ extern int git_sysdir_find_programdata_file(git_buf *path, const char *filename);
49
+
41
50
  /**
42
51
  * Find template directory.
43
52
  *
@@ -50,8 +59,9 @@ typedef enum {
50
59
  GIT_SYSDIR_SYSTEM = 0,
51
60
  GIT_SYSDIR_GLOBAL = 1,
52
61
  GIT_SYSDIR_XDG = 2,
53
- GIT_SYSDIR_TEMPLATE = 3,
54
- GIT_SYSDIR__MAX = 4,
62
+ GIT_SYSDIR_PROGRAMDATA = 3,
63
+ GIT_SYSDIR_TEMPLATE = 4,
64
+ GIT_SYSDIR__MAX = 5,
55
65
  } git_sysdir_t;
56
66
 
57
67
  /**
@@ -215,3 +215,13 @@ int git_win32__find_xdg_dirs(git_buf *out)
215
215
 
216
216
  return win32_find_existing_dirs(out, global_tmpls);
217
217
  }
218
+
219
+ int git_win32__find_programdata_dirs(git_buf *out)
220
+ {
221
+ static const wchar_t *programdata_tmpls[2] = {
222
+ L"%PROGRAMDATA%\\Git",
223
+ NULL,
224
+ };
225
+
226
+ return win32_find_existing_dirs(out, programdata_tmpls);
227
+ }
@@ -11,6 +11,7 @@
11
11
  extern int git_win32__find_system_dirs(git_buf *out, const wchar_t *subpath);
12
12
  extern int git_win32__find_global_dirs(git_buf *out);
13
13
  extern int git_win32__find_xdg_dirs(git_buf *out);
14
+ extern int git_win32__find_programdata_dirs(git_buf *out);
14
15
 
15
16
  #endif
16
17
 
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.0b3
4
+ version: 0.24.0b4
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-10-21 00:00:00.000000000 Z
12
+ date: 2015-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
@@ -529,7 +529,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
529
529
  version: 1.3.1
530
530
  requirements: []
531
531
  rubyforge_project:
532
- rubygems_version: 2.2.2
532
+ rubygems_version: 2.2.5
533
533
  signing_key:
534
534
  specification_version: 4
535
535
  summary: Rugged is a Ruby binding to the libgit2 linkable library