Re: [PATCH] git-quiltimport.sh: disallow fuzz

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jörn Engel <joern@xxxxxxxxx> writes:

> When I am working on a problem I never think about beauty.  I think
> only how to solve the problem.  But when I have finished, if the
> solution is not beautiful, I know it is wrong.
> -- R. Buckminster Fuller

Nice quote, but does not belong to above --- lines, unless you have
a -- >8 -- line below or something.

Now is the patch beautiful? ;-)

> Subject: [PATCH] git-quiltimport.sh: disallow fuzz by default
>
> git-quiltimport passed "-C1" to git-apply, supposedly to roughly match
> the quilt default of --fuzz 2.  This is against the spirit of git.
> Quoting Linus:
>   Except unlike the standard "patch" program, "git apply" doesn't accept
>   fuzz by default (which to me is a huge deal - I hate how "patch" tries
>   to apply stuff that clearly isn't valid any more)
> Users that want to want to emulate quilt defaults can pass "-C 1" to
> git-quiltimport now.

Things might have been different if this were mid 2006 or early
2007, but I am afraid that "the spirit of git" with a quote from
Linus no longer carries much weight on this particular issue.  A
backward incompatible change is backward incompatible change that
breaks existing users no matter how loudly you (and I) shout that it
is the right thing to do in the long run.

Let's have it the other way around, keep the same behaviour for
those who run the command without the new option, while allowing
people who know better and are aligned with the spirit of git to
pass the parameter, at least for now, with a note in the
documentation to warn that the default may change in the future to
allow no fuzz, or something.

> Also note that -C1 and fuzz=2 is not identical.  Most patches have three
> lines of context, so fuzz=2 leaves one relevant line of context.  But
> for any patches with more or less context this is not true.  git-apply
> has no option for fuzz, so any emulation will always be best-effort.
>
> Signed-off-by: Joern Engel <joern@xxxxxxxxx>
> ---
>  git-quiltimport.sh | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/git-quiltimport.sh b/git-quiltimport.sh
> index 167d79fea809..f45ee5ff6599 100755
> --- a/git-quiltimport.sh
> +++ b/git-quiltimport.sh
> @@ -4,8 +4,9 @@ OPTIONS_STUCKLONG=
>  OPTIONS_SPEC="\
>  git quiltimport [options]
>  --
> -n,dry-run     dry run
>  author=       author name and email address for patches without any
> +C=            minimum context (see git apply)
> +n,dry-run     dry run
>  patches=      path to the quilt series and patches
>  "
>  SUBDIRECTORY_ON=Yes
> @@ -13,6 +14,7 @@ SUBDIRECTORY_ON=Yes
>  
>  dry_run=""
>  quilt_author=""
> +cflag=""
>  while test $# != 0
>  do
>  	case "$1" in
> @@ -20,6 +22,15 @@ do
>  		shift
>  		quilt_author="$1"
>  		;;
> +	-C)
> +		shift
> +		# ensure numerical parameter
> +		case $1 in
> +			''|*[!0-9]*) usage;;
> +			*) ;;
> +		esac
> +		cflag="-C$1"
> +		;;
>  	-n|--dry-run)
>  		dry_run=1
>  		;;
> @@ -130,7 +141,7 @@ do
>  	fi
>  
>  	if [ -z "$dry_run" ] ; then
> -		git apply --index -C1 ${level:+"$level"} "$tmp_patch" &&
> +		git apply --index $cflag ${level:+"$level"} "$tmp_patch" &&
>  		tree=$(git write-tree) &&
>  		commit=$( (echo "$SUBJECT"; echo; cat "$tmp_msg") | git commit-tree $tree -p $commit) &&
>  		git update-ref -m "quiltimport: $patch_name" HEAD $commit || exit 4
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]