git 5.6.0 → 5.6.1

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
  SHA256:
3
- metadata.gz: fb847c9e15258e66f25f6856a2ceb170213e9ae310d061035ef23501e6e0cd72
4
- data.tar.gz: eca3a73ec5bf9f979d4576375062ceaeb71a78b54f12660b3b4386c2920792e9
3
+ metadata.gz: a8ec4da3066f7c301611783c89f0a127f6c8ad4e7cf2467db9fe9071b7e0f943
4
+ data.tar.gz: 10fc3f33082886e7ca47e1ea97bd50075ffb15afbb91e1b309d9a12168a590ac
5
5
  SHA512:
6
- metadata.gz: 3842eadabba8c7bead2147b438ca51597ca0acc129b7d33b41f942750d29cb7e5910b1ca92e3f50cf7bc440afb9f5ed203a97f38b72c19b09025f4e7317849f2
7
- data.tar.gz: 558adf7d3f23639b9143dcf3b9092739caba6415e066a8273f491f0589f3af06851dc15fd1776b2bad3e406d01429da76cce72c7e05f3c7ac57858bc3a771645
6
+ metadata.gz: 91e896c14c04e2135468d70031721cfbb29ba873284160f208315025bacc331a0fefaa04c837467d33b284253a04267ee8f4c003ea564770d619f9365ecb1b73
7
+ data.tar.gz: 03c6e84729ce4a4e6809cf53b92a6bcfb48572f1b8724e83cc451e829d1357b93da286e8fd6c669ddce3aa946cb0890237008992b9230e8cf41991e291fb8f76
data/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@
5
5
 
6
6
  # Change Log
7
7
 
