1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
|
# File 'lib/git/lib.rb', line 1303
def tag(name, *opts)
target = opts[0].instance_of?(String) ? opts[0] : nil
opts = opts.last.instance_of?(Hash) ? opts.last : {}
if (opts[:a] || opts[:annotate]) && !(opts[:m] || opts[:message])
raise ArgumentError, 'Cannot create an annotated tag without a message.'
end
arr_opts = []
arr_opts << '-f' if opts[:force] || opts[:f]
arr_opts << '-a' if opts[:a] || opts[:annotate]
arr_opts << '-s' if opts[:s] || opts[:sign]
arr_opts << '-d' if opts[:d] || opts[:delete]
arr_opts << name
arr_opts << target if target
if opts[:m] || opts[:message]
arr_opts << '-m' << (opts[:m] || opts[:message])
end
command('tag', *arr_opts)
end
|