From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH] git log -g: Complain, but do not fail, when no reflogs are there
Date: Tue, 24 Jul 2007 00:39:50 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0707240039300.14781@racer.site> (raw)
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>
---
reflog-walk.c | 7 ++++---
reflog-walk.h | 2 +-
revision.c | 7 ++++---
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/reflog-walk.c b/reflog-walk.c
index c983858..7809fad 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -136,7 +136,7 @@ void init_reflog_walk(struct reflog_walk_info** info)
*info = xcalloc(sizeof(struct reflog_walk_info), 1);
}
-void add_reflog_for_walk(struct reflog_walk_info *info,
+int add_reflog_for_walk(struct reflog_walk_info *info,
struct commit *commit, const char *name)
{
unsigned long timestamp = 0;
@@ -188,7 +188,7 @@ void add_reflog_for_walk(struct reflog_walk_info *info,
}
}
if (!reflogs || reflogs->nr == 0)
- die("No reflogs found for '%s'", branch);
+ return error("No reflogs found for '%s'", branch);
path_list_insert(branch, &info->complete_reflogs)->util
= reflogs;
}
@@ -200,13 +200,14 @@ void add_reflog_for_walk(struct reflog_walk_info *info,
if (commit_reflog->recno < 0) {
free(branch);
free(commit_reflog);
- return;
+ return error("No reflog found for '%s'", name);
}
} else
commit_reflog->recno = reflogs->nr - recno - 1;
commit_reflog->reflogs = reflogs;
add_commit_info(commit, commit_reflog, &info->reflogs);
+ return 0;
}
void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
diff --git a/reflog-walk.h b/reflog-walk.h
index a4f7015..7ca1438 100644
--- a/reflog-walk.h
+++ b/reflog-walk.h
@@ -2,7 +2,7 @@
#define REFLOG_WALK_H
extern void init_reflog_walk(struct reflog_walk_info** info);
-extern void add_reflog_for_walk(struct reflog_walk_info *info,
+extern int add_reflog_for_walk(struct reflog_walk_info *info,
struct commit *commit, const char *name);
extern void fake_reflog_parent(struct reflog_walk_info *info,
struct commit *commit);
diff --git a/revision.c b/revision.c
index 16f35c7..038693c 100644
--- a/revision.c
+++ b/revision.c
@@ -118,10 +118,11 @@ static void add_pending_object_with_mode(struct rev_info *revs, struct object *o
{
if (revs->no_walk && (obj->flags & UNINTERESTING))
die("object ranges do not make sense when not walking revisions");
+ if (revs->reflog_info && obj->type == OBJ_COMMIT &&
+ add_reflog_for_walk(revs->reflog_info,
+ (struct commit *)obj, name))
+ return;
add_object_array_with_mode(obj, name, &revs->pending, mode);
- if (revs->reflog_info && obj->type == OBJ_COMMIT)
- add_reflog_for_walk(revs->reflog_info,
- (struct commit *)obj, name);
}
void add_pending_object(struct rev_info *revs, struct object *obj, const char *name)
--
1.5.3.rc2.31.gf7d7-dirty
next reply other threads:[~2007-07-23 23:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-23 23:39 Johannes Schindelin [this message]
2007-07-24 5:37 ` [PATCH] git log -g: Complain, but do not fail, when no reflogs are there Junio C Hamano
2007-07-24 9:14 ` Johannes Schindelin
2007-07-24 7:26 ` Alex Riesen
2007-07-24 9:16 ` Johannes Schindelin
2007-07-24 10:17 ` Alex Riesen
2007-07-24 11:11 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0707240039300.14781@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).