Re: git and the loss of revision numbers

From: Ulrich Spörlein <uqs_at_freebsd.org>
Date: Wed, 30 Dec 2020 16:57:38 +0100
On Mon, 2020-12-28 at 17:06:26 -0800, David Wolfskill wrote:
>On Mon, Dec 28, 2020 at 04:56:39PM -0800, John-Mark Gurney wrote:
>> monochrome wrote this message on Mon, Dec 28, 2020 at 19:38 -0500:
>> > what would be the git command for reverting source to a previous version
>> > using these numbers? for example, with svn and old numbers:
>> > svnlite update -r367627 /usr/src
>> >
>> > this is needed often when it blows up for someone tracking current
>>
>> Get the hash from a commit number:
>> $git rev-list --reverse HEAD | tail -n +255241 | head -n 1
>> 3cc0c0d66a065554459bd2f9b4f80cc07426464a
>>
>> so:
>> git checkout $(git rev-list --reverse HEAD | tail -n +255240 | head -n 1)
>> ....
>
>Or save a process:
>
>git rev-list --reverse HEAD | awk 'NR == 255241 {print; exit 0}'
>3cc0c0d66a065554459bd2f9b4f80cc07426464a
>
>(And thus:
>git checkout $(git rev-list --reverse HEAD | awk 'NR == 255241 {print; exit 0}')
>
>Could also pass the number to awk via the "-v var=value" command-line.)

Counting commits will not get you to SVN revision 12345, you need to 
look at the git notes, they are there for that exact reason.

(fun fact, r12345 isn't actually on the main branch, so don't try with 
that one)

% git log --oneline -n1 --notes --grep='revision=12346$' main
df4f0253cd89 Use NO_MTREE, not !USE_X11 && !USE_IMAKE, to determine package args. NO_MTREE should work as advertised (for both direct installation and pkg_add) now.
Notes:
     svn path=/head/; revision=12346

So df4f0253cd89 is the corresponding git commit to your SVN r12346

hth
Uli
Received on Wed Dec 30 2020 - 14:57:42 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:26 UTC