0

Problem: I need to check in some unfinished work so the team can start testing. There is a bunch of stuff I don't want to commit.

This is no solution for either git or svn.

Ignore specific changes to a file in git, but not the entire file

Hmm... I could implement this in a shell script, if there were a way to 'extend' svn to add 'preprocessor' shell scripting.

Basically, write a shell script that strips out lines bounded by a certain lexible symbol, just before executing 'svn commit'.

Off the top of my head:

#pragma mark nocommit
#pragma mark endnocommit

has anyone done this?

I put #warning's in my working copy that I don't need other people to see for many reasons. However, when it comes time to commit, I have to laboriously edit out these notes, and then put them back in after the commit.

Examples:

  • I've got a new feature working that you need the team to start testing, but I've marked up the code with a list of 'known bugs'. I want these #warning's as a reminder to tell the tester not to worry about these 'known bugs'

  • I've reproduced an edge-case bug, but I don't have time to fix it yet.
    Example:

    #warning known bug: figure out why this "ERROR: mismatch" happens when you drag/drop a clip?

  • I put in a #warning to keep something on my radar because I haven't come up with a more elegant solution yet

  • I don't want other team members to know that I haven't come up with a better solution yet, because once you commit a comment like this, people tend to interpret it as something 'official' they need to weigh in on. (i.e. advice that I don't want to hear right now because of my passive-aggressive personality :P)

Example:

I would love to markup my working copy with something that git/svn/etc. will recognize as something I never want committed, like this:

#pragma mark nocommit
#warning TODO... figure out why this mismatch happens when you drag/drop a clip?
##pragma mark endnocommit

This would save me soooooo much time compared the other 'non-solutions' suggested.

Hmm... someone else suggested this:

http://rpm.pbone.net/index.php3/stat/4/idpl/30087865/dir/opensuse_13.x/com/perl-App-GitHooks-Plugin-BlockNOCOMMIT-1.0.2-4.1.noarch.rpm.html

Keith Knauber
  • 752
  • 6
  • 13

1 Answers1

1

Git support some hooks as explained here. For your case a pre-commit hook seems appropriate. This hook runs on your local machine before you commit to your local clone.

The Subversion clients do not support hooks, only the Subversion server as explained here and here. Adding this kind of hooks on a central server is usually not done lightly. Therefore for SVN you can wrap the svn client with a shell-script wrapper which intercepts svn ci and similar stuff and performs your checks. But this is easily bypassed for examples by IDEs which use the SVN API directly.

A.H.
  • 63,967
  • 15
  • 92
  • 126
  • good info, thanks. yeah to do this for subversion *client* looks hard/impossible, since 'svn commit' doesn't support --dry-run option – Keith Knauber Nov 05 '18 at 19:03