@@ -729,12 +729,16 @@ static void limit_to_ancestry(struct commit_list *bottom, struct commit_list *li
729
729
* to filter the result of "A..B" further to the ones that can actually
730
730
* reach A.
731
731
*/
732
- static struct commit_list * collect_bottom_commits (struct commit_list * list )
732
+ static struct commit_list * collect_bottom_commits (struct rev_info * revs )
733
733
{
734
- struct commit_list * elem , * bottom = NULL ;
735
- for (elem = list ; elem ; elem = elem -> next )
736
- if (elem -> item -> object .flags & UNINTERESTING )
737
- commit_list_insert (elem -> item , & bottom );
734
+ struct commit_list * bottom = NULL ;
735
+ int i ;
736
+ for (i = 0 ; i < revs -> cmdline .nr ; i ++ ) {
737
+ struct rev_cmdline_entry * elem = & revs -> cmdline .rev [i ];
738
+ if ((elem -> flags & UNINTERESTING ) &&
739
+ elem -> item -> type == OBJ_COMMIT )
740
+ commit_list_insert ((struct commit * )elem -> item , & bottom );
741
+ }
738
742
return bottom ;
739
743
}
740
744
@@ -765,7 +769,7 @@ static int limit_list(struct rev_info *revs)
765
769
struct commit_list * bottom = NULL ;
766
770
767
771
if (revs -> ancestry_path ) {
768
- bottom = collect_bottom_commits (list );
772
+ bottom = collect_bottom_commits (revs );
769
773
if (!bottom )
770
774
die ("--ancestry-path given but there are no bottom commits" );
771
775
}
@@ -822,6 +826,23 @@ static int limit_list(struct rev_info *revs)
822
826
return 0 ;
823
827
}
824
828
829
+ static void add_rev_cmdline (struct rev_info * revs ,
830
+ struct object * item ,
831
+ const char * name ,
832
+ int whence ,
833
+ unsigned flags )
834
+ {
835
+ struct rev_cmdline_info * info = & revs -> cmdline ;
836
+ int nr = info -> nr ;
837
+
838
+ ALLOC_GROW (info -> rev , nr + 1 , info -> alloc );
839
+ info -> rev [nr ].item = item ;
840
+ info -> rev [nr ].name = name ;
841
+ info -> rev [nr ].whence = whence ;
842
+ info -> rev [nr ].flags = flags ;
843
+ info -> nr ++ ;
844
+ }
845
+
825
846
struct all_refs_cb {
826
847
int all_flags ;
827
848
int warned_bad_reflog ;
@@ -834,6 +855,7 @@ static int handle_one_ref(const char *path, const unsigned char *sha1, int flag,
834
855
struct all_refs_cb * cb = cb_data ;
835
856
struct object * object = get_reference (cb -> all_revs , path , sha1 ,
836
857
cb -> all_flags );
858
+ add_rev_cmdline (cb -> all_revs , object , path , REV_CMD_REF , cb -> all_flags );
837
859
add_pending_object (cb -> all_revs , object , path );
838
860
return 0 ;
839
861
}
@@ -860,6 +882,7 @@ static void handle_one_reflog_commit(unsigned char *sha1, void *cb_data)
860
882
struct object * o = parse_object (sha1 );
861
883
if (o ) {
862
884
o -> flags |= cb -> all_flags ;
885
+ /* ??? CMDLINEFLAGS ??? */
863
886
add_pending_object (cb -> all_revs , o , "" );
864
887
}
865
888
else if (!cb -> warned_bad_reflog ) {
@@ -896,12 +919,13 @@ static void handle_reflog(struct rev_info *revs, unsigned flags)
896
919
for_each_reflog (handle_one_reflog , & cb );
897
920
}
898
921
899
- static int add_parents_only (struct rev_info * revs , const char * arg , int flags )
922
+ static int add_parents_only (struct rev_info * revs , const char * arg_ , int flags )
900
923
{
901
924
unsigned char sha1 [20 ];
902
925
struct object * it ;
903
926
struct commit * commit ;
904
927
struct commit_list * parents ;
928
+ const char * arg = arg_ ;
905
929
906
930
if (* arg == '^' ) {
907
931
flags ^= UNINTERESTING ;
@@ -925,6 +949,7 @@ static int add_parents_only(struct rev_info *revs, const char *arg, int flags)
925
949
for (parents = commit -> parents ; parents ; parents = parents -> next ) {
926
950
it = & parents -> item -> object ;
927
951
it -> flags |= flags ;
952
+ add_rev_cmdline (revs , it , arg_ , REV_CMD_PARENTS_ONLY , flags );
928
953
add_pending_object (revs , it , arg );
929
954
}
930
955
return 1 ;
@@ -1018,7 +1043,7 @@ static void prepare_show_merge(struct rev_info *revs)
1018
1043
revs -> limited = 1 ;
1019
1044
}
1020
1045
1021
- int handle_revision_arg (const char * arg , struct rev_info * revs ,
1046
+ int handle_revision_arg (const char * arg_ , struct rev_info * revs ,
1022
1047
int flags ,
1023
1048
int cant_be_filename )
1024
1049
{
@@ -1027,6 +1052,7 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
1027
1052
struct object * object ;
1028
1053
unsigned char sha1 [20 ];
1029
1054
int local_flags ;
1055
+ const char * arg = arg_ ;
1030
1056
1031
1057
dotdot = strstr (arg , ".." );
1032
1058
if (dotdot ) {
@@ -1035,6 +1061,7 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
1035
1061
const char * this = arg ;
1036
1062
int symmetric = * next == '.' ;
1037
1063
unsigned int flags_exclude = flags ^ UNINTERESTING ;
1064
+ unsigned int a_flags ;
1038
1065
1039
1066
* dotdot = 0 ;
1040
1067
next += symmetric ;
@@ -1069,10 +1096,15 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
1069
1096
add_pending_commit_list (revs , exclude ,
1070
1097
flags_exclude );
1071
1098
free_commit_list (exclude );
1072
- a -> object . flags | = flags | SYMMETRIC_LEFT ;
1099
+ a_flags = flags | SYMMETRIC_LEFT ;
1073
1100
} else
1074
- a -> object .flags |= flags_exclude ;
1101
+ a_flags = flags_exclude ;
1102
+ a -> object .flags |= a_flags ;
1075
1103
b -> object .flags |= flags ;
1104
+ add_rev_cmdline (revs , & a -> object , this ,
1105
+ REV_CMD_LEFT , a_flags );
1106
+ add_rev_cmdline (revs , & b -> object , next ,
1107
+ REV_CMD_RIGHT , flags );
1076
1108
add_pending_object (revs , & a -> object , this );
1077
1109
add_pending_object (revs , & b -> object , next );
1078
1110
return 0 ;
@@ -1103,6 +1135,7 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
1103
1135
if (!cant_be_filename )
1104
1136
verify_non_filename (revs -> prefix , arg );
1105
1137
object = get_reference (revs , arg , sha1 , flags ^ local_flags );
1138
+ add_rev_cmdline (revs , object , arg_ , REV_CMD_REV , flags ^ local_flags );
1106
1139
add_pending_object_with_mode (revs , object , arg , mode );
1107
1140
return 0 ;
1108
1141
}
0 commit comments