File: git-hook-pre-rebase

package info (click to toggle)
cockpit 358-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 317,272 kB
  • sloc: javascript: 775,788; python: 41,626; ansic: 33,970; cpp: 11,141; sh: 3,566; makefile: 581; xml: 262
file content (16 lines) | stat: -rwxr-xr-x 540 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

rebase_onto="$1"

for dir in node_modules test/reference; do
    # If a particular submodule is...
    if test -e "${dir}/.git" &&                         # ...checked out...
       test -z "$(git status --porcelain "${dir}")" &&  # ...clean...
       ! git diff --quiet "${rebase_onto}" -- "${dir}"  # ...and changed on origin...
    then
        # then save ourselves the trouble of it being wrong post-rebase.
        echo "Removing soon-to-be out-of-date ${dir}..."
        rm -rf "${dir}"
        mkdir "${dir}"
    fi
done