From f63701ed098414a61bf4d78d443194f94092b5ff Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 15 Feb 2016 08:34:03 +0100 Subject: [PATCH] Allow workspace renames which change case fixes #2211 --- src/commands.c | 4 +++- testcases/t/117-workspace.t | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/commands.c b/src/commands.c index af72f5bb..0faf2775 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1909,7 +1909,9 @@ void cmd_rename_workspace(I3_CMD, const char *old_name, const char *new_name) { GREP_FIRST(check_dest, output_get_content(output), !strcasecmp(child->name, new_name)); - if (check_dest != NULL) { + /* If check_dest == workspace, the user might be changing the case of the + * workspace, or it might just be a no-op. */ + if (check_dest != NULL && check_dest != workspace) { yerror("New workspace \"%s\" already exists", new_name); return; } diff --git a/testcases/t/117-workspace.t b/testcases/t/117-workspace.t index 04d9b9dd..01d51cc0 100644 --- a/testcases/t/117-workspace.t +++ b/testcases/t/117-workspace.t @@ -288,5 +288,10 @@ ok(!$result->[0]->{success}, 'renaming workspace to an already existing one fail $result = cmd 'rename workspace notexistant to bleh'; ok(!$result->[0]->{success}, 'renaming workspace which does not exist failed'); +# 8: change case +ok(!workspace_exists('11: BAR'), 'workspace 11: BAR does not exist yet'); +$result = cmd 'rename workspace "11: bar" to "11: BAR"'; +ok($result->[0]->{success}, 'renaming workspace from 11: bar to 11: BAR worked'); +ok(workspace_exists('11: BAR'), 'workspace 11: BAR now exists'); done_testing;