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

Re: git log --graph with a sort of local revision number

From
UBUwe Brauer <oub@mat.ucm.es>
Date
Aug 18, 2019, 20:46 UTC
Message-ID
<87blwmmcbp.fsf@mat.ucm.es>
In-Reply-To
<20190818190032.GA11185@rigel>
>>> "RA" == Rafael Ascensão <rafa.almas@gmail.com> writes:
   > You can achieve something close (on small repos, more on that later) with:
   > $ git log --graph --color \
   >   --format='%C(auto)changeset: %h:%H%nuser:      %an%ndate:      %ad%nsummary:   %s%n' \
   >   | git name-rev --refs=$(git rev-parse --abbrev-ref HEAD) --name-only --stdin
Ok I see this is bash syntaxes.
In that case it works, but I see
* changeset: f40c01e:f40c01e41afbb87c7321147242354d46ddaee231
| user:      Uwe Brauer
| date:      Thu Aug 15 15:13:00 2019 +0200
| summary:   This is a test.
|
* changeset: 4dcf721:4dcf721042cd8f73d78876caf8f4796153c07023
| user:      Uwe Brauer
| date:      Wed Aug 14 14:33:29 2019 +0200
| summary:   Third
|
* changeset: 93083c8:93083c8b65141047c8346765fb663d5962076246
| user:      Uwe Brauer
| date:      Wed Aug 14 14:33:29 2019 +0200
| summary:   Second
|
* changeset: f59470f:f59470feb19d325accaad634025c229d6977df65
  user:      Uwe Brauer
  date:      Wed Aug 14 14:33:29 2019 +0200
  summary:   First commit

But on the GNU emacs repository which is reasonable old (has about 130 000 commits) and is around 700 MB, your command gives:

* changeset: ee1c638:master
| user:      Lars Ingebrigtsen
| date:      Sat Aug 17 17:30:42 2019 -0700
| summary:   Make `browse-url-of-buffer' work from zip files
|
* changeset: 3d1c9a7:master~1
| user:      Paul Eggert
| date:      Sat Aug 17 17:19:13 2019 -0700
| summary:   Fix org-timer-show-remaining-time > 1 hour
|
* changeset: f38a16e:master~2
| user:      Lars Ingebrigtsen
| date:      Sat Aug 17 16:56:13 2019 -0700
| summary:   Make `describe-function' say that disabled functions are disabled
|
* changeset: 3efe59a:master~3
| user:      Lars Ingebrigtsen
| date:      Sat Aug 17 16:47:16 2019 -0700
| summary:   Make newline-and-indent take a numeric prefix
Which is precisely what you said.
What did I do wrong in my test repo?
Which I generated via the following script

git init echo "First" > test.org git add test.org git add create.sh git commit -a -m "First commit" echo "Second" >> test.org git commit -a -m "Second" echo "Third" >> test.org git commit -a -m "Third" echo "Forth" >> test.org git commit -a -m "Fourth" echo "Fifth" >> test.org git commit -a -m "Fifth" echo "Six" >> test.org git commit -a -m "Six"

   >     * changeset: 5fa0f52:master
   >     | user:      Junio C Hamano
   >     | date:      Fri Aug 16 10:28:23 2019 -0700
   >     | summary:   Git 2.23
   >     |
   >     *   changeset: 8e0fa0e:master~1
   >     |\  user:      Junio C Hamano
   >     | | date:      Fri Aug 16 10:22:51 2019 -0700
   >     | | summary:   Merge tag 'l10n-2.23.0-rnd2' of git://github.com/git-l10n/git-po
   >     | | 
   >     | * changeset: a6cd2cc:master~1^2
   >     | | user:      Jiang Xin
   >     | | date:      Tue Jul 30 10:02:22 2019 +0800
   >     | | summary:   l10n: zh_CN: for git v2.23.0 l10n round 1~2
   > And in this case, since we are using HEAD to describe the commits by
   > using --refs=$(git rev-parse --abbrev-ref HEAD), you can refer to
   > a6cd2cc either as master~1^2 or HEAD~1^2.
   > Now, git-name-rev has some memory/performance problems in repos with a
   > high number of references. Alban Gruin was working on this issue[1], but
   > I don't know what's the status of it.
   > [1]:https://github.com/agrn/git/tree/ag/fix-name-rev-leak
Previous: Uwe BrauerNext: Uwe Brauer
Message 4 of 13 in “git log --graph with a sort of local revision number”
  1. Uwe BrauerAug 15, 2019
  2. Rafael AscensãoAug 18, 2019
  3. Uwe BrauerAug 18, 2019
  4. Uwe BrauerAug 18, 2019
  5. [SOLVED] (was: git log --graph with a sort of local revision number)Uwe Brauer, Aug 18, 2019
  6. [problem with name-rev] (was: git log --graph with a sort of local revision number)Uwe Brauer, Aug 20, 2019
  7. SZEDER GáborAug 20, 2019
  8. Rafael AscensãoAug 20, 2019
  9. Junio C HamanoAug 20, 2019
  10. Uwe BrauerAug 20, 2019
  11. Phil HordAug 20, 2019
  12. Uwe BrauerAug 21, 2019
  13. Uwe BrauerAug 21, 2019

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.