mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-11-04 23:34:39 +00:00
Check renamed branch prefix does not match with existing branches
This commit is contained in:
parent
6f59ee96b9
commit
fb8797955a
1 changed files with 16 additions and 0 deletions
|
@ -95,6 +95,22 @@ class RefActionRename : GitgExt.UIElement, GitgExt.Action, GitgExt.RefAction, Ob
|
|||
return;
|
||||
}
|
||||
|
||||
var split = new_text.split("/");
|
||||
var branchname = "";
|
||||
foreach (unowned string str in split) {
|
||||
branchname += str;
|
||||
try {
|
||||
application.repository.lookup_reference(@"$prefix$branchname");
|
||||
var msg = _("The specified name “%s” match with existing branch “%s”").printf(new_text, branchname);
|
||||
|
||||
action_interface.application.show_infobar(_("Invalid name"),
|
||||
msg,
|
||||
Gtk.MessageType.ERROR);
|
||||
return;
|
||||
} catch {
|
||||
}
|
||||
branchname += "/";
|
||||
}
|
||||
if (!Ggit.Ref.is_valid_name(@"$prefix$new_text"))
|
||||
{
|
||||
var msg = _("The specified name “%s” contains invalid characters").printf(new_text);
|
||||
|
|
Loading…
Reference in a new issue