17

.dproj files are essential for Delphi projects, so they have to be under version control.

These files are controlled by the IDE and also contain some information that is frequently changed, but totally irrelevant for version control.

For example: I change the start parameters of the application frequently (several times a day), but don't want to accidently commit the project file if only the part dealing with the start parameters has changed.

So how to deal with this situation?

A clean solution would be to take the file apart, but that isn't possible with the Delphi IDE AFAIK.

Can you ignore a specific part of a file?

We're using Subversion at the moment, but may migrate to Git soon.

Jens Mühlenhoff
  • 14,565
  • 6
  • 56
  • 113
  • 1
    While you're still using SVN you can use the 'svn:needs-lock' property to keep people from accidently modifying the project file. – Kenneth Cochran Nov 18 '11 at 22:00

5 Answers5

12

In our case, it's rare for a developer to make a meaningful change to the .bdsproj, .dpr, .res files. So we reject the commit (pre-commit hook in subversion) unless special tags: [add project file] or [add res file] are present in the commit comment. This prevents "frivilous" changes to those files.

Chris Thornton
  • 15,620
  • 5
  • 37
  • 62
6

SVN/git cannot "know" which bits of the file are important, and translating what is important for you to commit or not into file "bits" would be difficult (especially when you don't know exactly how the information is structured within it). The most practical solution is to check the changes that have been made to the file and decide whether to commit them or not to the repository.

You can decide which bits of the file you want to commit with git. This is not, however, the automated process you seem to be looking for.

Community
  • 1
  • 1
jbat100
  • 16,757
  • 4
  • 45
  • 70
  • I guess you're right. I'm actually having an issue with pushing changes from a git working copy to svn using `git-svn dcommit`. That is related to a possible problem with a frontend called SmartGit which I am going to report to the developers now. – Jens Mühlenhoff Nov 18 '11 at 10:03
  • I'm unable to push when there are any uncommited changes which is partly the fault of git-svn and partly of SmartGit. – Jens Mühlenhoff Nov 18 '11 at 10:05
  • Ok, SmartGit supports `git stash` which is an acceptable workaround to the `giv-svn` limitation: http://stackoverflow.com/questions/39651/git-stash-vs-git-branch – Jens Mühlenhoff Nov 21 '11 at 09:17
6

For the specific case of startparameters: the DDevExtentions plugin of the well known Andreas Hausladen allow for the start parameters be stored separetely of dproj file. See more details about DDevExtensions on his site.

EDIT: If I remember correctly, this feature was created just because he had that exact problem with start parameters and version control.

Fabricio Araujo
  • 3,810
  • 3
  • 28
  • 43
1

I would not save the .dproj files directly in version control, but rather provide a default file which should be renamed by the user to get the flawed Delphi working.

Mot
  • 28,248
  • 23
  • 84
  • 121
1

Use the --assume-unchanged option on git update-index <file> as described here and stackoverflow/what-is-assume-unchanged.

You could make simple aliases for the those who need it made simple.

Community
  • 1
  • 1
Philip Oakley
  • 13,333
  • 9
  • 48
  • 71
  • We're mostly GUI users and our GUI client doesn't support that (AFAICS), but other than that a good idea. – Jens Mühlenhoff Nov 19 '11 at 08:19
  • Has one problem though: If you really have to commit the file and you accidently forget it the changes may get lost. – Jens Mühlenhoff Nov 19 '11 at 08:20
  • There was something on the git list about this (extra documentation): http://article.gmane.org/gmane.comp.version-control.git/181816: To see which files have the "assume unchanged" bit set, use `git ls-files -v`. I haven't check this though. – Philip Oakley Nov 20 '11 at 20:33