File: git-hook-pre-rebase

package info (click to toggle)
cockpit 355-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 311,568 kB
  • sloc: javascript: 774,787; python: 40,655; ansic: 35,157; cpp: 11,141; sh: 3,512; makefile: 580; xml: 261
file content (16 lines) | stat: -rwxr-xr-x 540 bytes parent folder | download | duplicates (5)
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