chiark / gitweb /
Test suite: Fix drs-push-masterupdate to refer to correct branch (brokenness detected...
[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 outside the Debian archive (currently, on Alioth).
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 (by default) make signed tags called
35 .BI debian/ version
36 and push them to dgit-repos, but nothing depends on these tags
37 existing.
38
39 dgit push can operate on any commit which is a descendant of the
40 current dgit/suite tip in dgit-repos.
41
42 Uploads made by dgit contain an additional field
43 .B Dgit
44 in the source package .dsc.  (This is added by dgit push.)
45 This specifies a commit (an ancestor of the dgit/suite
46 branch) whose tree is identical to the unpacked source upload.
47
48 Uploads not made by dgit are represented in git by commits which are
49 synthesised by dgit.  The tree of each such commit corresponds to the
50 unpacked source; there is an origin commit with the contents, and a
51 psuedo-merge from last known upload - that is, from the contents of
52 the dgit/suite branch.
53
54 dgit expects repos that it works with to have a
55 .B dgit
56 remote.  This refers to the well-known dgit-repos location (on a
57 dedicated Debian VM).  dgit fetch updates the remote tracking branch
58 for dgit/suite.
59
60 dgit does not (currently) represent the orig tarball(s) in git.  The
61 orig tarballs are downloaded (by dgit clone) into the parent
62 directory, as with a traditional (non-gitish) dpkg-source workflow.
63 You need to retain these tarballs in the parent directory for dgit
64 build and dgit push.
65
66 dgit repositories could be cloned with standard (git) methods. The
67 only exception is that for sourcefull builds / uploads the orig
68 tarball(s) need to be present in the parent directory.
69
70 To a user looking at the archive, changes pushed using dgit look like
71 changes made in an NMU: in a `3.0 (quilt)' package the delta from the
72 previous upload is recorded in a new patch constructed by dpkg-source.
73 .SH READ-ONLY DISTROS
74 Distros which do not maintain a set of dgit history git repositories
75 can still be used in a read-only mode with dgit.  Currently Ubuntu
76 is configured this way.
77 .SH PACKAGE SOURCE FORMATS
78 If you are not the maintainer, you do not need to worry about the
79 source format of the package.  You can just make changes as you like
80 in git.  If the package is a `3.0 (quilt)' package, the patch stack
81 will usually not be represented in the git history.
82 .SH FORMAT 3.0 (QUILT)
83 For a format `3.0 (quilt)' source package, dgit may have to make a
84 commit on your current branch to contain metadata used by quilt and
85 dpkg-source.
86
87 This is because `3.0 (quilt)' source format represents the patch stack
88 as files in debian/patches/ actually inside the source tree.  This
89 means that, taking the whole tree (as seen by git or ls) (i)
90 dpkg-source cannot represent certain trees, and (ii) packing up a tree
91 in `3.0 (quilt)' and then unpacking it does not always yield the same
92 tree.
93
94 dgit will automatically work around this for you when building and
95 pushing.  The only thing you need to know is that dgit build, sbuild,
96 etc., may make new commits on your HEAD.  If you're not a quilt user
97 this commit won't contain any changes to files you care about.
98
99 You can explicitly request that dgit do just this fixup, by running
100 dgit quilt-fixup.
101
102 If you are a quilt user you need to know that dgit's git trees are
103 `patches applied packaging branches' and do not contain the .pc
104 directory (which is used by quilt to record which patches are
105 applied).  If you want to manipulate the patch stack you probably want
106 to be looking at tools like git-dpm.
107 .SH FILES IN THE SOURCE PACKAGE BUT NOT IN GIT
108 This section is mainly of interest to maintainers who want to use dgit
109 with their existing git history for the Debian package.
110
111 Some developers like to have an extra-clean git tree which lacks files
112 which are normally found in source tarballs and therefore in Debian
113 source packages.  For example, it is conventional to ship ./configure
114 in the source tarball, but some people prefer not to have it present
115 in the git view of their project.
116
117 dgit requires that the source package unpacks to exactly the same
118 files as are in the git commit on which dgit push operates.  So if you
119 just try to dgit push directly from one of these extra-clean git
120 branches, it will fail.
121
122 As the maintainer you therefore have the following options:
123 .TP
124 \(bu
125 Persuade upstream that the source code in their git history and the
126 source they ship as tarballs should be identical.  Of course simply
127 removing the files from the tarball may make the tarball hard for
128 people to use.
129 .IP
130 One answer is to commit the (maybe autogenerated)
131 files, perhaps with some simple automation to deal with conflicts and
132 spurious changes.  This has the advantage that someone who clones
133 the git repository finds the program just as easy to build as someone
134 who uses the tarball.
135 .TP
136 \(bu
137 Have separate git branches which do contain the extra files, and after
138 regenerating the extra files (whenever you would have to anyway),
139 commit the result onto those branches.
140 .TP
141 \(bu
142 Provide source packages which lack the files you don't want
143 in git, and arrange for your package build to create them as needed.
144 This may mean not using upstream source tarballs and makes the Debian
145 source package less useful for people without Debian build
146 infrastructure.
147 .LP
148 Of course it may also be that the differences are due to build system
149 bugs, which cause unintended files to end up in the source package.
150 dgit will notice this and complain.  You may have to fix these bugs
151 before you can unify your existing git history with dgit's.
152 .LP
153 .SH PROBLEMS WITH PACKAGE CLEAN TARGETS ETC.
154 A related problem is unexpected behaviour by a package's
155 .B clean
156 target.
157 If a package's rules
158 remove or modify files which are distributed in the package,
159 or simply forgets to remove certain files,
160 dgit will complain that the tree is dirty.
161 .LP
162 The solution is to use
163 .BR "dgit -wg" " aka " "--clean=git" ,
164 which instructs dgit to use git clean instead of the package's
165 build target,
166 along with perhaps
167 .B git reset --hard
168 before each build.
169 .LP
170 This is 100% reliable, but has the downside
171 that if you forget to git add or to commit, and then use
172 .BR "dgit -wg" " or " "git reset --hard" ,
173 your changes may be lost.
174 .SH SEE ALSO
175 \fBdgit\fP(1).