Codebase list gavl / 656ebd0
Dropped git-tuneclone.sh script IOhannes m zmölnig 6 years ago
2 changed file(s) with 34 addition(s) and 49 deletion(s). Raw diff Collapse all Expand all
0 gbp clone
1 ---------
02
1 git-tuneclone.sh
2 ----------------
3 Starting with gbp>0.8.1, here's an simple way to automatically fine-tune the
4 repository in the following ways:
5 - make git ignore any .pc/ directory (created by quilt)
6 - enable the "--follow-tags" when running 'git-push', so it's harder
7 to forget to push packaging tags along with the branches.
38
4 This package comes with a script 'debian/git-tuneclone.sh'.
5 Running it after a fresh clone of the packaging repository
6 will fine-tune your local copy, namely:
7 - make git ignore any .pc/ directory (created by quilt)
8 - enable the "-follow-tags" when running 'git-push', so it's harder
9 to forget to push packaging tags along with the branches.
10 - do an initial checkout of the 3 packaging branches (master, pristine-tar,
11 upstream)
12 The script only needs to run once (though running it multiple times shouldn't
13 matter).
14 You are of course free to *not* run the script, if you prefer.
9 To enable this for ALL repositories cloned via 'gbp' (in the future), do
10 something like the following:
1511
16 -- IOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org> Tue, 11 Nov 2015 11:11:03 +0100
12 ~~~
13 $ mkdir -p ~/bin
14 $ cat >> ~/bin/gbphook-postclone <<EOF
15 #!/bin/sh
16 ## script to initialize a cloned repository
1717
18 # - enable the "--follow-tags" mode for pushing
19 echo "tuning git-repository for ${NAME}"
20 git config push.followTags true && echo "enabled push.followTags"
21
22 # - ignore quilt's .pc/ directory
23 GITEXCLUDE=".git/info/exclude"
24 egrep "^/?\.pc/?$" "${GITEXCLUDE}" >/dev/null 2>&1 \
25 || (echo "/.pc/" >> "${GITEXCLUDE}" && echo "ignoring /.pc/")
26 EOF
27
28 $ chmod u+x ~/bin/gbphook-postclone
29 $ cat >> ~/.gbp.conf <<EOF
30 [clone]
31 postclone = ~/bin/gbphook-postclone
32 EOF
33
34 $ gbp clone ...
35 ~~~
36
37 -- IOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org> Mon, 1 Aug 2016 12:15:50 +0200
+0
-35
debian/git-tuneclone.sh less more
0 #!/bin/sh
1
2 ## script to initialize a cloned repository
3 ## with per (local) repository settings.
4
5 # - ignore quilt's .pc/ directory
6 # - enable the "--follow-tags" mode for pushing
7
8 error() {
9 echo "$@" 1>&2
10 }
11
12 NAME=$(dpkg-parsechangelog -S Source)
13
14 if [ "x${NAME}" = "x" ]; then
15 error "unable to determine package name"
16 error "make sure you run this script within a source package dir"
17 exit 1
18 fi
19
20 if [ ! -d ".git" ]; then
21 error "it seems like this source package is not under git control"
22 exit 1
23 fi
24
25 echo "tuning git-repository for ${NAME}"
26 git config push.followTags true && echo "enabled push.followTags"
27
28 GITEXCLUDE=".git/info/exclude"
29 egrep "^/?\.pc/?$" "${GITEXCLUDE}" >/dev/null 2>&1 \
30 || (echo "/.pc/" >> "${GITEXCLUDE}" && echo "ignoring /.pc/")
31
32 for branch in pristine-tar upstream master; do
33 git checkout "${branch}"
34 done