Skip to content
This repository
Browse code

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>
  • Loading branch information...
commit 1581a3040145fa923e66131d4c9e983a18efe089 1 parent bdbb22f
dscho dscho authored patthoyts committed

Showing 2 changed files with 8 additions and 6 deletions. Show diff stats Hide diff stats

  1. +1 1  object.h
  2. +7 5 revision.c
2  object.h
@@ -12,7 +12,7 @@ struct object_array {
12 12 struct object_array_entry {
13 13 struct object *item;
14 14 const char *name;
15   - unsigned mode;
  15 + unsigned mode, flags;
16 16 } *objects;
17 17 };
18 18
12 revision.c
@@ -185,7 +185,7 @@ void mark_parents_uninteresting(struct commit *commit)
185 185 }
186 186 }
187 187
188   -static void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, const char *name, unsigned mode)
  188 +static void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, const char *name, unsigned mode, unsigned flags)
189 189 {
190 190 if (!obj)
191 191 return;
@@ -206,11 +206,12 @@ static void add_pending_object_with_mode(struct rev_info *revs, struct object *o
206 206 return;
207 207 }
208 208 add_object_array_with_mode(obj, name, &revs->pending, mode);
  209 + revs->pending.objects[revs->pending.nr-1].flags = flags;
209 210 }
210 211
211 212 void add_pending_object(struct rev_info *revs, struct object *obj, const char *name)
212 213 {
213   - add_pending_object_with_mode(revs, obj, name, S_IFINVALID);
  214 + add_pending_object_with_mode(revs, obj, name, S_IFINVALID, 0);
214 215 }
215 216
216 217 void add_head_to_pending(struct rev_info *revs)
@@ -1176,7 +1177,8 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs,
1176 1177 REV_CMD_LEFT, a_flags);
1177 1178 add_rev_cmdline(revs, &b->object, next,
1178 1179 REV_CMD_RIGHT, flags);
1179   - add_pending_object(revs, &a->object, this);
  1180 + add_pending_object_with_mode(revs, &a->object, this,
  1181 + S_IFINVALID, flags_exclude);
1180 1182 add_pending_object(revs, &b->object, next);
1181 1183 return 0;
1182 1184 }
@@ -1207,7 +1209,7 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs,
1207 1209 verify_non_filename(revs->prefix, arg);
1208 1210 object = get_reference(revs, arg, sha1, flags ^ local_flags);
1209 1211 add_rev_cmdline(revs, object, arg_, REV_CMD_REV, flags ^ local_flags);
1210   - add_pending_object_with_mode(revs, object, arg, mode);
  1212 + add_pending_object_with_mode(revs, object, arg, mode, local_flags);
1211 1213 return 0;
1212 1214 }
1213 1215
@@ -1824,7 +1826,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
1824 1826 if (get_sha1_with_mode(revs->def, sha1, &mode))
1825 1827 die("bad default revision '%s'", revs->def);
1826 1828 object = get_reference(revs, revs->def, sha1, 0);
1827   - add_pending_object_with_mode(revs, object, revs->def, mode);
  1829 + add_pending_object_with_mode(revs, object, revs->def, mode, 0);
1828 1830 }
1829 1831
1830 1832 /* Did the user ask for any diff output? Run the diff! */

0 comments on commit 1581a30

Please sign in to comment.
Something went wrong with that request. Please try again.