Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew DeVore <matvore@google.com>2018-10-06 00:31:24 +0300
committerJunio C Hamano <gitster@pobox.com>2018-10-07 02:55:00 +0300
commit99c9aa9579ae970c0d273ced8fb8efe9eed70a75 (patch)
treefc260385a350e48790bd19a575075244b7795c4d /t/t6112-rev-list-filters-objects.sh
parent7c0fe330d5f3d2fc7aac57a19c7580ea2543c799 (diff)
revision: mark non-user-given objects instead
Currently, list-objects.c incorrectly treats all root trees of commits as USER_GIVEN. Also, it would be easier to mark objects that are non-user-given instead of user-given, since the places in the code where we access an object through a reference are more obvious than the places where we access an object that was given by the user. Resolve these two problems by introducing a flag NOT_USER_GIVEN that marks blobs and trees that are non-user-given, replacing USER_GIVEN. (Only blobs and trees are marked because this mark is only used when filtering objects, and filtering of other types of objects is not supported yet.) This fixes a bug in that git rev-list behaved differently from git pack-objects. pack-objects would *not* filter objects given explicitly on the command line and rev-list would filter. This was because the two commands used a different function to add objects to the rev_info struct. This seems to have been an oversight, and pack-objects has the correct behavior, so I added a test to make sure that rev-list now behaves properly. Signed-off-by: Matthew DeVore <matvore@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6112-rev-list-filters-objects.sh')
-rwxr-xr-xt/t6112-rev-list-filters-objects.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t6112-rev-list-filters-objects.sh b/t/t6112-rev-list-filters-objects.sh
index 6d69e6a0aa..0d4d43894b 100755
--- a/t/t6112-rev-list-filters-objects.sh
+++ b/t/t6112-rev-list-filters-objects.sh
@@ -30,6 +30,18 @@ test_expect_success 'verify blob:none omits all 5 blobs' '
test_cmp observed expected
'
+test_expect_success 'specify blob explicitly prevents filtering' '
+ file_3=$(git -C r1 ls-files -s file.3 |
+ awk -f print_2.awk) &&
+
+ file_4=$(git -C r1 ls-files -s file.4 |
+ awk -f print_2.awk) &&
+
+ git -C r1 rev-list --objects --filter=blob:none HEAD $file_3 >observed &&
+ grep -q "$file_3" observed &&
+ test_must_fail grep -q "$file_4" observed
+'
+
test_expect_success 'verify emitted+omitted == all' '
git -C r1 rev-list HEAD --objects \
| awk -f print_1.awk \