Get package name from the Git address self

Return null on failure.

assert "https://github.com/nitlang/nit.git".git_name == "nit"
assert "git://github.com/nitlang/nit".git_name == "nit"
assert "gamnit".git_name == "gamnit"
assert "///".git_name == null
assert "file:///".git_name == "file:"

Property definitions

nitc :: nitpm_shared $ Text :: git_name
	# Get package name from the Git address `self`
	#
	# Return `null` on failure.
	#
	# ~~~
	# assert "https://github.com/nitlang/nit.git".git_name == "nit"
	# assert "git://github.com/nitlang/nit".git_name == "nit"
	# assert "gamnit".git_name == "gamnit"
	# assert "///".git_name == null
	# assert "file:///".git_name == "file:"
	# ~~~
	fun git_name: nullable String
	do
		var parts = split("/")
		for part in parts.reverse_iterator do
			if not part.is_empty then
				return part.strip_extension(".git")
			end
		end

		return null
	end
src/nitpm_shared.nit:53,2--74,4