All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC] git-svn: remove auto_abbrev (Getopt::Long option)
@ 2011-08-13 20:33 Piotr Krukowiecki
  2011-08-17  1:02 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Piotr Krukowiecki @ 2011-08-13 20:33 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Eric Wong


RFC because this changes user interface (no option abbreviation),
but I know no other good way to fix the --author problem.

The --author option would be useful, because I usually use
  git svn log --oneline
and paste the changes with svn revision numbers to bugzilla etc.

All tests pass with this change.

--------8<--------
From: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
Date: Sat, 13 Aug 2011 21:00:56 +0200
Subject: [PATCH] git-svn: remove auto_abbrev (Getopt::Long option)

auto_abbrev allows to specify shortest unique option prefix.
For example '--authors-file' can be written also as '--author'
given there is no other option which begins with '--author'.

'git-svn log' passes all unrecognized options to 'git log'. It should
also pass '--author' but due to auto_abbrev it recognizes it as
'--authors-file'. In result it's not possible to use this option.

Fix this by removing auto_abbrev. No other perl script seems to use it,
also other git commands seems to have no option abbreviation feature.
The side effect is that you can not abbreviate options to git-svn, obviously.

In fact only log and blame requires no option abbreviation, because only they
use pass_through option (pass unrecognized options), but I think it would not
be natural if some git-svn commands had options abbreviations and some didn't.

Alternative would be to handle all conflicting blame/log options, but
maintaing it would be a nightmare...

Signed-off-by: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
---
 git-svn.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 89f83fd..3e2e276 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -56,7 +56,7 @@ use File::Basename qw/dirname basename/;
 use File::Path qw/mkpath/;
 use File::Spec;
 use File::Find;
-use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
+use Getopt::Long qw/:config gnu_getopt no_ignore_case/;
 use IPC::Open3;
 use Git;
 use Memoize;  # core since 5.8.0, Jul 2002
-- 
1.7.6.GIT

-- 
Piotr Krukowiecki

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

* Re: [PATCH/RFC] git-svn: remove auto_abbrev (Getopt::Long option)
  2011-08-13 20:33 [PATCH/RFC] git-svn: remove auto_abbrev (Getopt::Long option) Piotr Krukowiecki
@ 2011-08-17  1:02 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2011-08-17  1:02 UTC (permalink / raw)
  To: Piotr Krukowiecki; +Cc: Git Mailing List

Piotr Krukowiecki <piotr.krukowiecki@gmail.com> wrote:
> RFC because this changes user interface (no option abbreviation),
> but I know no other good way to fix the --author problem.
> 
> The --author option would be useful, because I usually use
>   git svn log --oneline
> and paste the changes with svn revision numbers to bugzilla etc.
> 
> All tests pass with this change.

How about minimizing the impact and potential breakage with this?

(I'm not sure if "blame" benefits/hurts from this, I almost never
use any form of it)

diff --git a/git-svn.perl b/git-svn.perl
index 96f373f..ba382eb 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -298,6 +298,9 @@ my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);
 read_git_config(\%opts);
 if ($cmd && ($cmd eq 'log' || $cmd eq 'blame')) {
 	Getopt::Long::Configure('pass_through');
+	if ($cmd eq 'log') {
+		Getopt::Long::Configure('no_auto_abbrev');
+	}
 }
 my $rv = GetOptions(%opts, 'help|H|h' => \$_help, 'version|V' => \$_version,
                     'minimize-connections' => \$Git::SVN::Migration::_minimize,
-- 
Eric Wong

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

end of thread, other threads:[~2011-08-17  1:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-13 20:33 [PATCH/RFC] git-svn: remove auto_abbrev (Getopt::Long option) Piotr Krukowiecki
2011-08-17  1:02 ` Eric Wong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.