summaryrefslogtreecommitdiff
path: root/revision.h
diff options
context:
space:
mode:
authorMatthew DeVore <matvore@google.com>2018-10-05 21:31:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-10-06 23:55:00 (GMT)
commit99c9aa9579ae970c0d273ced8fb8efe9eed70a75 (patch)
treefc260385a350e48790bd19a575075244b7795c4d /revision.h
parent7c0fe330d5f3d2fc7aac57a19c7580ea2543c799 (diff)
downloadgit-99c9aa9579ae970c0d273ced8fb8efe9eed70a75.zip
git-99c9aa9579ae970c0d273ced8fb8efe9eed70a75.tar.gz
git-99c9aa9579ae970c0d273ced8fb8efe9eed70a75.tar.bz2
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 'revision.h')
-rw-r--r--revision.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/revision.h b/revision.h
index 5118aaa..4dc45bb 100644
--- a/revision.h
+++ b/revision.h
@@ -20,9 +20,16 @@
#define SYMMETRIC_LEFT (1u<<8)
#define PATCHSAME (1u<<9)
#define BOTTOM (1u<<10)
-#define USER_GIVEN (1u<<25) /* given directly by the user */
+/*
+ * Indicates object was reached by traversal. i.e. not given by user on
+ * command-line or stdin.
+ * NEEDSWORK: NOT_USER_GIVEN doesn't apply to commits because we only support
+ * filtering trees and blobs, but it may be useful to support filtering commits
+ * in the future.
+ */
+#define NOT_USER_GIVEN (1u<<25)
#define TRACK_LINEAR (1u<<26)
-#define ALL_REV_FLAGS (((1u<<11)-1) | USER_GIVEN | TRACK_LINEAR)
+#define ALL_REV_FLAGS (((1u<<11)-1) | NOT_USER_GIVEN | TRACK_LINEAR)
#define DECORATE_SHORT_REFS 1
#define DECORATE_FULL_REFS 2