Merge branch 'en/fast-import-verify-path'
"git fast-import" learned to reject paths with ".." and "." as their components to avoid creating invalid tree objects. * en/fast-import-verify-path: t9300: test verification of renamed paths fast-import: disallow more path components fast-import: disallow "." and ".." path components
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
#include "delta.h"
|
||||
#include "pack.h"
|
||||
#include "path.h"
|
||||
#include "read-cache-ll.h"
|
||||
#include "refs.h"
|
||||
#include "csum-file.h"
|
||||
#include "quote.h"
|
||||
@ -2425,6 +2426,9 @@ static void file_change_m(const char *p, struct branch *b)
|
||||
tree_content_replace(&b->branch_tree, &oid, mode, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!verify_path(path.buf, mode))
|
||||
die("invalid path '%s'", path.buf);
|
||||
tree_content_set(&b->branch_tree, path.buf, &oid, mode, NULL);
|
||||
}
|
||||
|
||||
@ -2462,6 +2466,8 @@ static void file_change_cr(const char *p, struct branch *b, int rename)
|
||||
leaf.tree);
|
||||
return;
|
||||
}
|
||||
if (!verify_path(dest.buf, leaf.versions[1].mode))
|
||||
die("invalid path '%s'", dest.buf);
|
||||
tree_content_set(&b->branch_tree, dest.buf,
|
||||
&leaf.versions[1].oid,
|
||||
leaf.versions[1].mode,
|
||||
|
Reference in New Issue
Block a user