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>
This commit is contained in:
Martin Koegler 2007-04-22 18:43:59 +02:00 committed by Junio C Hamano
parent e5709a4a68
commit bb6c2fba41
2 changed files with 13 additions and 5 deletions

View File

@ -115,10 +115,15 @@ void mark_parents_uninteresting(struct commit *commit)
} }
void add_pending_object(struct rev_info *revs, struct object *obj, const char *name) void add_pending_object(struct rev_info *revs, struct object *obj, const char *name)
{
add_pending_object_with_mode(revs, obj, name, S_IFINVALID);
}
void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, const char *name, unsigned mode)
{ {
if (revs->no_walk && (obj->flags & UNINTERESTING)) if (revs->no_walk && (obj->flags & UNINTERESTING))
die("object ranges do not make sense when not walking revisions"); die("object ranges do not make sense when not walking revisions");
add_object_array(obj, name, &revs->pending); add_object_array_with_mode(obj, name, &revs->pending, mode);
if (revs->reflog_info && obj->type == OBJ_COMMIT) if (revs->reflog_info && obj->type == OBJ_COMMIT)
add_reflog_for_walk(revs->reflog_info, add_reflog_for_walk(revs->reflog_info,
(struct commit *)obj, name); (struct commit *)obj, name);
@ -723,6 +728,7 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
int flags, int flags,
int cant_be_filename) int cant_be_filename)
{ {
unsigned mode;
char *dotdot; char *dotdot;
struct object *object; struct object *object;
unsigned char sha1[20]; unsigned char sha1[20];
@ -796,12 +802,12 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
local_flags = UNINTERESTING; local_flags = UNINTERESTING;
arg++; arg++;
} }
if (get_sha1(arg, sha1)) if (get_sha1_with_mode(arg, sha1, &mode))
return -1; return -1;
if (!cant_be_filename) if (!cant_be_filename)
verify_non_filename(revs->prefix, arg); verify_non_filename(revs->prefix, arg);
object = get_reference(revs, arg, sha1, flags ^ local_flags); object = get_reference(revs, arg, sha1, flags ^ local_flags);
add_pending_object(revs, object, arg); add_pending_object_with_mode(revs, object, arg, mode);
return 0; return 0;
} }
@ -1177,10 +1183,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
if (def && !revs->pending.nr) { if (def && !revs->pending.nr) {
unsigned char sha1[20]; unsigned char sha1[20];
struct object *object; struct object *object;
if (get_sha1(def, sha1)) unsigned mode;
if (get_sha1_with_mode(def, sha1, &mode))
die("bad default revision '%s'", def); die("bad default revision '%s'", def);
object = get_reference(revs, def, sha1, 0); object = get_reference(revs, def, sha1, 0);
add_pending_object(revs, object, def); add_pending_object_with_mode(revs, object, def, mode);
} }
if (revs->topo_order) if (revs->topo_order)

View File

@ -131,5 +131,6 @@ extern void add_object(struct object *obj,
const char *name); const char *name);
extern void add_pending_object(struct rev_info *revs, struct object *obj, const char *name); extern void add_pending_object(struct rev_info *revs, struct object *obj, const char *name);
extern void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, const char *name, unsigned mode);
#endif #endif