@matheusbsbs / matheus-bagliano / commits / 7b69b873fa
Fork 0

git log -g: Complain, but do not fail, when no reflogs are there

When asking "git log -g --all", clearly you want to see only those refs that do have reflogs, but you do not want it to fail, either. So instead of die()ing, complain about it, but move on to the other refs. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jul 24, 2007 at 00:39 UTC 7b69b873faf3cfd592bb64a496c6982a540aa7ea
3 files changed +9 -7
reflog-walk.c
+4 -3
@@ -136,7 +136,7 @@ void init_reflog_walk(struct reflog_walk_info** info)
136 *info = xcalloc(sizeof(struct reflog_walk_info), 1);
137 }
138
139 -void add_reflog_for_walk(struct reflog_walk_info *info,
139 +int add_reflog_for_walk(struct reflog_walk_info *info,
140 struct commit *commit, const char *name)
141 {
142 unsigned long timestamp = 0;
@@ -188,7 +188,7 @@ void add_reflog_for_walk(struct reflog_walk_info *info,
188 }
189 }
190 if (!reflogs || reflogs->nr == 0)
191 - die("No reflogs found for '%s'", branch);
191 + return -1;
192 path_list_insert(branch, &info->complete_reflogs)->util
193 = reflogs;
194 }
@@ -200,13 +200,14 @@ void add_reflog_for_walk(struct reflog_walk_info *info,
200 if (commit_reflog->recno < 0) {
201 free(branch);
202 free(commit_reflog);
203 - return;
203 + return -1;
204 }
205 } else
206 commit_reflog->recno = reflogs->nr - recno - 1;
207 commit_reflog->reflogs = reflogs;
208
209 add_commit_info(commit, commit_reflog, &info->reflogs);
210 + return 0;
211 }
212
213 void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
reflog-walk.h
+1 -1
@@ -2,7 +2,7 @@
2 #define REFLOG_WALK_H
3
4 extern void init_reflog_walk(struct reflog_walk_info** info);
5 -extern void add_reflog_for_walk(struct reflog_walk_info *info,
5 +extern int add_reflog_for_walk(struct reflog_walk_info *info,
6 struct commit *commit, const char *name);
7 extern void fake_reflog_parent(struct reflog_walk_info *info,
8 struct commit *commit);
revision.c
+4 -3
@@ -118,10 +118,11 @@ static void add_pending_object_with_mode(struct rev_info *revs, struct object *o
118 {
119 if (revs->no_walk && (obj->flags & UNINTERESTING))
120 die("object ranges do not make sense when not walking revisions");
121 + if (revs->reflog_info && obj->type == OBJ_COMMIT &&
122 + add_reflog_for_walk(revs->reflog_info,
123 + (struct commit *)obj, name))
124 + return;
125 add_object_array_with_mode(obj, name, &revs->pending, mode);
122 - if (revs->reflog_info && obj->type == OBJ_COMMIT)
123 - add_reflog_for_walk(revs->reflog_info,
124 - (struct commit *)obj, name);
126 }
127
128 void add_pending_object(struct rev_info *revs, struct object *obj, const char *name)