From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Peter Hutterer <peter.hutterer@who-t.net>
Cc: git@vger.kernel.org
Subject: Re: [RFC/PATCH] git-submodule: add support for --rebase.
Date: Tue, 7 Apr 2009 14:38:37 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.1.00.0904071428350.6897@intel-tinevez-2-302> (raw)
In-Reply-To: <20090407111445.GA11344@dingo>
Hi,
Disclaimer: if you are offended by constructive criticism, or likely to
answer with insults to the comments I offer, please stop reading this mail
now (and please do not answer my mail, either). :-)
Still with me? Good. Nice to meet you.
Just for the record: responding to a patch is my strongest way of saying
that I appreciate your work.
On Tue, 7 Apr 2009, Peter Hutterer wrote:
> 'git submodule update --rebase' rebases onto the current branch rather
> than detaching the HEAD.
I know what you want to do, but this text is wrong: it should rather read
something like this:
'git submodule update --rebase' rebases your local branch on
top of what would have been checked out to a detached HEAD
otherwise.
Maybe some of these native English speakers on this list can come up with
something even better ;-)
> I use git-submodule to keep track of repositories that I only
> infrequently commit to. I keep them to have a set that is known to work.
>
> git submodule update is annoying, as it (in my case needlessly) detaches the
> HEAD, making the workflow more complicated when I do have to commit (checkout
> master, rebase onto master, then commit).
>
> This patch adds a "--rebase" flag to git submodule update that calls
> git-rebase instead of git-checkout.
Maybe a non-first person version of this comment could go into the commit
message, too? I found this highly informative.
> diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
> index 3b8df44..117ad3d 100644
> --- a/Documentation/git-submodule.txt
> +++ b/Documentation/git-submodule.txt
> @@ -177,6 +178,12 @@ OPTIONS
> This option is only valid for the update command.
> Don't fetch new objects from the remote site.
>
> +--rebase::
> + This option is only valid for the update command.
This is unnecessary, it was mentioned in the synopsis.
> + Forward-port local commits to the index of the containing repository.
This is a bit misleading/unclear. I'd rather have it read like this:
Instead of detaching the HEAD to the revision committed in the
superproject, rebase the current branch onto that revision.
> + If a a merge failure prevents this process, you will have to resolve
> + these failures with linkgit:git-rebase[1].
> +
> <path>...::
> Paths to submodule(s). When specified this will restrict the command
> to only operate on the submodules found at the specified paths.
> diff --git a/git-submodule.sh b/git-submodule.sh
> index 7c2e060..6180bf4 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
You might want to error out when --rebase was passed with another command
than "update".
> @@ -367,11 +372,19 @@ cmd_update()
> die "Unable to fetch in submodule path '$path'"
> fi
>
> - (unset GIT_DIR; cd "$path" &&
> - git-checkout $force -q "$sha1") ||
> - die "Unable to checkout '$sha1' in submodule path '$path'"
> + if test -z "$rebase"
> + then
> + (unset GIT_DIR; cd "$path" &&
> + git-checkout $force -q "$sha1") ||
> + die "Unable to checkout '$sha1' in submodule path '$path'"
> + say "Submodule path '$path': checked out '$sha1'"
> + else
> + (unset GIT_DIR; cd "$path" &&
> + git-rebase "$sha1") ||
> + die "Unable to rebase onto '$sha1' in submodule path '$path'"
> + say "Submodule path '$path': rebased onto '$sha1'"
> + fi
I'd actually put the "(unset GIT_DIR; cd "$path" &&" in front of the "if"
due to the DRY principle (Don't Repeat Yourself).
In the same spirit, I'd set a variable "action" to "checkout" or "rebase
onto" and munge the error/info message to use $action.
Maybe you want to add a single primitive test case to make sure this
feature will not get broken in the future?
Other than that: nice! very nice!
Ciao,
Dscho
P.S.: the next patch is obvious, too: add support to specify desire to
rebase the submodule in .gitmodules and .git/config.
next prev parent reply other threads:[~2009-04-07 12:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-07 11:14 [RFC/PATCH] git-submodule: add support for --rebase Peter Hutterer
2009-04-07 12:38 ` Johannes Schindelin [this message]
2009-04-08 4:22 ` Peter Hutterer
2009-04-08 10:44 ` Johannes Schindelin
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=alpine.DEB.1.00.0904071428350.6897@intel-tinevez-2-302 \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=peter.hutterer@who-t.net \
/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).