Bug 221848

Summary: sys/conf/newvers.sh: Only accept git-svn-id: attributes at the start of the line
Product: Base System Reporter: Fabian Keil <fk>
Component: binAssignee: Ed Maste <emaste>
Status: Closed FIXED    
Severity: Affects Some People CC: emaste
Priority: --- Keywords: patch, regression
Version: CURRENTFlags: fk: mfc-stable11?
fk: mfc-stable10?
Hardware: Any   
OS: Any   
Attachments:
Description Flags
sys/conf/newvers.sh: Only accept git-svn-id: attributes at the start of the line none

Description Fabian Keil 2017-08-27 09:28:21 UTC
Created attachment 185801 [details]
sys/conf/newvers.sh: Only accept git-svn-id: attributes at the start of the line

The attached patch lets sys/conf/newvers.sh only accept "git-svn-id:"
attributes at the start of the line.

This prevents incorrect subversion revision detection if "git svn" isn't being
used to get the sources but git is available. Previously old subversion revisions
included in commit messages were favoured over the more recent and correct
revisions in the "Notes:" section.

For example cf1f35574722 represents r315395 but was treated as r313908 which
is referenced in the commit message. Commits following r315395/cf1f35574722
but before another commit with a git-svn-id reference in the commit message
would be treated as r313908 as well.
                                                                                                    
Obtained from: ElectroBSD
Comment 1 Ed Maste freebsd_committer freebsd_triage 2017-09-10 19:04:29 UTC
I applied this to my local tree but discovered it does not work correctly: git log indents the commit message by 4 spaces, so the modified expression does not match. We need grep '^    git-svn-id:' (or perhaps grep '^[[:space:]]*git-svn-id:').

I will commit an updated version of your patch or roll this change into another local change I have for newvers.sh git-svn handling.
Comment 2 commit-hook freebsd_committer freebsd_triage 2017-09-10 19:12:27 UTC
A commit references this bug:

Author: emaste
Date: Sun Sep 10 19:12:01 UTC 2017
New revision: 323394
URL: https://svnweb.freebsd.org/changeset/base/323394

Log:
  newvers.sh: accept "git-svn-id:" at the start of a line only

  This prevents incorrect subversion revision detection when "git svn" is
  not being used to get the sources but git is available. Previously old
  subversion revisions included in commit messages were favoured over the
  more recent and correct revisions in git notes.

  For example cf1f35574722 represents r315395 but was treated as r313908
  which is referenced in the commit message. Commits following
  r315395/cf1f35574722 but before another commit with a git-svn-id
  reference in the commit message would be treated as r313908 as well.

  Patch from PR updated to accommodate the initial four space indent in
  `git log` ouptut.

  PR:		221848
  Submitted by:	Fabian Keil
  Obtained from:	ElectroBSD
  MFC after:	2 weeks

Changes:
  head/sys/conf/newvers.sh
Comment 3 Fabian Keil 2017-09-12 11:14:15 UTC
Thanks for fixing the "'git svn' is being used" use case.
Comment 4 commit-hook freebsd_committer freebsd_triage 2017-10-07 20:17:21 UTC
A commit references this bug:

Author: emaste
Date: Sat Oct  7 20:17:03 UTC 2017
New revision: 324396
URL: https://svnweb.freebsd.org/changeset/base/324396

Log:
  MFC r323394: newvers.sh: accept "git-svn-id:" at the start of a line only

  This prevents incorrect subversion revision detection when "git svn" is
  not being used to get the sources but git is available. Previously old
  subversion revisions included in commit messages were favoured over the
  more recent and correct revisions in git notes.

  For example cf1f35574722 represents r315395 but was treated as r313908
  which is referenced in the commit message. Commits following
  r315395/cf1f35574722 but before another commit with a git-svn-id
  reference in the commit message would be treated as r313908 as well.

  Patch from PR updated to accommodate the initial four space indent in
  `git log` ouptut.

  PR:		221848
  Submitted by:	Fabian Keil
  Obtained from:	ElectroBSD

Changes:
_U  stable/11/
  stable/11/sys/conf/newvers.sh
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2018-05-23 10:26:57 UTC
batch change of PRs untouched in 2018 marked "in progress" back to open.
Comment 6 Eitan Adler freebsd_committer freebsd_triage 2018-05-23 11:13:18 UTC
This was actually fixed. Close.