chiark / gitweb /
Don't break if user has push.followTags=true. Closes:#827878.
[dgit.git] / dgit.7
1 .TH dgit 7 "" "Debian Project" "dgit"
2 .SH NAME
3 dgit \- principles of operation
4 .SH SUMMARY
5 .B dgit
6 treats the Debian archive as a version control system, and
7 bidirectionally gateways between the archive and git.  The git view of
8 the package can contain the usual upstream git history, and will be
9 augmented by commits representing uploads done by other developers not
10 using dgit.  This git history is stored in a canonical location known
11 as
12 .B dgit-repos
13 which lives on a dedicated git server.
14 .SH MODEL
15 You may use any suitable git workflow with dgit, provided you
16 satisfy dgit's requirements:
17
18 dgit maintains a pseudo-remote called
19 .BR dgit ,
20 with one branch per suite.  This remote cannot be used with
21 plain git.
22
23 The
24 .B dgit-repos
25 repository for each package contains one ref per suite named
26 \fBrefs/dgit/\fR\fIsuite\fR.  These should be pushed to only by
27 dgit.  They are fast forwarding.  Each push on this branch
28 corresponds to an upload (or attempted upload).
29
30 However, it is perfectly fine to have other branches in dgit-repos;
31 normally the dgit-repos repo for the package will be accessible via
32 the remote name `origin'.
33
34 dgit push will also make signed tags called
35 .BI archive/debian/ version
36 (with version encoded a la DEP-14)
37 and push them to dgit-repos.  These are used at the
38 server to authenticate pushes.
39
40 dgit push can operate on any commit which is a descendant of the
41 current dgit/suite tip in dgit-repos.
42
43 Uploads made by dgit contain an additional field
44 .B Dgit
45 in the source package .dsc.  (This is added by dgit push.)
46 This specifies a commit (an ancestor of the dgit/suite
47 branch) whose tree is identical to the unpacked source upload.
48
49 Uploads not made by dgit are represented in git by commits which are
50 synthesised by dgit.  The tree of each such commit corresponds to the
51 unpacked source; there is an origin commit with the contents, and a
52 pseudo-merge from last known upload - that is, from the contents of
53 the dgit/suite branch.
54
55 dgit expects repos that it works with to have a
56 .B dgit
57 remote.  This refers to the well-known dgit-repos location (on a
58 dedicated Debian VM).  dgit fetch updates the remote tracking branch
59 for dgit/suite.
60
61 dgit does not (currently) represent the orig tarball(s) in git.  The
62 orig tarballs are downloaded (by dgit clone) into the parent
63 directory, as with a traditional (non-gitish) dpkg-source workflow.
64 You need to retain these tarballs in the parent directory for dgit
65 build and dgit push.
66
67 dgit repositories could be cloned with standard (git) methods. The
68 only exception is that for sourceful builds / uploads the orig
69 tarball(s) need to be present in the parent directory.
70
71 To a user looking at the archive, changes pushed using dgit look like
72 changes made in an NMU: in a `3.0 (quilt)' package the delta from the
73 previous upload is recorded in a new patch constructed by dpkg-source.
74 .SH READ-ONLY DISTROS
75 Distros which do not maintain a set of dgit history git repositories
76 can still be used in a read-only mode with dgit.  Currently Ubuntu
77 is configured this way.
78 .SH PACKAGE SOURCE FORMATS
79 If you are not the maintainer, you do not need to worry about the
80 source format of the package.  You can just make changes as you like
81 in git.  If the package is a `3.0 (quilt)' package, the patch stack
82 will usually not be represented in the git history.
83 .SH FORMAT 3.0 (QUILT)
84 For a format `3.0 (quilt)' source package, dgit may have to make a
85 commit on your current branch to contain metadata used by quilt and
86 dpkg-source.
87
88 This is because `3.0 (quilt)' source format represents the patch stack
89 as files in debian/patches/ actually inside the source tree.  This
90 means that, taking the whole tree (as seen by git or ls) (i)
91 dpkg-source cannot represent certain trees, and (ii) packing up a tree
92 in `3.0 (quilt)' and then unpacking it does not always yield the same
93 tree.
94
95 dgit will automatically work around this for you when building and
96 pushing.  The only thing you need to know is that dgit build, sbuild,
97 etc., may make new commits on your HEAD.  If you're not a quilt user
98 this commit won't contain any changes to files you care about.
99
100 You can explicitly request that dgit do just this fixup, by running
101 dgit quilt-fixup.
102
103 If you are a quilt user you need to know that dgit's git trees are
104 `patches applied packaging branches' and do not contain the .pc
105 directory (which is used by quilt to record which patches are
106 applied).  If you want to manipulate the patch stack you probably want
107 to be looking at tools like git-dpm.
108 .SH FILES IN THE SOURCE PACKAGE BUT NOT IN GIT - AUTOTOOLS ETC.
109 This section is mainly of interest to maintainers who want to use dgit
110 with their existing git history for the Debian package.
111
112 Some developers like to have an extra-clean git tree which lacks files
113 which are normally found in source tarballs and therefore in Debian
114 source packages.  For example, it is conventional to ship ./configure
115 in the source tarball, but some people prefer not to have it present
116 in the git view of their project.
117
118 dgit requires that the source package unpacks to exactly the same
119 files as are in the git commit on which dgit push operates.  So if you
120 just try to dgit push directly from one of these extra-clean git
121 branches, it will fail.
122
123 As the maintainer you therefore have the following options:
124 .TP
125 \(bu
126 Persuade upstream that the source code in their git history and the
127 source they ship as tarballs should be identical.  Of course simply
128 removing the files from the tarball may make the tarball hard for
129 people to use.
130 .IP
131 One answer is to commit the (maybe autogenerated)
132 files, perhaps with some simple automation to deal with conflicts and
133 spurious changes.  This has the advantage that someone who clones
134 the git repository finds the program just as easy to build as someone
135 who uses the tarball.
136 .TP
137 \(bu
138 Have separate git branches which do contain the extra files, and after
139 regenerating the extra files (whenever you would have to anyway),
140 commit the result onto those branches.
141 .TP
142 \(bu
143 Provide source packages which lack the files you don't want
144 in git, and arrange for your package build to create them as needed.
145 This may mean not using upstream source tarballs and makes the Debian
146 source package less useful for people without Debian build
147 infrastructure.
148 .LP
149 Of course it may also be that the differences are due to build system
150 bugs, which cause unintended files to end up in the source package.
151 dgit will notice this and complain.  You may have to fix these bugs
152 before you can unify your existing git history with dgit's.
153 .LP
154 .SH FILES IN THE SOURCE PACKAGE BUT NOT IN GIT - DOCS, BINARIES ETC.
155 Some upstream tarballs contain build artifacts which upstream expects
156 some users not to want to rebuild (or indeed to find hard to rebuild),
157 but which in Debian we always rebuild.
158 .LP
159 Examples sometimes include crossbuild firmware binaries and
160 documentation.
161 To avoid problems when building updated source
162 packages
163 (in particular, to avoid trying to represent as changes in
164 the source package uninteresting or perhaps unrepresentable changes
165 to such files)
166 many maintainers arrange for the package clean target
167 to delete these files.
168 .LP
169 dpkg-source does not
170 (with any of the commonly used source formats)
171 represent deletion of files (outside debian/) present in upstream.
172 Thus deleting such files in a dpkg-source working tree does not
173 actually result in them being deleted from the source package.
174 Thus
175 deleting the files in rules clean sweeps this problem under the rug.
176 .LP
177 However, git does always properly record file deletion.
178 Since dgit's
179 principle is that the dgit git tree is the same of dpkg-source -x,
180 that means that a dgit-compatible git tree always contains these
181 files.
182 .LP
183 For the non-maintainer,
184 this can be observed in the following suboptimal occurrences:
185 .TP
186 \(bu
187 The package clean target often deletes these files, making the git
188 tree dirty trying to build the source package, etc.
189 This can be fixed
190 by using
191 .BR "dgit -wg" " aka " "--clean=git" ,
192 so that the package clean target is never run.
193 .TP
194 \(bu
195 The package build modifies these files, so that builds make the git
196 tree dirty.
197 This can be worked around by using `git reset --hard'
198 after each build
199 (or at least before each commit or push).
200 .LP
201 From the maintainer's point of view,
202 the main consequence is that to make a dgit-compatible git branch
203 it is necessary to commit these files to git.
204 The maintainer has a few additional options for mitigation:
205 for example,
206 it may be possible for the rules file to arrange to do the
207 build in a temporary area, which avoids updating the troublesome
208 files;
209 they can then be left in the git tree without seeing trouble.
210 .SH PROBLEMS WITH PACKAGE CLEAN TARGETS ETC.
211 A related problem is other unexpected behaviour by a package's
212 .B clean
213 target.
214 If a package's rules
215 modify files which are distributed in the package,
216 or simply forget to remove certain files,
217 dgit will complain that the tree is dirty.
218 .LP
219 Again, the solution is to use
220 .BR "dgit -wg" " aka " "--clean=git" ,
221 which instructs dgit to use git clean instead of the package's
222 build target,
223 along with perhaps
224 .B git reset --hard
225 before each build.
226 .LP
227 This is 100% reliable, but has the downside
228 that if you forget to git add or to commit, and then use
229 .BR "dgit -wg" " or " "git reset --hard" ,
230 your changes may be lost.
231 .SH SEE ALSO
232 \fBdgit\fP(1).