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

Re: [BUG] Empty reflogs and "git log -g"

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 8, 2007, 19:36 UTC
Message-ID
<Pine.LNX.4.63.0702082022200.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<8aa486160702072325q1d63c5d2mc1c6a492392802c6@mail.gmail.com>
Hi,
On Thu, 8 Feb 2007, Santi Béjar wrote:
Show 17 quoted lines
> On 2/8/07, Santi Béjar <sbejar@gmail.com> wrote:
> > Hi *,
> > 
> >   when a reflog entry do not have a reflog message the refs@{num}
> > syntax gives a different result than with 'git log -g'. Actually 'git
> > log -g' just skips this ref.
> > 
> 
> Also:
> 
> $ git log origin/master
> 
> works, but
> 
> $ git log -g origin/master
> 
> does not. You have to put the remotes prefix.

I hesitate "fixing" that. I mean, if you want to know about the remote branch "master" why not be precise? Yes, "git log" _is_ nice if you want to be sloppy.

But if you _have_ to have it, see attached patch. I will not push for it in time for 1.5.0, though, since I have a track record of not getting patches right on the first try.

Ciao, Dscho

---
 reflog-walk.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/reflog-walk.c b/reflog-walk.c
index 653ec95..430faef 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -174,6 +174,19 @@ void add_reflog_for_walk(struct reflog_walk_info *info,
 			branch = xstrdup(head);
 		}
 		reflogs = read_complete_reflog(branch);
+		if (!reflogs || reflogs->nr == 0) {
+			unsigned char sha1[20];
+			char *b;
+			if (dwim_ref(branch, strlen(branch), sha1, &b) == 1) {
+				if (reflogs) {
+					free(reflogs->ref);
+					free(reflogs);
+				}
+				free(branch);
+				branch = b;
+				reflogs = read_complete_reflog(branch);
+			}
+		}
 		if (!reflogs || reflogs->nr == 0)
 			die("No reflogs found for '%s'", branch);
 		path_list_insert(branch, &info->complete_reflogs)->util
Previous: Santi BéjarNext: Nicolas Pitre
Message 3 of 13 in “[BUG] Empty reflogs and "git log -g"”
  1. Santi BéjarFeb 8, 2007
  2. Santi BéjarFeb 8, 2007
  3. Johannes SchindelinFeb 8, 2007
  4. Nicolas PitreFeb 8, 2007
  5. Johannes SchindelinFeb 8, 2007
  6. Johannes SchindelinFeb 8, 2007
  7. Jakub NarebskiFeb 8, 2007
  8. Johannes SchindelinFeb 8, 2007
  9. Junio C HamanoFeb 8, 2007
  10. for_each_reflog_ent: be forgiving about missing messageJohannes Schindelin, Feb 8, 2007
  11. log --reflog: use dwim_logJohannes Schindelin, Feb 9, 2007
  12. Junio C HamanoFeb 9, 2007
  13. Junio C HamanoFeb 9, 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.