rugged 0.28.4.1 → 0.28.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -794,7 +794,7 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char *
794
794
  if (git_buf_joinpath(&ref_path, basedir, name) < 0)
795
795
  return -1;
796
796
 
797
- filebuf_flags = GIT_FILEBUF_FORCE;
797
+ filebuf_flags = GIT_FILEBUF_CREATE_LEADING_DIRS;
798
798
  if (backend->fsync)
799
799
  filebuf_flags |= GIT_FILEBUF_FSYNC;
800
800
 
@@ -2080,6 +2080,9 @@ int git_refdb_backend_fs(
2080
2080
  backend = git__calloc(1, sizeof(refdb_fs_backend));
2081
2081
  GIT_ERROR_CHECK_ALLOC(backend);
2082
2082
 
2083
+ if (git_refdb_init_backend(&backend->parent, GIT_REFDB_BACKEND_VERSION) < 0)
2084
+ goto fail;
2085
+
2083
2086
  backend->repo = repository;
2084
2087
 
2085
2088
  if (repository->gitdir) {
@@ -140,6 +140,11 @@ int git_reference_delete(git_reference *ref)
140
140
  const git_oid *old_id = NULL;
141
141
  const char *old_target = NULL;
142
142
 
143
+ if (!strcmp(ref->name, "HEAD")) {
144
+ git_error_set(GIT_ERROR_REFERENCE, "cannot delete HEAD");
145
+ return GIT_ERROR;
146
+ }
147
+
143
148
  if (ref->type == GIT_REFERENCE_DIRECT)
144
149
  old_id = &ref->target.oid;
145
150
  else
@@ -799,7 +799,7 @@ int git_repository_open_ext(
799
799
  unsigned is_worktree;
800
800
  git_buf gitdir = GIT_BUF_INIT, workdir = GIT_BUF_INIT,
801
801
  gitlink = GIT_BUF_INIT, commondir = GIT_BUF_INIT;
802
- git_repository *repo;
802
+ git_repository *repo = NULL;
803
803
  git_config *config = NULL;
804
804
 
805
805
  if (flags & GIT_REPOSITORY_OPEN_FROM_ENV)
@@ -812,7 +812,7 @@ int git_repository_open_ext(
812
812
  &gitdir, &workdir, &gitlink, &commondir, start_path, flags, ceiling_dirs);
813
813
 
814
814
  if (error < 0 || !repo_ptr)
815
- return error;
815
+ goto cleanup;
816
816
 
817
817
  repo = repository_alloc();
818
818
  GIT_ERROR_CHECK_ALLOC(repo);
@@ -858,11 +858,14 @@ int git_repository_open_ext(
858
858
  cleanup:
859
859
  git_buf_dispose(&gitdir);
860
860
  git_buf_dispose(&workdir);
861
+ git_buf_dispose(&gitlink);
862
+ git_buf_dispose(&commondir);
861
863
  git_config_free(config);
862
864
 
863
865
  if (error < 0)
864
866
  git_repository_free(repo);
865
- else
867
+
868
+ if (repo_ptr)
866
869
  *repo_ptr = repo;
867
870
 
868
871
  return error;
@@ -2473,7 +2476,7 @@ int git_repository__set_orig_head(git_repository *repo, const git_oid *orig_head
2473
2476
  git_oid_fmt(orig_head_str, orig_head);
2474
2477
 
2475
2478
  if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_ORIG_HEAD_FILE)) == 0 &&
2476
- (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_MERGE_FILE_MODE)) == 0 &&
2479
+ (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_MERGE_FILE_MODE)) == 0 &&
2477
2480
  (error = git_filebuf_printf(&file, "%.*s\n", GIT_OID_HEXSZ, orig_head_str)) == 0)
2478
2481
  error = git_filebuf_commit(&file);
2479
2482
 
@@ -29,7 +29,7 @@ static int write_revert_head(
29
29
  int error = 0;
30
30
 
31
31
  if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_REVERT_HEAD_FILE)) >= 0 &&
32
- (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_REVERT_FILE_MODE)) >= 0 &&
32
+ (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_REVERT_FILE_MODE)) >= 0 &&
33
33
  (error = git_filebuf_printf(&file, "%s\n", commit_oidstr)) >= 0)
34
34
  error = git_filebuf_commit(&file);
35
35
 
@@ -51,7 +51,7 @@ static int write_merge_msg(
51
51
  int error = 0;
52
52
 
53
53
  if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_MSG_FILE)) < 0 ||
54
- (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_REVERT_FILE_MODE)) < 0 ||
54
+ (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_REVERT_FILE_MODE)) < 0 ||
55
55
  (error = git_filebuf_printf(&file, "Revert \"%s\"\n\nThis reverts commit %s.\n",
56
56
  commit_msgline, commit_oidstr)) < 0)
57
57
  goto cleanup;
@@ -82,15 +82,25 @@ static int git_sysdir_guess_global_dirs(git_buf *out)
82
82
  #else
83
83
  int error;
