setup_revisions: remember whether a ref was positive or not

This will be required by fast-export, when no commits were
exported, but the refs should be set, of course.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
This commit is contained in:
Johannes Schindelin
2011-07-23 17:14:47 +02:00
committed by Johannes Schindelin
parent 5c1c7a4867
commit 21e75dfc8e
2 changed files with 8 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ struct object_array {
struct object_array_entry {
struct object *item;
const char *name;
unsigned mode;
unsigned mode, flags;
} *objects;
};

View File

@@ -185,7 +185,7 @@ void mark_parents_uninteresting(struct commit *commit)
}
}
static void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, const char *name, unsigned mode)
static void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, const char *name, unsigned mode, unsigned flags)
{
if (!obj)
return;
@@ -206,11 +206,12 @@ static void add_pending_object_with_mode(struct rev_info *revs, struct object *o
return;
}
add_object_array_with_mode(obj, name, &revs->pending, mode);
revs->pending.objects[revs->pending.nr-1].flags = flags;
}
void add_pending_object(struct rev_info *revs, struct object *obj, const char *name)
{
add_pending_object_with_mode(revs, obj, name, S_IFINVALID);
add_pending_object_with_mode(revs, obj, name, S_IFINVALID, 0);
}
void add_head_to_pending(struct rev_info *revs)
@@ -1176,7 +1177,8 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs,
REV_CMD_LEFT, a_flags);
add_rev_cmdline(revs, &b->object, next,
REV_CMD_RIGHT, flags);
add_pending_object(revs, &a->object, this);
add_pending_object_with_mode(revs, &a->object, this,
S_IFINVALID, flags_exclude);
add_pending_object(revs, &b->object, next);
return 0;
}
@@ -1207,7 +1209,7 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs,
verify_non_filename(revs->prefix, arg);
object = get_reference(revs, arg, sha1, flags ^ local_flags);
add_rev_cmdline(revs, object, arg_, REV_CMD_REV, flags ^ local_flags);
add_pending_object_with_mode(revs, object, arg, mode);
add_pending_object_with_mode(revs, object, arg, mode, local_flags);
return 0;
}
@@ -1820,7 +1822,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
if (get_sha1_with_mode(revs->def, sha1, &mode))
die("bad default revision '%s'", revs->def);
object = get_reference(revs, revs->def, sha1, 0);
add_pending_object_with_mode(revs, object, revs->def, mode);
add_pending_object_with_mode(revs, object, revs->def, mode, 0);
}
/* Did the user ask for any diff output? Run the diff! */