@matheusbsbs / matheus-bagliano / commits / bb6c2fba41
Fork 0

store mode in rev_list, if <tree>:<filename> syntax is used

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at> Signed-off-by: Junio C Hamano <junkio@cox.net>

Martin Koegler committed Apr 22, 2007 at 18:43 UTC bb6c2fba4103948445304493b6211998a02810ce
2 files changed +13 -5
revision.c
+12 -5
@@ -115,10 +115,15 @@ void mark_parents_uninteresting(struct commit *commit)
115 }
116
117 void add_pending_object(struct rev_info *revs, struct object *obj, const char *name)
118 +{
119 + add_pending_object_with_mode(revs, obj, name, S_IFINVALID);
120 +}
121 +
122 +void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, const char *name, unsigned mode)
123 {
124 if (revs->no_walk && (obj->flags & UNINTERESTING))
125 die("object ranges do not make sense when not walking revisions");
121 - add_object_array(obj, name, &revs->pending);
126 + add_object_array_with_mode(obj, name, &revs->pending, mode);
127 if (revs->reflog_info && obj->type == OBJ_COMMIT)
128 add_reflog_for_walk(revs->reflog_info,
129 (struct commit *)obj, name);
@@ -723,6 +728,7 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
728 int flags,
729 int cant_be_filename)
730 {
731 + unsigned mode;
732 char *dotdot;
733 struct object *object;
734 unsigned char sha1[20];
@@ -796,12 +802,12 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
802 local_flags = UNINTERESTING;
803 arg++;
804 }
799 - if (get_sha1(arg, sha1))
805 + if (get_sha1_with_mode(arg, sha1, &mode))
806 return -1;
807 if (!cant_be_filename)
808 verify_non_filename(revs->prefix, arg);
809 object = get_reference(revs, arg, sha1, flags ^ local_flags);
804 - add_pending_object(revs, object, arg);
810 + add_pending_object_with_mode(revs, object, arg, mode);
811 return 0;
812 }
813
@@ -1177,10 +1183,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
1183 if (def && !revs->pending.nr) {
1184 unsigned char sha1[20];
1185 struct object *object;
1180 - if (get_sha1(def, sha1))
1186 + unsigned mode;
1187 + if (get_sha1_with_mode(def, sha1, &mode))
1188 die("bad default revision '%s'", def);
1189 object = get_reference(revs, def, sha1, 0);
1183 - add_pending_object(revs, object, def);
1190 + add_pending_object_with_mode(revs, object, def, mode);
1191 }
1192
1193 if (revs->topo_order)
revision.h
+1
@@ -131,5 +131,6 @@ extern void add_object(struct object *obj,
131 const char *name);
132
133 extern void add_pending_object(struct rev_info *revs, struct object *obj, const char *name);
134 +extern void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, const char *name, unsigned mode);
135
136 #endif