84
84
  uid_t uid, euid;
85
+ const char *sandbox_id;
85
86
 
86
87
  uid = getuid();
87
88
  euid = geteuid();
88
89
 
90
+ /**
91
+ * If APP_SANDBOX_CONTAINER_ID is set, we are running in a
92
+ * sandboxed environment on macOS.
93
+ */
94
+ sandbox_id = getenv("APP_SANDBOX_CONTAINER_ID");
95
+
89
96
  /*
90
97
  * In case we are running setuid, use the configuration
91
98
  * of the effective user.
99
+ *
100
+ * If we are running in a sandboxed environment on macOS,
101
+ * we have to get the HOME dir from the password entry file.
92
102
  */
93
- if (uid == euid)
103
+ if (!sandbox_id && uid == euid)
94
104
  error = git__getenv(out, "HOME");
95
105
  else
96
106
  error = get_passwd_home(out, euid);
@@ -339,7 +339,13 @@ int git_transaction_commit(git_transaction *tx)
339
339
  return error;
340
340
  }
341
341
 
342
- if (node->ref_type != GIT_REFERENCE_INVALID) {
342
+ if (node->ref_type == GIT_REFERENCE_INVALID) {
343
+ /* ref was locked but not modified */
344
+ if ((error = git_refdb_unlock(tx->db, node->payload, false, false, NULL, NULL, NULL)) < 0) {
345
+ return error;
346
+ }
347
+ node->committed = true;
348
+ } else {
343
349
  if ((error = update_target(tx->db, node)) < 0)
344
350
  return error;
345
351
  }
@@ -273,7 +273,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
273
273
  line += 3;
274
274
  len -= 3;
275
275
 
276
- if (line[len - 1] == '\n')
276
+ if (len && line[len - 1] == '\n')
277
277
  --len;
278
278
 
279
279
  GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, len, 1);
@@ -48,6 +48,10 @@
48
48
  # define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 0x00000800
49
49
  #endif
50
50
 
51
+ #ifndef HTTP_STATUS_PERMANENT_REDIRECT
52
+ # define HTTP_STATUS_PERMANENT_REDIRECT 308
53
+ #endif
54
+
51
55
  static const char *prefix_https = "https://";
52
56
  static const char *upload_pack_service = "upload-pack";
53
57
  static const char *upload_pack_ls_service_url = "/info/refs?service=git-upload-pack";
@@ -1014,7 +1018,8 @@ replay:
1014
1018
  HTTP_STATUS_REDIRECT == status_code ||
1015
1019
  (HTTP_STATUS_REDIRECT_METHOD == status_code &&
1016
1020
  get_verb == s->verb) ||
1017
- HTTP_STATUS_REDIRECT_KEEP_VERB == status_code)) {
1021
+ HTTP_STATUS_REDIRECT_KEEP_VERB == status_code ||
1022
+ HTTP_STATUS_PERMANENT_REDIRECT == status_code)) {
1018
1023
 
1019
1024
  /* Check for Windows 7. This workaround is only necessary on
1020
1025
  * Windows Vista and earlier. Windows 7 is version 6.1. */
@@ -33,7 +33,7 @@ typedef int GIT_SOCKET;
33
33
  # define st_atime_nsec st_atim.tv_nsec
34
34
  # define st_mtime_nsec st_mtim.tv_nsec
35
35
  # define st_ctime_nsec st_ctim.tv_nsec
36
- #elif !defined(GIT_USE_STAT_MTIME_NSEC) && defined(GIT_USE_NEC)
36
+ #elif !defined(GIT_USE_STAT_MTIME_NSEC) && defined(GIT_USE_NSEC)
37
37
  # error GIT_USE_NSEC defined but unknown struct stat nanosecond type
38
38
  #endif
39
39
 
@@ -32,8 +32,6 @@ static DWORD WINAPI git_win32__threadproc(LPVOID lpParameter)
32
32
 
33
33
  thread->result = thread->proc(thread->param);
34
34
 
35
- git__free_tls_data();
36
-
37
35
  return CLEAN_THREAD_EXIT;
38
36
  }
39
37
 
@@ -103,9 +101,6 @@ void git_thread_exit(void *value)
103
101
  {
104
102
  assert(GIT_GLOBAL->current_thread);
105
103
  GIT_GLOBAL->current_thread->result = value;
106
-
107
- git__free_tls_data();
108
-
109
104
  ExitThread(CLEAN_THREAD_EXIT);
110
105
  }
111
106
 
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.28.4.1
4
+ version: 0.28.5
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: 2019-12-11 00:00:00.000000000 Z
12
+ date: 2020-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
@@ -606,8 +606,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
606
606
  - !ruby/object:Gem::Version
607
607
  version: '0'
608
608
  requirements: []
609
- rubyforge_project:
610
- rubygems_version: 2.7.6.2
609
+ rubygems_version: 3.1.2
611
610
  signing_key:
612
611
  specification_version: 4
613
612
  summary: Rugged is a Ruby binding to the libgit2 linkable library