git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 24, 2007, 09:14 UTC
Message-ID
<Pine.LNX.4.64.0707241011090.14781@racer.site>
In-Reply-To
<7vbqe2jr9m.fsf@assigned-by-dhcp.cox.net>
Hi,
On Mon, 23 Jul 2007, Junio C Hamano wrote:
Show 8 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > 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.
> 
> Hmph, do we even want to error(), I wonder...
Maybe not.  I thought it was some useful information, though.
> Can you tell, at that point, if there were explicit branch names given 
> originally on the command line, or the refs came
> from --all?
No:
                        if (!strcmp(arg, "--all")) {
                                handle_all(revs, flags);
                                continue;
                        }
which calls
static void handle_all(struct rev_info *revs, unsigned flags)
{
        struct all_refs_cb cb;
        cb.all_revs = revs;
        cb.all_flags = flags;
        for_each_ref(handle_one_ref, &cb);
}
which in turn calls
static int handle_one_ref(const char *path, const unsigned char *sha1, int flag,
 void *cb_data)
{
        struct all_refs_cb *cb = cb_data;
        struct object *object = get_reference(cb->all_revs, path, sha1,
                                              cb->all_flags);
        add_pending_object(cb->all_revs, object, path);
        return 0;
}

If you do not say --all, handle_revision_arg() is called, which calls add_pending_object thus:

                        add_pending_object(revs, &a->object, this);
                        add_pending_object(revs, &b->object, next);
or thus
        add_pending_object_with_mode(revs, object, arg, mode);

So no, there is not really a chance to see how the refs were specified at the time add_pending_object() is called.

Ciao, Dscho

Previous: Junio C HamanoNext: Alex Riesen
Message 3 of 7 in “git log -g: Complain, but do not fail, when no reflogs are there”
  1. git log -g: Complain, but do not fail, when no reflogs are thereJohannes Schindelin, Jul 23, 2007
  2. Junio C HamanoJul 24, 2007
  3. Johannes SchindelinJul 24, 2007
  4. Alex RiesenJul 24, 2007
  5. Johannes SchindelinJul 24, 2007
  6. Alex RiesenJul 24, 2007
  7. Johannes SchindelinJul 24, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.