8
+ ## [5.6.1](https://github.com/ruby-git/ruby-git/compare/v5.6.0...v5.6.1) (2026-09-16)
9
+
10
+
11
+ ### Other Changes
12
+
13
+ * **errors:** Document that filesystem and gzip errors can escape unconverted ([0b171e4](https://github.com/ruby-git/ruby-git/commit/0b171e42713a884354a84138696102f8e3cd83e5)), closes [#1809](https://github.com/ruby-git/ruby-git/issues/1809)
14
+ * **remote:** Correct the argument forms in the Git::Remote and Git::Branch entries ([cea622a](https://github.com/ruby-git/ruby-git/commit/cea622a14cce54a90c2203953a457b13b298aa22)), closes [#1852](https://github.com/ruby-git/ruby-git/issues/1852)
15
+ * **tag:** Note that tag_create raises UnexpectedResultError in v6.0.0 ([050aa44](https://github.com/ruby-git/ruby-git/commit/050aa443136156d7ecab47ad6fb44f436d9c2b7f)), closes [#1856](https://github.com/ruby-git/ruby-git/issues/1856)
16
+ * **worktree:** Look the new worktree up with File.identical? in the v5.x note ([0c941ec](https://github.com/ruby-git/ruby-git/commit/0c941ec34204ef5c3aeb6cf1de9e61f33212a0d9))
17
+ * **worktree:** Look the new worktree up with File.identical? in the YARD note ([8eb10ec](https://github.com/ruby-git/ruby-git/commit/8eb10eccb50ff14911e09033cfeec33666ce5c6a)), closes [#1845](https://github.com/ruby-git/ruby-git/issues/1845)
18
+ * **worktree:** Note that worktree_add returns Git::WorktreeInfo in v6.0.0 ([24af07e](https://github.com/ruby-git/ruby-git/commit/24af07e24199303727d823804063732fcaa98c98)), closes [#1845](https://github.com/ruby-git/ruby-git/issues/1845)
19
+
8
20
  ## [5.6.0](https://github.com/ruby-git/ruby-git/compare/v5.5.0...v5.6.0) (2026-09-12)
9
21
 
10
22
 
data/README.md CHANGED
@@ -201,11 +201,41 @@ the full API of its result.
201
201
 
202
202
  ## Errors raised by this gem
203
203
 
204
- The git gem raises only `ArgumentError` or errors that subclass `Git::Error`. It
205
- does not explicitly raise any other types of errors.
206
-
207
- Rescue `Git::Error` to catch any runtime error raised by this gem, unless you need
208
- more specific error handling.
204
+ Errors the git gem raises deliberately are either `ArgumentError` or a subclass of
205
+ `Git::Error`, with one exception: with the `raise` behavior described under
206
+ [Deprecations](#deprecations), a deprecated call raises
207
+ `ActiveSupport::DeprecationException`, which is intentionally not a `Git::Error` so a
208
+ broad rescue cannot hide a deprecation your code opted to treat as fatal. The errors
209
+ described below come from Ruby's standard library and are not converted.
210
+
211
+ The gem's own filesystem operations, such as reading a `.git` pointer file,
212
+ creating a temporary file, or changing directory, do not convert operating system
213
+ errors. These can be raised as a bare `SystemCallError` (for example `Errno::ENOENT`
214
+ or `Errno::EACCES`) rather than `Git::Error`. Gzip compression in `archive` can
215
+ likewise raise a `Zlib::Error`. Rescue `SystemCallError` and `Zlib::Error` alongside
216
+ `Git::Error` if your code needs to handle them.
217
+
218
+ The affected methods are `Git.open` when the `.git` file is a gitdir pointer or the
219
+ path is relative, `Git.init`, `Git.bare`, and `Git.clone` when the path is relative,
220
+ `Git.export`, and these `Git::Repository` methods: `#chdir`, `#with_index`,
221
+ `#with_working`, `#with_temp_index`, `#with_temp_working`, `#set_index`,
222
+ `#set_working`, `#cat_file_contents` in block form, `#each_conflict`, `#conflicts`,
223
+ `#archive` (including the gzip step), `#repo_size`, and `#tag_sha` when it reads a
224
+ loose ref.
225
+
226
+ Any method that captures git output can also raise
227
+ `Encoding::ConverterNotFoundError` when the output contains a line whose detected
228
+ encoding, such as UTF-7, has no Ruby converter.
229
+
230
+ Starting with v6.0.0, the filesystem and gzip errors are raised as `Git::Error`
231
+ with the original error available through `cause`, except that `#tag_sha` falls
232
+ back to `git show-ref` instead of raising. Lines with no Ruby converter are
233
+ scrubbed instead of raising.
234
+
235
+ Rescue `Git::Error` to catch the runtime errors this gem raises itself, and add
236
+ `SystemCallError`, `Zlib::Error`, and `Encoding::ConverterNotFoundError` where the
237
+ paragraphs above say they can escape. Rescue a more specific subclass when you need
238
+ finer-grained handling.
209
239
 
210
240
  ```ruby
211
241
  begin
data/UPGRADING.md CHANGED
@@ -637,7 +637,8 @@ with N remotes produces N + 1 warnings per call.
637
637
  > the last one configured, so use `r.url.last` to reproduce that exact value.
638
638
  > Likewise, `Git::Remote#fetch_opts` returned only the last configured fetch
639
639
  > refspec, while `fetch` holds all of them. Operations that lived on
640
- > `Git::Remote` are called on the repository with the remote name instead.
640
+ > `Git::Remote` are called on the repository instead; the table below shows
641
+ > the argument each one takes.
641
642
  >
642
643
  > **Order change:** `remotes` lists remotes in the order `git remote` prints
643
644
  > them, while `remote_list` keeps the order in which remotes first appear in the
@@ -656,8 +657,8 @@ with N remotes produces N + 1 warnings per call.
656
657
  | `remote.fetch(opts)` | `g.fetch(remote.name, opts)` — same options hash |
657
658
  | `remote.merge` | `g.merge("#{remote.name}/#{g.current_branch}")` |
658
659
  | `remote.merge(branch)` | `g.merge("#{remote.name}/#{branch}")` |
659
- | `remote.branch` | `g.branch_list("#{remote.name}/#{g.current_branch}").first` — returns a `Git::BranchInfo` |
660
- | `remote.branch(name)` | `g.branch_list("#{remote.name}/#{name}").first` — returns a `Git::BranchInfo` |
660
+ | `remote.branch` | `g.branch_list("#{remote.name}/#{g.current_branch}").find(&:remote?)` — returns a `Git::BranchInfo` |
661
+ | `remote.branch(name)` | `g.branch_list("#{remote.name}/#{name}").find(&:remote?)` — returns a `Git::BranchInfo` |
661
662
  | `remote.remove` | `g.remote_remove(remote.name)` |
662
663
 
663
664
  #### `Git::Remote` deprecated
@@ -665,13 +666,13 @@ with N remotes produces N + 1 warnings per call.
665
666
  `Git::Remote`, `Git::Repository#remote`, and `Git::Repository#config_remote` are
666
667
  deprecated and are removed in v6.0.0. Read a remote's configuration through
667
668
  `Git::Repository#remote_list`, which returns one `Git::RemoteInfo` value object per
668
- remote, and call the repository-level operations (`fetch`, `merge`, `branch_list`,
669
- `remote_remove`) with the remote name. Return values are unchanged. Constructing a
670
- `Git::Remote` directly emits one deprecation warning, and so does calling
671
- `g.config_remote`. Calling `g.remote` emits two: one for `Git::Repository#remote`
672
- and one for the `Git::Remote` it constructs. Likewise `g.remotes` emits one warning
673
- for itself plus one per `Git::Remote` it returns (N + 1 for N remotes). The extra
674
- warnings from `g.remote` and `g.remotes` are expected, not a bug.
669
+ remote; the table below shows the replacement for each operation. Return values
670
+ are unchanged. Constructing a `Git::Remote` directly emits one deprecation warning,
671
+ and so does calling `g.config_remote`. Calling `g.remote` emits two: one for
672
+ `Git::Repository#remote` and one for the `Git::Remote` it constructs. Likewise
673
+ `g.remotes` emits one warning for itself plus one per `Git::Remote` it returns
674
+ (N + 1 for N remotes). The extra warnings from `g.remote` and `g.remotes` are
675
+ expected, not a bug.
675
676
 
676
677
  > **Return type changes:** `Git::RemoteInfo#url` and `Git::RemoteInfo#fetch` are
677
678
  > frozen `Array<String>` because a remote may carry more than one URL or fetch
@@ -686,8 +687,9 @@ warnings from `g.remote` and `g.remotes` are expected, not a bug.
686
687
  > Code that reads custom keys should filter `g.config_list` instead (see the
687
688
  > table); that yields the same `Hash{String => String}` as `config_remote`.
688
689
  > `Git::Remote#branch` returned a `Git::Branch`. Its replacement,
689
- > `g.branch_list("#{name}/#{branch}").first`, returns a `Git::BranchInfo` value
690
- > object, or `nil` when the remote-tracking branch does not exist.
690
+ > `g.branch_list("#{name}/#{branch}").find(&:remote?)`, returns a
691
+ > `Git::BranchInfo` value object, or `nil` when the remote-tracking branch does
692
+ > not exist.
691
693
 
692
694
  In the table, `name` is the remote name (`g.remote` defaults it to `'origin'`).
693
695
 
@@ -704,8 +706,8 @@ In the table, `name` is the remote name (`g.remote` defaults it to `'origin'`).
704
706
  | `remote.fetch(opts)` | `g.fetch(name, opts)` — same option keys |
705
707
  | `remote.merge` | `g.merge("#{name}/#{g.current_branch}")` |
706
708
  | `remote.merge(branch)` | `g.merge("#{name}/#{branch}")` |
707
- | `remote.branch` | `g.branch_list("#{name}/#{g.current_branch}").first` — returns a `Git::BranchInfo` |
708
- | `remote.branch(branch)` | `g.branch_list("#{name}/#{branch}").first` — returns a `Git::BranchInfo` |
709
+ | `remote.branch` | `g.branch_list("#{name}/#{g.current_branch}").find(&:remote?)` — returns a `Git::BranchInfo` |
710
+ | `remote.branch(branch)` | `g.branch_list("#{name}/#{branch}").find(&:remote?)` — returns a `Git::BranchInfo` |
709
711
  | `remote.remove` | `g.remote_remove(name)` |
710
712
 
711
713
  #### `Git::Commands::CatFile::Raw` `allow_unknown_type` option deprecated
@@ -735,10 +737,12 @@ that constructs the command class directly is affected.
735
737
  data through `Git::Repository#branch_list`, which returns one `Git::BranchInfo`
736
738
  value object per local and remote-tracking branch, and call the repository-level
737
739
  operations (`checkout`, `branch_new`, `branch_delete`, `merge`, `merge_into`,
738
- `in_branch`, and so on) with the branch name. Calling `g.branch` or `g.branches`,
739
- constructing a `Git::Branches`, and calling any operation on a `Git::Branch` each
740
- emit a deprecation warning; their return values are unchanged. The `full`,
741
- `name`, `remote`, `to_s`, and `to_a` readers on `Git::Branch` do not warn.
740
+ `in_branch`, and so on) with the branch name. For a remote-tracking branch the
741
+ argument differs by operation; the table below shows the form each one takes.
742
+ Calling `g.branch` or `g.branches`, constructing a `Git::Branches`, and calling
743
+ any operation on a `Git::Branch` each emit a deprecation warning; their return
744
+ values are unchanged. The `full`, `name`, `remote`, `to_s`, and `to_a` readers
745
+ on `Git::Branch` do not warn.
742
746
 
743
747
  > **Return shape change:** `Git::Branch` exposes `full` (`main` or
744
748
  > `remotes/origin/main`), `name`, and `remote` (a `Git::Remote`, or `nil`).
@@ -863,6 +867,13 @@ warn.
863
867
  > **Missing tags:** `g.tag(name)` raises `Git::UnexpectedResultError` when no tag
864
868
  > has that name. `g.tag_list(name).first` returns `nil`.
865
869
  >
870
+ > **`tag_create` when the new tag is missing in v6.0.0:** on v5.x, `g.tag_create`
871
+ > returns `nil` when the tag it has just created is missing from the tag list
872
+ > (for example, another process deleted it before the lookup). In v6.0.0 it
873
+ > raises `Git::UnexpectedResultError` instead, so its return value is always a
874
+ > `Git::TagInfo`. A `nil` check on the result keeps working today and becomes
875
+ > unreachable in v6.0.0.
876
+ >
866
877
  > **Deleting through `tag_add`:** `g.tag_add(name, d: true)`, which was already
867
878
  > deprecated, deletes the tag and emits a second warning pointing at
868
879
  > `g.tag_delete`. `g.tag_create` rejects `:d` and `:delete` with `ArgumentError`.
@@ -1009,7 +1020,7 @@ and are removed in v6.0.0. Read worktree data through
1009
1020
  object per worktree, and call the repository-level operations (`worktree_add`,
1010
1021
  `worktree_remove`, `worktree_move`, `worktree_lock`, `worktree_unlock`,
1011
1022
  `worktree_repair`, and `worktree_prune`) with the worktree path or its
1012
- `Git::WorktreeInfo`. Return values are unchanged. Calling `g.worktree`,
1023
+ `Git::WorktreeInfo`. Return values are unchanged on v5.x. Calling `g.worktree`,
1013
1024
  `g.worktrees`, or `g.worktrees_all`, constructing a `Git::Worktrees`, and calling
1014
1025
  `gcommit`, `add`, or `remove` on a `Git::Worktree` each emit a deprecation
1015
1026
  warning; the `dir`, `full`, `to_s`, and `to_a` readers on `Git::Worktree` do not.
@@ -1035,6 +1046,14 @@ it constructs, and `g.worktree(dir).add` emits one for `g.worktree` and one for
1035
1046
  > **`full` and `to_s`:** `Git::Worktree#full` and `#to_s` append the commitish
1036
1047
  > given at construction to the path, so entries from `g.worktrees` read
1037
1048
  > `"/path/to/wt <sha>"`. `Git::WorktreeInfo#to_s` is the path alone.
1049
+ >
1050
+ > **`worktree_add` return type in v6.0.0:** on v5.x, `worktree_add` returns the
1051
+ > `git worktree add` output (`"HEAD is now at …"`). In v6.0.0 it returns the new
1052
+ > `Git::WorktreeInfo` instead. To get the entry today, look it up after the add:
1053
+ > `g.worktree_list.find { |w| File.identical?(w.path, dir) }`. Compare with
1054
+ > `File.identical?`, not string equality: git stores worktree paths with
1055
+ > symlinks resolved, so `/tmp/...` on macOS is listed as `/private/tmp/...`,
1056
+ > and on case-insensitive filesystems the listed casing may differ from `dir`.
1038
1057
 
1039
1058
  In the table, `dir` is the worktree path, `wt` is a `Git::Worktree`, and `info`
1040
1059
  is the `Git::WorktreeInfo` that replaces it.
data/lib/git/errors.rb CHANGED
@@ -5,8 +5,20 @@ module Git
5
5
 
6
6
  # Base class for all custom git module errors
7
7
  #
8
- # The git gem will only raise an `ArgumentError` or an error that is a subclass of
9
- # `Git::Error`. It does not explicitly raise any other types of errors.
8
+ # Errors the git gem raises deliberately are either `ArgumentError` or a subclass
9
+ # of `Git::Error`. The exceptions described below come from Ruby's standard
10
+ # library and are not converted.
11
+ #
12
+ # The gem's own filesystem operations, such as reading a `.git` pointer file,
13
+ # creating a temporary file, or changing directory, do not convert operating
14
+ # system errors. These can be raised as a bare `SystemCallError` (for example
15
+ # `Errno::ENOENT` or `Errno::EACCES`) rather than `Git::Error`. Gzip compression
16
+ # in `archive` can likewise raise a `Zlib::Error`. Rescue `SystemCallError` and
17
+ # `Zlib::Error` alongside `Git::Error` if your code needs to handle them. Any
18
+ # method that captures git output can also raise
19
+ # `Encoding::ConverterNotFoundError` when a line's detected encoding has no Ruby
20
+ # converter. See the "Errors raised by this gem" section of the README for the
21
+ # affected methods.
10
22
  #
11
23
  # It is recommended to rescue `Git::Error` to catch any runtime error raised by
12
24
  # this gem unless you need more specific error handling.
@@ -928,7 +928,9 @@ module Git
928
928
  # @option options [Boolean, nil] :create_reflog (nil) create a reflog for
929
929
  # the tag
930
930
  #
931
- # @return [Git::TagInfo] the newly created tag
931
+ # @return [Git::TagInfo, nil] the newly created tag, or `nil` when the tag
932
+ # is missing from the tag list after the create (for example, another
933
+ # process deleted it before the lookup)
932
934
  #
933
935
  # @overload tag_create(name, target, options = {})
934
936
  #
@@ -945,7 +947,9 @@ module Git
945
947
  # @param options [Hash] options for creating the tag (same keys as the
946
948
  # first overload)
947
949
  #
948
- # @return [Git::TagInfo] the newly created tag
950
+ # @return [Git::TagInfo, nil] the newly created tag, or `nil` when the tag
951
+ # is missing from the tag list after the create (for example, another
952
+ # process deleted it before the lookup)
949
953
  #
950
954
  # @raise [ArgumentError] if unsupported options are provided, including the
951
955
  # `:d` and `:delete` keys that {#tag_add} accepts; use {#tag_delete} to
@@ -960,6 +964,12 @@ module Git
960
964
  #
961
965
  # @raise [Git::FailedError] if git exits with a non-zero exit status
962
966
  #
967
+ # @note In v6.0.0 this method raises {Git::UnexpectedResultError} instead of
968
+ # returning `nil` when the tag it has just created is missing from the tag
969
+ # list, so its return value is always a {Git::TagInfo}. Code that checks
970
+ # the result for `nil` today can be left as is; the check becomes
971
+ # unreachable in v6.0.0.
972
+ #
963
973
  # @see https://git-scm.com/docs/git-tag git-tag
964
974
  #
965
975
  def tag_create(name, *args)
@@ -99,6 +99,14 @@ module Git
99
99
  #
100
100
  # @raise [Git::FailedError] if git exits with a non-zero exit status
101
101
  #
102
+ # @note In v6.0.0 this method returns the new {Git::WorktreeInfo} instead of
103
+ # the command output. To get the entry today, look it up after the add:
104
+ # `worktree_list.find { |w| File.identical?(w.path, dir) }`.
105
+ # Compare with `File.identical?`, not string equality: git stores
106
+ # worktree paths with symlinks resolved, so `/tmp/...` on macOS is
107
+ # listed as `/private/tmp/...`, and on case-insensitive filesystems the
108
+ # listed casing may differ from `dir`.
109
+ #
102
110
  # @see https://git-scm.com/docs/git-worktree git-worktree documentation
103
111
  #
104
112
  def worktree_add(dir, commitish = nil)
data/lib/git/version.rb CHANGED
@@ -4,7 +4,7 @@ module Git
4
4
  # The current gem version
5
5
  #
6
6
  # @return [String] the current gem version
7
- VERSION = '5.6.0'
7
+ VERSION = '5.6.1'
8
8
 
9
9
  # Represents a git version with major, minor, and patch components
10
10
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.0
4
+ version: 5.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon and others
@@ -548,8 +548,8 @@ licenses:
548
548
  metadata:
549
549
  homepage_uri: http://github.com/ruby-git/ruby-git
550
550
  source_code_uri: http://github.com/ruby-git/ruby-git
551
- changelog_uri: https://rubydoc.info/gems/git/5.6.0/file/CHANGELOG.md
552
- documentation_uri: https://rubydoc.info/gems/git/5.6.0
551
+ changelog_uri: https://rubydoc.info/gems/git/5.6.1/file/CHANGELOG.md
552
+ documentation_uri: https://rubydoc.info/gems/git/5.6.1
553
553
  rubygems_mfa_required: 'true'
554
554
  rdoc_options: []
555
555
  require_paths:
@@ -566,7 +566,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
566
566
  version: '0'
567
567
  requirements:
568
568
  - git 2.28.0 or greater
569
- rubygems_version: 4.0.16
569
+ rubygems_version: 4.0.20
570
570
  specification_version: 4
571
571
  summary: An API to create, read, and manipulate Git repositories
572
572
  test_files: []