зеркало из https://github.com/microsoft/git.git
Merge branch 'bw/commit-partial-from-subdirectory-fix'
"cd sub/dir && git commit ../path" ought to record the changes to the file "sub/path", but this regressed long time ago. * bw/commit-partial-from-subdirectory-fix: commit: allow partial commits with relative paths
This commit is contained in:
Коммит
8295f2028f
|
@ -218,8 +218,7 @@ static int list_paths(struct string_list *list, const char *with_tree,
|
|||
|
||||
if (with_tree) {
|
||||
char *max_prefix = common_prefix(pattern);
|
||||
overlay_tree_on_index(&the_index, with_tree,
|
||||
max_prefix ? max_prefix : prefix);
|
||||
overlay_tree_on_index(&the_index, with_tree, max_prefix);
|
||||
free(max_prefix);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,18 @@ test_expect_success PERL 'can use paths with --interactive' '
|
|||
git reset --hard HEAD^
|
||||
'
|
||||
|
||||
test_expect_success 'removed files and relative paths' '
|
||||
test_when_finished "rm -rf foo" &&
|
||||
git init foo &&
|
||||
>foo/foo.txt &&
|
||||
git -C foo add foo.txt &&
|
||||
git -C foo commit -m first &&
|
||||
git -C foo rm foo.txt &&
|
||||
|
||||
mkdir -p foo/bar &&
|
||||
git -C foo/bar commit -m second ../foo.txt
|
||||
'
|
||||
|
||||
test_expect_success 'using invalid commit with -C' '
|
||||
test_must_fail git commit --allow-empty -C bogus
|
||||
'
|
||||
|
|
Загрузка…
Ссылка в новой задаче