aboutsummaryrefslogtreecommitdiffstats
path: root/builtin
diff options
context:
space:
mode:
authorThalia Archibald <thalia@archibald.dev>2024-04-14 01:11:52 +0000
committerJunio C Hamano <gitster@pobox.com>2024-04-15 10:06:17 -0700
commitb5062f752ef039b6fa8b3a7491072c2f1dfe3cf2 (patch)
tree6a68dae1bf1abe1d2949fe9d76c6eea309cbdc2a /builtin
parent5733f894d7e66d0f0fbd29675d8420825ce0c29f (diff)
downloadgit-b5062f752ef039b6fa8b3a7491072c2f1dfe3cf2.tar.gz
fast-import: allow unquoted empty path for root
Ever since filerename was added in f39a946a1f (Support wholesale directory renames in fast-import, 2007-07-09) and filecopy in b6f3481bb4 (Teach fast-import to recursively copy files/directories, 2007-07-15), both have produced an error when the destination path is empty. Later, when support for targeting the root directory with an empty string was added in 2794ad5244 (fast-import: Allow filemodify to set the root, 2010-10-10), this had the effect of allowing the quoted empty string (`""`), but forbidding its unquoted variant (``). This seems to have been intended as simple data validation for parsing two paths, rather than a syntax restriction, because it was not extended to the other operations. All other occurrences of paths (in filemodify, filedelete, the source of filecopy and filerename, and ls) allow both. For most of this feature's lifetime, the documentation has not prescribed the use of quoted empty strings. In e5959106d6 (Documentation/fast-import: put explanation of M 040000 <dataref> "" in context, 2011-01-15), its documentation was changed from “`<path>` may also be an empty string (`""`) to specify the root of the tree” to “The root of the tree can be represented by an empty string as `<path>`”. Thus, we should assume that some front-ends have depended on this behavior. Remove this restriction for the destination paths of filecopy and filerename and change tests targeting the root to test `""` and ``. Signed-off-by: Thalia Archibald <thalia@archibald.dev> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fast-import.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index 765429a66c..c8a1e3ef3d 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -2423,9 +2423,6 @@ static void file_change_cr(const char *p, struct branch *b, int rename)
strbuf_reset(&source);
parse_path_space(&source, p, &p, "source");
-
- if (!*p)
- die("Missing dest: %s", command_buf.buf);
strbuf_reset(&dest);
parse_path_eol(&dest, p, "dest");