git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Kong Lucien <Lucien.Kong@ensimag.imag.fr>
Cc: git@vger.kernel.org,
	Valentin Duperray <Valentin.Duperray@ensimag.imag.fr>,
	Franck Jonas <Franck.Jonas@ensimag.imag.fr>,
	Thomas Nguy <Thomas.Nguy@ensimag.imag.fr>,
	Huynh Khoi Nguyen Nguyen 
	<Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>
Subject: Re: [PATCH] rebase [-i --exec | -ix] <CMD>...
Date: Mon, 04 Jun 2012 19:48:50 +0200	[thread overview]
Message-ID: <vpqk3znrmrh.fsf@bauges.imag.fr> (raw)
In-Reply-To: <1338817674-22877-1-git-send-email-Lucien.Kong@ensimag.imag.fr> (Kong Lucien's message of "Mon, 4 Jun 2012 15:47:54 +0200")

Kong Lucien <Lucien.Kong@ensimag.imag.fr> writes:

> --- a/Documentation/git-rebase.txt
> +++ b/Documentation/git-rebase.txt
> @@ -8,9 +8,9 @@ git-rebase - Forward-port local commits to the updated upstream head
>  SYNOPSIS
>  --------
>  [verse]
> -'git rebase' [-i | --interactive] [options] [--onto <newbase>]
> +'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]
>  	[<upstream>] [<branch>]
> -'git rebase' [-i | --interactive] [options] --onto <newbase>
> +'git rebase' [-i | --interactive] [options] [--exec <cmd>] --onto <newbase>
>  	--root [<branch>]
>  'git rebase' --continue | --skip | --abort
>  
> @@ -210,6 +210,17 @@ rebase.autosquash::
>  
>  OPTIONS
>  -------
> +<cmd>::
> +	Shell command executed between each commit applications. The
> +	--exec option has to be specified.
[...]
> +-x::
> +--exec::

That seems weird to have --exec <cmd> specification split into one for
--exec, and another for <cmd> ...

> +You may execute several commands between each commit applications.
> +Therefore, you can use one instance of exec:
> +	git rebase -i --exec "cmd1; cmd2; ...".

s/Therefore/For this/ ?

(Therefore = donc in French)

> +if test -n "$cmd"
> +then
> +	OIFS=$IFS
> +	IFS=','
> +	for i in $cmd
> +	do
> +		sed "/^pick .*/aexec $i" "$todo" >tmp
> +		cat tmp >"$todo"
> +	done
> +	rm tmp

Isn't this executed from the top of the workdir? What if the user
already has a file named tmp there?

> +			if test -n "$cmd"
> +			then
> +				cmd="$2,$cmd"
> +			else
> +				cmd="$2"
> +			fi

What happens when <cmd> contains a comma (e.g. --exec "rm
file,with,commas,in,name.txt") ?

If you don't allow this case, then you should error out instead of
executing a weird behavior silently. Or you can escape the comma and
unescape it later, but that may be overkill.

> +if test -n "$exec_flag" &&
> +   test -z "$interactive_rebase"
> +then
> +	echo "--exec option must be used with --interactive option\n"
> +	usage
> +fi

I'd even skip the "usage" here, as the error message is clear enough
(and is much less visible before a page of "usage" output). Just die-ing
would be better I think.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

  parent reply	other threads:[~2012-06-04 17:49 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-04 13:47 [PATCH] rebase [-i --exec | -ix] <CMD> Kong Lucien
2012-06-04 17:42 ` Junio C Hamano
2012-06-04 20:30   ` Matthieu Moy
2012-06-04 21:06     ` Junio C Hamano
2012-06-05 17:59   ` konglu
2012-06-05 18:13     ` Junio C Hamano
2012-06-04 17:48 ` Matthieu Moy [this message]
2012-06-06 10:34 ` [PATCHv2] " Lucien Kong
2012-06-06 20:03   ` Matthieu Moy
2012-06-06 22:54   ` Junio C Hamano
2012-06-07  8:25   ` Zbigniew Jędrzejewski-Szmek
2012-06-07  8:40   ` Johannes Sixt
2012-06-07 12:04     ` konglu
2012-06-07 13:43       ` Matthieu Moy
2012-06-08 14:53   ` [PATCHv3 1/2] git-rebase.txt: "--onto" option updated Lucien Kong
2012-06-08 14:53     ` [PATCHv3 2/2] rebase [-i --exec | -ix] <CMD> Lucien Kong
2012-06-08 17:02       ` Johannes Sixt
2012-06-08 18:56       ` Torsten Bögershausen
2012-06-08 19:15         ` konglu
2012-06-08 19:55           ` Torsten Bögershausen
2012-06-08 20:07             ` konglu
2012-06-08 20:51               ` Torsten Bögershausen
2012-06-08 21:03                 ` konglu
2012-06-09  6:14                   ` Torsten Bögershausen
2012-06-09  6:47                     ` konglu
2012-06-10 10:44       ` [PATCHv4] " Lucien Kong
2012-06-10 11:56         ` Johannes Sixt
2012-06-11 15:14           ` Junio C Hamano
2012-06-12 18:55             ` Johannes Sixt
2012-06-12 20:29               ` Junio C Hamano
2012-06-12  8:05         ` [PATCHv5] " Lucien Kong
2012-06-12  9:23           ` Zbigniew Jędrzejewski-Szmek
2012-06-12 14:46             ` Junio C Hamano
2012-06-13 14:04               ` Zbigniew Jędrzejewski-Szmek
2012-06-13 17:32                 ` Junio C Hamano
2012-06-13 18:05                 ` konglu
2012-06-13 18:22                   ` Junio C Hamano
2012-06-13 19:38                     ` konglu
2012-06-13 20:59                       ` Johannes Sixt
2012-06-13 21:07                         ` Zbigniew Jędrzejewski-Szmek
2012-06-13 22:25                         ` Junio C Hamano
2012-06-13 22:35                         ` Junio C Hamano
2012-06-13 22:43                           ` Zbigniew Jędrzejewski-Szmek
2012-06-14  6:57                             ` Matthieu Moy
2012-06-14 14:08                               ` Marc Branchaud
2012-06-08 15:00     ` [PATCHv3 1/2] git-rebase.txt: "--onto" option updated Matthieu Moy
2012-06-08 17:07     ` Junio C Hamano
2012-06-08 19:06       ` konglu
2012-06-08 19:52         ` Junio C Hamano
2012-06-08 20:08           ` konglu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vpqk3znrmrh.fsf@bauges.imag.fr \
    --to=matthieu.moy@grenoble-inp.fr \
    --cc=Franck.Jonas@ensimag.imag.fr \
    --cc=Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr \
    --cc=Lucien.Kong@ensimag.imag.fr \
    --cc=Thomas.Nguy@ensimag.imag.fr \
    --cc=Valentin.Duperray@ensimag.imag.fr \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).