git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-svn: prevent dcommitting if the index is dirty.
@ 2007-11-11 18:41 Benoit Sigoure
  2007-11-12  2:28 ` Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Benoit Sigoure @ 2007-11-11 18:41 UTC (permalink / raw)
  To: git; +Cc: normalperson, Benoit Sigoure

dcommit uses rebase `sync' the history with what has just been pushed to
SVN.  Trying to dcommit with a dirty index is troublesome for rebase, so now
the user will get an error message if he attempts to dcommit with a dirty
index.

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
---
 git-svn.perl                              |    3 +++
 t/t9106-git-svn-dcommit-clobber-series.sh |    6 ++++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index dd93e32..a15df4f 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -390,6 +390,9 @@ sub cmd_set_tree {
 
 sub cmd_dcommit {
 	my $head = shift;
+        git_cmd_try { command_oneline(qw/diff-index --quiet HEAD/) }
+          'Cannot dcommit with a dirty index.  Commit your changes first'
+          . "or stash them with `git stash'.\n";
 	$head ||= 'HEAD';
 	my @refs;
 	my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);
diff --git a/t/t9106-git-svn-dcommit-clobber-series.sh b/t/t9106-git-svn-dcommit-clobber-series.sh
index 7eff4cd..44fae3b 100755
--- a/t/t9106-git-svn-dcommit-clobber-series.sh
+++ b/t/t9106-git-svn-dcommit-clobber-series.sh
@@ -53,4 +53,10 @@ test_expect_success 'change file but in unrelated area' "
 		test x\"\`sed -n -e 61p < file\`\" = x6611
 	"
 
+test_expect_failure 'attempt to dcommit with a dirty index' "
+	echo foo >>file &&
+	git add file &&
+	git svn dcommit
+	"
+
 test_done
-- 
1.5.3.5.654.gdd5ec

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] git-svn: prevent dcommitting if the index is dirty.
  2007-11-11 18:41 [PATCH] git-svn: prevent dcommitting if the index is dirty Benoit Sigoure
@ 2007-11-12  2:28 ` Eric Wong
  2007-11-12  9:11   ` Benoit Sigoure
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Wong @ 2007-11-12  2:28 UTC (permalink / raw)
  To: Benoit Sigoure; +Cc: git

Benoit Sigoure <tsuna@lrde.epita.fr> wrote:
> dcommit uses rebase `sync' the history with what has just been pushed to
> SVN.  Trying to dcommit with a dirty index is troublesome for rebase, so now
> the user will get an error message if he attempts to dcommit with a dirty
> index.
> 
> Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>

Thanks,

Minor nit below about indentation (which Junio can fix when applying),
but nevertheless:

Acked-by: Eric Wong <normalperson@yhbt.net>

> ---
>  git-svn.perl                              |    3 +++
>  t/t9106-git-svn-dcommit-clobber-series.sh |    6 ++++++
>  2 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/git-svn.perl b/git-svn.perl
> index dd93e32..a15df4f 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -390,6 +390,9 @@ sub cmd_set_tree {
>  
>  sub cmd_dcommit {
>  	my $head = shift;
> +        git_cmd_try { command_oneline(qw/diff-index --quiet HEAD/) }
> +          'Cannot dcommit with a dirty index.  Commit your changes first'
> +          . "or stash them with `git stash'.\n";

We use tabs for indentation, and spaces for alignment.

>  	$head ||= 'HEAD';
>  	my @refs;
>  	my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] git-svn: prevent dcommitting if the index is dirty.
  2007-11-12  2:28 ` Eric Wong
@ 2007-11-12  9:11   ` Benoit Sigoure
  2007-11-17 20:52     ` Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Benoit Sigoure @ 2007-11-12  9:11 UTC (permalink / raw)
  To: Eric Wong; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 1509 bytes --]

On Nov 12, 2007, at 3:28 AM, Eric Wong wrote:

> Benoit Sigoure <tsuna@lrde.epita.fr> wrote:
>> dcommit uses rebase `sync' the history with what has just been  
>> pushed to
>> SVN.  Trying to dcommit with a dirty index is troublesome for  
>> rebase, so now
>> the user will get an error message if he attempts to dcommit with  
>> a dirty
>> index.
>>
>> Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
>
> Thanks,
>
> Minor nit below about indentation (which Junio can fix when applying),
> but nevertheless:
>
> Acked-by: Eric Wong <normalperson@yhbt.net>
>
>> ---
>>  git-svn.perl                              |    3 +++
>>  t/t9106-git-svn-dcommit-clobber-series.sh |    6 ++++++
>>  2 files changed, 9 insertions(+), 0 deletions(-)
>>
>> diff --git a/git-svn.perl b/git-svn.perl
>> index dd93e32..a15df4f 100755
>> --- a/git-svn.perl
>> +++ b/git-svn.perl
>> @@ -390,6 +390,9 @@ sub cmd_set_tree {
>>
>>  sub cmd_dcommit {
>>  	my $head = shift;
>> +        git_cmd_try { command_oneline(qw/diff-index --quiet HEAD/) }
>> +          'Cannot dcommit with a dirty index.  Commit your  
>> changes first'
>> +          . "or stash them with `git stash'.\n";
>
> We use tabs for indentation, and spaces for alignment.

Yes, sorry again, would you consider to add `# vi: set noexpandtab:'  
at the end of the file so that ViM users (like me) don't have to  
think about it?  (it tells ViM to NOT expand tabs to series of spaces)

-- 
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] git-svn: prevent dcommitting if the index is dirty.
  2007-11-12  9:11   ` Benoit Sigoure
@ 2007-11-17 20:52     ` Eric Wong
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2007-11-17 20:52 UTC (permalink / raw)
  To: Benoit Sigoure; +Cc: git

Benoit Sigoure <tsuna@lrde.epita.fr> wrote:
> On Nov 12, 2007, at 3:28 AM, Eric Wong wrote:
> >We use tabs for indentation, and spaces for alignment.
> 
> Yes, sorry again, would you consider to add `# vi: set noexpandtab:'  
> at the end of the file so that ViM users (like me) don't have to  
> think about it?  (it tells ViM to NOT expand tabs to series of spaces)

No, there are still too many cases where the modelines won't apply:
non-VIM users, VIM-users with modelines disabled.

Instead, you can try this in your .vimrc:

augroup filetype
	au BufRead git-svn.perl		set noexpandtab
augroup END

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-11-17 20:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-11 18:41 [PATCH] git-svn: prevent dcommitting if the index is dirty Benoit Sigoure
2007-11-12  2:28 ` Eric Wong
2007-11-12  9:11   ` Benoit Sigoure
2007-11-17 20:52     ` Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).