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

From: Uwe Brauer <[email-masked]>
Date: Sun, 18 Aug 2019 22:46:18 +0200

>>> "RA" == Rafael Ascensão <[email-masked]> 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