@@ -96,6 +96,7 @@ def init(opts = {})
96
96
# Clones a repository into a newly created directory
97
97
#
98
98
# @param [String] repository_url the URL of the repository to clone
99
+ #
99
100
# @param [String, nil] directory the directory to clone into
100
101
#
101
102
# If nil, the repository is cloned into a directory with the same name as
@@ -104,16 +105,28 @@ def init(opts = {})
104
105
# @param [Hash] opts the options for this command
105
106
#
106
107
# @option opts [Boolean] :bare (false) if true, clone as a bare repository
108
+ #
107
109
# @option opts [String] :branch the branch to checkout
110
+ #
108
111
# @option opts [String, Array] :config one or more configuration options to set
112
+ #
109
113
# @option opts [Integer] :depth the number of commits back to pull
114
+ #
110
115
# @option opts [String] :filter specify partial clone
116
+ #
111
117
# @option opts [String] :mirror set up a mirror of the source repository
118
+ #
112
119
# @option opts [String] :origin the name of the remote
120
+ #
113
121
# @option opts [String] :path an optional prefix for the directory parameter
122
+ #
114
123
# @option opts [String] :remote the name of the remote
115
- # @option opts [Boolean] :recursive after the clone is created, initialize all submodules within, using their default settings
116
- # @option opts [Numeric, nil] :timeout the number of seconds to wait for the command to complete
124
+ #
125
+ # @option opts [Boolean] :recursive after the clone is created, initialize all
126
+ # within, using their default settings
127
+ #
128
+ # @option opts [Numeric, nil] :timeout the number of seconds to wait for the
129
+ # command to complete
117
130
#
118
131
# See {Git::Lib#command} for more information about :timeout
119
132
#
@@ -268,37 +281,53 @@ def log_commits(opts = {})
268
281
#
269
282
# @param opts [Hash] the given options
270
283
#
271
- # @option opts :count [Integer] the maximum number of commits to return (maps to max-count)
284
+ # @option opts :count [Integer] the maximum number of commits to return (maps to
285
+ # max-count)
286
+ #
272
287
# @option opts :all [Boolean]
288
+ #
273
289
# @option opts :cherry [Boolean]
290
+ #
274
291
# @option opts :since [String]
292
+ #
275
293
# @option opts :until [String]
294
+ #
276
295
# @option opts :grep [String]
296
+ #
277
297
# @option opts :author [String]
278
- # @option opts :between [Array<String>] an array of two commit-ish strings to specify a revision range
298
+ #
299
+ # @option opts :between [Array<String>] an array of two commit-ish strings to
300
+ # specify a revision range
279
301
#
280
302
# Only :between or :object options can be used, not both.
281
303
#
282
304
# @option opts :object [String] the revision range for the git log command
283
305
#
284
306
# Only :between or :object options can be used, not both.
285
307
#
286
- # @option opts :path_limiter [Array<String>, String] only include commits that impact files from the specified paths
308
+ # @option opts :path_limiter [Array<String>, String] only include commits that
309
+ # impact files from the specified paths
310
+ #
287
311
# @option opts :skip [Integer]
288
312
#
289
313
# @return [Array<Hash>] the log output parsed into an array of hashs for each commit
290
314
#
291
315
# Each hash contains the following keys:
316
+ #
292
317
# * 'sha' [String] the commit sha
293
318
# * 'author' [String] the author of the commit
294
319
# * 'message' [String] the commit message
295
320
# * 'parent' [Array<String>] the commit shas of the parent commits
296
321
# * 'tree' [String] the tree sha
297
- # * 'author' [String] the author of the commit and timestamp of when the changes were created
298
- # * 'committer' [String] the committer of the commit and timestamp of when the commit was applied
299
- # * 'merges' [Boolean] if truthy, only include merge commits (aka commits with 2 or more parents)
322
+ # * 'author' [String] the author of the commit and timestamp of when the
323
+ # changes were created
324
+ # * 'committer' [String] the committer of the commit and timestamp of when the
325
+ # commit was applied
326
+ # * 'merges' [Boolean] if truthy, only include merge commits (aka commits with
327
+ # 2 or more parents)
300
328
#
301
- # @raise [ArgumentError] if the revision range (specified with :between or :object) is a string starting with a hyphen
329
+ # @raise [ArgumentError] if the revision range (specified with :between or
330
+ # :object) is a string starting with a hyphen
302
331
#
303
332
def full_log_commits ( opts = { } )
304
333
assert_args_are_not_options ( 'between' , opts [ :between ] &.first )
@@ -321,7 +350,8 @@ def full_log_commits(opts = {})
321
350
#
322
351
# @see https://git-scm.com/docs/git-rev-parse git-rev-parse
323
352
# @see https://git-scm.com/docs/git-rev-parse#_specifying_revisions Valid ways to specify revisions
324
- # @see https://git-scm.com/docs/git-rev-parse#Documentation/git-rev-parse.txt-emltrefnamegtemegemmasterememheadsmasterememrefsheadsmasterem Ref disambiguation rules
353
+ # @see https://git-scm.com/docs/git-rev-parse#Documentation/git-rev-parse.txt-emltrefnamegtemegemmasterememheadsmasterememrefsheadsmasterem
354
+ # Ref disambiguation rules
325
355
#
326
356
# @example
327
357
# lib.rev_parse('HEAD') # => '9b9b31e704c0b85ffdd8d2af2ded85170a5af87d'
@@ -492,10 +522,12 @@ def each_cat_file_header(data)
492
522
493
523
# Return a hash of annotated tag data
494
524
#
495
- # Does not work with lightweight tags. List all annotated tags in your repository with the following command:
525
+ # Does not work with lightweight tags. List all annotated tags in your repository
526
+ # with the following command:
496
527
#
497
528
# ```sh
498
- # git for-each-ref --format='%(refname:strip=2)' refs/tags | while read tag; do git cat-file tag $tag >/dev/null 2>&1 && echo $tag; done
529
+ # git for-each-ref --format='%(refname:strip=2)' refs/tags | \
530
+ # while read tag; do git cat-file tag $tag >/dev/null 2>&1 && echo $tag; done
499
531
# ```
500
532
#
501
533
# @see https://git-scm.com/docs/git-cat-file git-cat-file
@@ -520,7 +552,8 @@ def each_cat_file_header(data)
520
552
# * object [String] the sha of the tag object
521
553
# * type [String]
522
554
# * tag [String] tag name
523
- # * tagger [String] the name and email of the user who created the tag and the timestamp of when the tag was created
555
+ # * tagger [String] the name and email of the user who created the tag
556
+ # and the timestamp of when the tag was created
524
557
# * message [String] the tag message
525
558
#
526
559
# @raise [ArgumentError] if object is a string starting with a hyphen
@@ -1300,7 +1333,10 @@ def tag(name, *opts)
1300
1333
1301
1334
opts = opts . last . instance_of? ( Hash ) ? opts . last : { }
1302
1335
1303
- raise ArgumentError , 'Cannot create an annotated tag without a message.' if ( opts [ :a ] || opts [ :annotate ] ) && !( opts [ :m ] || opts [ :message ] )
1336
+ if ( opts [ :a ] || opts [ :annotate ] ) && !( opts [ :m ] || opts [ :message ] )
1337
+ raise ArgumentError ,
1338
+ 'Cannot create an annotated tag without a message.'
1339
+ end
1304
1340
1305
1341
arr_opts = [ ]
1306
1342
@@ -1518,7 +1554,10 @@ def self.warn_if_old_command(lib) # rubocop:disable Naming/PredicateMethod
1518
1554
return true if @version_checked
1519
1555
1520
1556
@version_checked = true
1521
- warn "[WARNING] The git gem requires git #{ lib . required_command_version . join ( '.' ) } or later, but only found #{ lib . current_command_version . join ( '.' ) } . You should probably upgrade." unless lib . meets_required_version?
1557
+ unless lib . meets_required_version?
1558
+ warn "[WARNING] The git gem requires git #{ lib . required_command_version . join ( '.' ) } or later, " \
1559
+ "but only found #{ lib . current_command_version . join ( '.' ) } . You should probably upgrade."
1560
+ end
1522
1561
true
1523
1562
end
1524
1563
@@ -1664,7 +1703,10 @@ def diff_as_hash(diff_command, opts = [])
1664
1703
def log_common_options ( opts )
1665
1704
arr_opts = [ ]
1666
1705
1667
- raise ArgumentError , "The log count option must be an Integer but was #{ opts [ :count ] . inspect } " if opts [ :count ] && !opts [ :count ] . is_a? ( Integer )
1706
+ if opts [ :count ] && !opts [ :count ] . is_a? ( Integer )
1707
+ raise ArgumentError ,
1708
+ "The log count option must be an Integer but was #{ opts [ :count ] . inspect } "
1709
+ end
1668
1710
1669
1711
arr_opts << "--max-count=#{ opts [ :count ] } " if opts [ :count ]
1670
1712
arr_opts << '--all' if opts [ :all ]
0 commit comments