@@ -96,6 +96,7 @@ def init(opts = {})
9696 # Clones a repository into a newly created directory
9797 #
9898 # @param [String] repository_url the URL of the repository to clone
99+ #
99100 # @param [String, nil] directory the directory to clone into
100101 #
101102 # If nil, the repository is cloned into a directory with the same name as
@@ -104,16 +105,28 @@ def init(opts = {})
104105 # @param [Hash] opts the options for this command
105106 #
106107 # @option opts [Boolean] :bare (false) if true, clone as a bare repository
108+ #
107109 # @option opts [String] :branch the branch to checkout
110+ #
108111 # @option opts [String, Array] :config one or more configuration options to set
112+ #
109113 # @option opts [Integer] :depth the number of commits back to pull
114+ #
110115 # @option opts [String] :filter specify partial clone
116+ #
111117 # @option opts [String] :mirror set up a mirror of the source repository
118+ #
112119 # @option opts [String] :origin the name of the remote
120+ #
113121 # @option opts [String] :path an optional prefix for the directory parameter
122+ #
114123 # @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
117130 #
118131 # See {Git::Lib#command} for more information about :timeout
119132 #
@@ -268,37 +281,53 @@ def log_commits(opts = {})
268281 #
269282 # @param opts [Hash] the given options
270283 #
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+ #
272287 # @option opts :all [Boolean]
288+ #
273289 # @option opts :cherry [Boolean]
290+ #
274291 # @option opts :since [String]
292+ #
275293 # @option opts :until [String]
294+ #
276295 # @option opts :grep [String]
296+ #
277297 # @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
279301 #
280302 # Only :between or :object options can be used, not both.
281303 #
282304 # @option opts :object [String] the revision range for the git log command
283305 #
284306 # Only :between or :object options can be used, not both.
285307 #
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+ #
287311 # @option opts :skip [Integer]
288312 #
289313 # @return [Array<Hash>] the log output parsed into an array of hashs for each commit
290314 #
291315 # Each hash contains the following keys:
316+ #
292317 # * 'sha' [String] the commit sha
293318 # * 'author' [String] the author of the commit
294319 # * 'message' [String] the commit message
295320 # * 'parent' [Array<String>] the commit shas of the parent commits
296321 # * '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)
300328 #
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
302331 #
303332 def full_log_commits ( opts = { } )
304333 assert_args_are_not_options ( 'between' , opts [ :between ] &.first )
@@ -321,7 +350,8 @@ def full_log_commits(opts = {})
321350 #
322351 # @see https://git-scm.com/docs/git-rev-parse git-rev-parse
323352 # @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
325355 #
326356 # @example
327357 # lib.rev_parse('HEAD') # => '9b9b31e704c0b85ffdd8d2af2ded85170a5af87d'
@@ -492,10 +522,12 @@ def each_cat_file_header(data)
492522
493523 # Return a hash of annotated tag data
494524 #
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:
496527 #
497528 # ```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
499531 # ```
500532 #
501533 # @see https://git-scm.com/docs/git-cat-file git-cat-file
@@ -520,7 +552,8 @@ def each_cat_file_header(data)
520552 # * object [String] the sha of the tag object
521553 # * type [String]
522554 # * 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
524557 # * message [String] the tag message
525558 #
526559 # @raise [ArgumentError] if object is a string starting with a hyphen
@@ -1300,7 +1333,10 @@ def tag(name, *opts)
13001333
13011334 opts = opts . last . instance_of? ( Hash ) ? opts . last : { }
13021335
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
13041340
13051341 arr_opts = [ ]
13061342
@@ -1518,7 +1554,10 @@ def self.warn_if_old_command(lib) # rubocop:disable Naming/PredicateMethod
15181554 return true if @version_checked
15191555
15201556 @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
15221561 true
15231562 end
15241563
@@ -1664,7 +1703,10 @@ def diff_as_hash(diff_command, opts = [])
16641703 def log_common_options ( opts )
16651704 arr_opts = [ ]
16661705
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
16681710
16691711 arr_opts << "--max-count=#{ opts [ :count ] } " if opts [ :count ]
16701712 arr_opts << '--all' if opts [ :all ]
0 commit comments