summaryrefslogtreecommitdiffstats
path: root/tools/git/update-copyrights.sh
blob: 299362eaf5dd8d06032eed1f63d11981da2bdeb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

tmp=$(mktemp -t chromium-update-copyrights.XXXXX)
trap "rm -f $tmp" EXIT
git diff --name-only $(git cl upstream)... | while read file; do
    cp "$file" "$tmp"
    # Rather than editing the temporary file, edit the original file in-place
    # so that we preserve file modes.
    sed -i -e '1,4s/Copyright .c. .* The Chromium Authors/Copyright (c) 2012 The Chromium Authors/' "$file"
    if ! diff -q "$file" "$tmp" > /dev/null; then
        echo "updated $file"
    fi
done