This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

git vs ChangeLog


Mark Wielaard has a handy blog entry describing how to use gnulib's
git-merge-changelog tool to make 'git rebase' and 'git merge' far
less annoying when dealing with ChangeLog files:

http://gnu.wildebeest.org/blog/mjw/2012/03/16/automagically-merging-changelog-files-with-mercurial-or-git/

There are surely other such write-ups around, but this is the first
one I found today (and I don't recall at all where I got the info
for doing it myself many moons ago).  Someone with more round tuits
(and/or tolerance for wiki-writing) than I have should put the
details on the glibc wiki, refined to just what matters for our git
repository.  Note that you want not just a "ChangeLog" pattern but
also a "*/ChangeLog*" to catch nptl/ChangeLog, ports/ChangeLog.foo, etc.

Also, I personally use the two attached scripts so that 'git show-gnu'
is the handy way to produce the standard format for posting a patch
once you've done a git commit on a local branch.


Thanks,
Roland


#!/bin/sh

# Script to process e.g. monotone diff output into ChangeLog fragments.

awk '
$1 == "+++" { file = $2; firsthunk = 0; next }
file !~ /\/?ChangeLog.*/ { next }

$1 == "@@" {
  firsthunk = !firsthunk;
  if (firsthunk) {
    dir = file;
    sub(/^[ab](\/|$)/, "", dir);
    if (dir ~ /\/?ChangeLog$/) sub(/\/?ChangeLog$/, "/", dir);
    if (dir != "" && dir != "/") print dir;
  }
  else error;
  in_context = 0;
  next;
}

!firsthunk { error }
/^[^+]/ { in_context = 1; next }

in_context { error }

{ sub(/^\+/, ""); print; }
' ${1+"$@"}
#!/bin/sh

git show -b ${1+"$@"} | extract-changelog-from-diff
git show --pretty=format: ${1+"$@"} |
filterdiff --exclude='*/ChangeLog*' |
sed '/^diff --git.*\/ChangeLog.*/{
N
d
}'

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]