* Re: What's cooking in git.git (May 2009, #04; Sun, 31)
2009-06-01 1:24 What's cooking in git.git (May 2009, #04; Sun, 31) Junio C Hamano
@ 2009-06-01 16:05 ` Brandon Casey
2009-06-02 22:59 ` [PATCH 0/2] "git submodule update" enhancements (Was: What's cooking in git.git (May 2009, #04; Sun, 31)) Johan Herland
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Brandon Casey @ 2009-06-01 16:05 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano wrote:
> Here are the topics that have been cooking. Commits prefixed with '-' are
> only in 'pu' while commits prefixed with '+' are in 'next'. The ones
> marked with '.' do not appear in any of the branches, but I am still
> holding onto them.
>
> The topics list the commits in reverse chronological order. The topics
> meant to be merged to the maintenance series have "maint-" in their names.
>
> ----------------------------------------------------------------
> [New Topics]
>
> All of these are soon to be in 'next'.
>
> * bc/solaris (Wed May 27 21:17:08 2009 -0500) 4 commits
> - Makefile: introduce SANE_TOOL_PATH for prepending required
> elements to PATH
> - Makefile: add section for SunOS 5.7
> - Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile
> arguments
> - Makefile: use /usr/ucb/install on SunOS platforms rather than
> ginstall
If you haven't already merged this to 'next', then give me some time
and I'll resubmit a new series based on the feedback from you and
Jeff.
Jeff pointed out that HSTRERROR only has any effect when NO_IPV6 is
set. So, NEEDS_RESOLV is really only necessary on Solaris versions
which must set NO_IPV6.
You suggested changes to git-compat-util.h for handling compiling on
Solaris with/without c99 compiler.
The bottom patch that switches to /usr/ucb/install is fine as-is.
If the series is already applied, no big deal, I'll just work on top of that.
-brandon
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 0/2] "git submodule update" enhancements (Was: What's cooking in git.git (May 2009, #04; Sun, 31))
2009-06-01 1:24 What's cooking in git.git (May 2009, #04; Sun, 31) Junio C Hamano
2009-06-01 16:05 ` Brandon Casey
@ 2009-06-02 22:59 ` Johan Herland
2009-06-02 22:59 ` [PATCH 1/2] Rename submodule.<name>.rebase to submodule.<name>.update Johan Herland
2009-06-02 22:59 ` [PATCH 2/2] git-submodule: add support for --merge Johan Herland
3 siblings, 0 replies; 11+ messages in thread
From: Johan Herland @ 2009-06-02 22:59 UTC (permalink / raw)
To: gitster
Cc: git, Johannes.Schindelin, apenwarr, peter.hutterer,
markus.heidelberg, Johan Herland
> [Stalled and may need help and prodding to go forward]
>
> * ph/submodule-rebase (Fri Apr 24 09:06:38 2009 +1000) 1 commit
> + git-submodule: add support for --rebase.
>
> There was a discussion on --rebase vs --merge and needs for unified
> configuration variable handling for this patch...
Here is my previous patch, split in two, so as not to hold back the
introduction of "git submodule update --rebase": The first patch
changes the associated config variable from "submodule.<name>.rebase"
to "submodule.<name>.update", and the second patch introduces
"git submodule update --merge".
AFAIK, nobody objects to the first patch, so that one should be safe
to apply.
As for the second patch, Dscho has argued against it, although he
has not yet responded to my last email from a week ago. Nobody
(except me) has explicitly supported the patch, although both Avery
and yourself has questioned Dscho's arguments.
Not sure what I can do to bring the discussion toward a conclusion...
...Johan
Johan Herland (2):
Rename submodule.<name>.rebase to submodule.<name>.update
git-submodule: add support for --merge.
Documentation/git-submodule.txt | 19 ++++++++--
Documentation/gitmodules.txt | 12 +++++-
git-submodule.sh | 43 ++++++++++++++--------
t/t7406-submodule-update.sh | 76 ++++++++++++++++++++++++++++++++++-----
4 files changed, 119 insertions(+), 31 deletions(-)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/2] Rename submodule.<name>.rebase to submodule.<name>.update
2009-06-01 1:24 What's cooking in git.git (May 2009, #04; Sun, 31) Junio C Hamano
2009-06-01 16:05 ` Brandon Casey
2009-06-02 22:59 ` [PATCH 0/2] "git submodule update" enhancements (Was: What's cooking in git.git (May 2009, #04; Sun, 31)) Johan Herland
@ 2009-06-02 22:59 ` Johan Herland
2009-06-03 0:15 ` Peter Hutterer
2009-06-03 4:15 ` Markus Heidelberg
2009-06-02 22:59 ` [PATCH 2/2] git-submodule: add support for --merge Johan Herland
3 siblings, 2 replies; 11+ messages in thread
From: Johan Herland @ 2009-06-02 22:59 UTC (permalink / raw)
To: gitster
Cc: git, Johannes.Schindelin, apenwarr, peter.hutterer,
markus.heidelberg, Johan Herland
The addition of "submodule.<name>.rebase" demonstrates the usefulness of
alternatives to the default behaviour of "git submodule update". However,
by naming the config variable "submodule.<name>.rebase", and making it a
boolean choice, we are artificially constraining future git versions that
may want to add _more_ alternatives than just "rebase".
Therefore, while "submodule.<name>.rebase" are not yet in a stable git
release, future-proof it, by changing it from
submodule.<name>.rebase = true/false
to
submodule.<name>.update = checkout/rebase
where "checkout" specifies the default behaviour of "git submodule update"
(checking out the new commit to a detached HEAD), and "rebase" specifies
the --rebase behaviour (where the current local branch in the submodule is
rebase onto the new commit). Thus .update == checkout is .rebase == false,
and .update == rebase is equivalent to .rebase == false. Finally, leaving
.update unset is equivalent to leaving .rebase unset.
In future git versions, other alternatives to "git submodule update"
behaviour can be included by adding them to the list of allowable values
for the submodule.<name>.update variable.
Signed-off-by: Johan Herland <johan@herland.net>
---
Documentation/git-submodule.txt | 4 ++--
Documentation/gitmodules.txt | 10 ++++++++--
git-submodule.sh | 32 +++++++++++++++++---------------
t/t7406-submodule-update.sh | 16 ++++++++--------
4 files changed, 35 insertions(+), 27 deletions(-)
diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index acd16ac..cd8e861 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -116,7 +116,7 @@ update::
Update the registered submodules, i.e. clone missing submodules and
checkout the commit specified in the index of the containing repository.
This will make the submodules HEAD be detached unless '--rebase' is
- specified or the key `submodule.$name.rebase` is set to `true`.
+ specified or the key `submodule.$name.update` is set to `rebase`.
+
If the submodule is not yet initialized, and you just want to use the
setting as stored in .gitmodules, you can automatically initialize the
@@ -186,7 +186,7 @@ OPTIONS
superproject. If this option is given, the submodule's HEAD will not
be detached. If a a merge failure prevents this process, you will have
to resolve these failures with linkgit:git-rebase[1].
- If the key `submodule.$name.rebase` is set to `true`, this option is
+ If the key `submodule.$name.update` is set to `rebase`, this option is
implicit.
--reference <repository>::
diff --git a/Documentation/gitmodules.txt b/Documentation/gitmodules.txt
index 7c22c40..1b67f0a 100644
--- a/Documentation/gitmodules.txt
+++ b/Documentation/gitmodules.txt
@@ -30,8 +30,14 @@ submodule.<name>.path::
submodule.<name>.url::
Defines an url from where the submodule repository can be cloned.
-submodule.<name>.rebase::
- Defines that the submodule should be rebased by default.
+submodule.<name>.update::
+ Defines what to do when the submodule is updated by the superproject.
+ If 'checkout' (the default), the new commit specified in the
+ superproject will be checked out in the submodule on a detached HEAD.
+ If 'rebase', the current branch of the submodule will be rebased onto
+ the commit specified in the superproject.
+ This config option is overridden if 'git submodule update' is given
+ the '--rebase' option.
EXAMPLES
diff --git a/git-submodule.sh b/git-submodule.sh
index bbca183..19a3a84 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -18,7 +18,7 @@ quiet=
reference=
cached=
nofetch=
-rebase=
+update=
#
# print stuff on stdout unless -q was specified
@@ -311,10 +311,10 @@ cmd_init()
git config submodule."$name".url "$url" ||
die "Failed to register url for submodule path '$path'"
- test true != "$(git config -f .gitmodules --bool \
- submodule."$name".rebase)" ||
- git config submodule."$name".rebase true ||
- die "Failed to register submodule path '$path' as rebasing"
+ upd="$(git config -f .gitmodules submodule."$name".update)"
+ test -z "$upd" ||
+ git config submodule."$name".update "$upd" ||
+ die "Failed to register update mode for submodule path '$path'"
say "Submodule '$name' ($url) registered for path '$path'"
done
@@ -345,7 +345,7 @@ cmd_update()
;;
-r|--rebase)
shift
- rebase=true
+ update="rebase"
;;
--reference)
case "$2" in '') usage ;; esac
@@ -379,7 +379,7 @@ cmd_update()
do
name=$(module_name "$path") || exit
url=$(git config submodule."$name".url)
- rebase_module=$(git config --bool submodule."$name".rebase)
+ update_module=$(git config submodule."$name".update)
if test -z "$url"
then
# Only mention uninitialized submodules when its
@@ -400,9 +400,9 @@ cmd_update()
die "Unable to find current revision in submodule path '$path'"
fi
- if test true = "$rebase"
+ if ! test -z "$update"
then
- rebase_module=true
+ update_module=$update
fi
if test "$subsha1" != "$sha1"
@@ -420,16 +420,18 @@ cmd_update()
die "Unable to fetch in submodule path '$path'"
fi
- if test true = "$rebase_module"
- then
- command="git-rebase"
+ case "$update_module" in
+ rebase)
+ command="git rebase"
action="rebase"
msg="rebased onto"
- else
- command="git-checkout $force -q"
+ ;;
+ *)
+ command="git checkout $force -q"
action="checkout"
msg="checked out"
- fi
+ ;;
+ esac
(unset GIT_DIR; cd "$path" && $command "$sha1") ||
die "Unable to $action '$sha1' in submodule path '$path'"
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 3442c05..0773fe4 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -76,9 +76,9 @@ test_expect_success 'submodule update --rebase staying on master' '
)
'
-test_expect_success 'submodule update - rebase true in .git/config' '
+test_expect_success 'submodule update - rebase in .git/config' '
(cd super &&
- git config submodule.submodule.rebase true
+ git config submodule.submodule.update rebase
) &&
(cd super/submodule &&
git reset --hard HEAD~1
@@ -93,9 +93,9 @@ test_expect_success 'submodule update - rebase true in .git/config' '
)
'
-test_expect_success 'submodule update - rebase false in .git/config but --rebase given' '
+test_expect_success 'submodule update - checkout in .git/config but --rebase given' '
(cd super &&
- git config submodule.submodule.rebase false
+ git config submodule.submodule.update checkout
) &&
(cd super/submodule &&
git reset --hard HEAD~1
@@ -110,9 +110,9 @@ test_expect_success 'submodule update - rebase false in .git/config but --rebase
)
'
-test_expect_success 'submodule update - rebase false in .git/config' '
+test_expect_success 'submodule update - checkout in .git/config' '
(cd super &&
- git config submodule.submodule.rebase false
+ git config submodule.submodule.update checkout
) &&
(cd super/submodule &&
git reset --hard HEAD^
@@ -131,9 +131,9 @@ test_expect_success 'submodule init picks up rebase' '
(cd super &&
git config submodule.rebasing.url git://non-existing/git &&
git config submodule.rebasing.path does-not-matter &&
- git config submodule.rebasing.rebase true &&
+ git config submodule.rebasing.update rebase &&
git submodule init rebasing &&
- test true = $(git config --bool submodule.rebasing.rebase)
+ test "rebase" = $(git config submodule.rebasing.update)
)
'
--
1.6.3.rc0.1.gf800
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] Rename submodule.<name>.rebase to submodule.<name>.update
2009-06-02 22:59 ` [PATCH 1/2] Rename submodule.<name>.rebase to submodule.<name>.update Johan Herland
@ 2009-06-03 0:15 ` Peter Hutterer
2009-06-03 2:33 ` Junio C Hamano
2009-06-03 4:15 ` Markus Heidelberg
1 sibling, 1 reply; 11+ messages in thread
From: Peter Hutterer @ 2009-06-03 0:15 UTC (permalink / raw)
To: Johan Herland
Cc: gitster, git, Johannes.Schindelin, apenwarr, markus.heidelberg
On Wed, Jun 03, 2009 at 12:59:11AM +0200, Johan Herland wrote:
> The addition of "submodule.<name>.rebase" demonstrates the usefulness of
> alternatives to the default behaviour of "git submodule update". However,
> by naming the config variable "submodule.<name>.rebase", and making it a
> boolean choice, we are artificially constraining future git versions that
> may want to add _more_ alternatives than just "rebase".
>
> Therefore, while "submodule.<name>.rebase" are not yet in a stable git
> release, future-proof it, by changing it from
>
> submodule.<name>.rebase = true/false
>
> to
>
> submodule.<name>.update = checkout/rebase
>
> where "checkout" specifies the default behaviour of "git submodule update"
> (checking out the new commit to a detached HEAD), and "rebase" specifies
> the --rebase behaviour (where the current local branch in the submodule is
> rebase onto the new commit). Thus .update == checkout is .rebase == false,
> and .update == rebase is equivalent to .rebase == false. Finally, leaving
> .update unset is equivalent to leaving .rebase unset.
>
> In future git versions, other alternatives to "git submodule update"
> behaviour can be included by adding them to the list of allowable values
> for the submodule.<name>.update variable.
>
> Signed-off-by: Johan Herland <johan@herland.net>
> ---
> Documentation/git-submodule.txt | 4 ++--
> Documentation/gitmodules.txt | 10 ++++++++--
> git-submodule.sh | 32 +++++++++++++++++---------------
> t/t7406-submodule-update.sh | 16 ++++++++--------
> 4 files changed, 35 insertions(+), 27 deletions(-)
>
> diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
> index acd16ac..cd8e861 100644
> --- a/Documentation/git-submodule.txt
> +++ b/Documentation/git-submodule.txt
> @@ -116,7 +116,7 @@ update::
> Update the registered submodules, i.e. clone missing submodules and
> checkout the commit specified in the index of the containing repository.
> This will make the submodules HEAD be detached unless '--rebase' is
> - specified or the key `submodule.$name.rebase` is set to `true`.
> + specified or the key `submodule.$name.update` is set to `rebase`.
> +
> If the submodule is not yet initialized, and you just want to use the
> setting as stored in .gitmodules, you can automatically initialize the
> @@ -186,7 +186,7 @@ OPTIONS
> superproject. If this option is given, the submodule's HEAD will not
> be detached. If a a merge failure prevents this process, you will have
> to resolve these failures with linkgit:git-rebase[1].
> - If the key `submodule.$name.rebase` is set to `true`, this option is
> + If the key `submodule.$name.update` is set to `rebase`, this option is
> implicit.
>
> --reference <repository>::
> diff --git a/Documentation/gitmodules.txt b/Documentation/gitmodules.txt
> index 7c22c40..1b67f0a 100644
> --- a/Documentation/gitmodules.txt
> +++ b/Documentation/gitmodules.txt
> @@ -30,8 +30,14 @@ submodule.<name>.path::
> submodule.<name>.url::
> Defines an url from where the submodule repository can be cloned.
>
> -submodule.<name>.rebase::
> - Defines that the submodule should be rebased by default.
> +submodule.<name>.update::
> + Defines what to do when the submodule is updated by the superproject.
> + If 'checkout' (the default), the new commit specified in the
> + superproject will be checked out in the submodule on a detached HEAD.
> + If 'rebase', the current branch of the submodule will be rebased onto
> + the commit specified in the superproject.
> + This config option is overridden if 'git submodule update' is given
> + the '--rebase' option.
>
>
> EXAMPLES
> diff --git a/git-submodule.sh b/git-submodule.sh
> index bbca183..19a3a84 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -18,7 +18,7 @@ quiet=
> reference=
> cached=
> nofetch=
> -rebase=
> +update=
>
> #
> # print stuff on stdout unless -q was specified
> @@ -311,10 +311,10 @@ cmd_init()
> git config submodule."$name".url "$url" ||
> die "Failed to register url for submodule path '$path'"
>
> - test true != "$(git config -f .gitmodules --bool \
> - submodule."$name".rebase)" ||
> - git config submodule."$name".rebase true ||
> - die "Failed to register submodule path '$path' as rebasing"
> + upd="$(git config -f .gitmodules submodule."$name".update)"
> + test -z "$upd" ||
> + git config submodule."$name".update "$upd" ||
> + die "Failed to register update mode for submodule path '$path'"
>
> say "Submodule '$name' ($url) registered for path '$path'"
> done
> @@ -345,7 +345,7 @@ cmd_update()
> ;;
> -r|--rebase)
> shift
> - rebase=true
> + update="rebase"
> ;;
> --reference)
> case "$2" in '') usage ;; esac
> @@ -379,7 +379,7 @@ cmd_update()
> do
> name=$(module_name "$path") || exit
> url=$(git config submodule."$name".url)
> - rebase_module=$(git config --bool submodule."$name".rebase)
> + update_module=$(git config submodule."$name".update)
> if test -z "$url"
> then
> # Only mention uninitialized submodules when its
> @@ -400,9 +400,9 @@ cmd_update()
> die "Unable to find current revision in submodule path '$path'"
> fi
>
> - if test true = "$rebase"
> + if ! test -z "$update"
> then
> - rebase_module=true
> + update_module=$update
> fi
>
> if test "$subsha1" != "$sha1"
> @@ -420,16 +420,18 @@ cmd_update()
> die "Unable to fetch in submodule path '$path'"
> fi
>
> - if test true = "$rebase_module"
> - then
> - command="git-rebase"
> + case "$update_module" in
> + rebase)
> + command="git rebase"
> action="rebase"
> msg="rebased onto"
> - else
> - command="git-checkout $force -q"
> + ;;
> + *)
> + command="git checkout $force -q"
> action="checkout"
> msg="checked out"
> - fi
> + ;;
> + esac
>
> (unset GIT_DIR; cd "$path" && $command "$sha1") ||
> die "Unable to $action '$sha1' in submodule path '$path'"
> diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
> index 3442c05..0773fe4 100755
> --- a/t/t7406-submodule-update.sh
> +++ b/t/t7406-submodule-update.sh
> @@ -76,9 +76,9 @@ test_expect_success 'submodule update --rebase staying on master' '
> )
> '
>
> -test_expect_success 'submodule update - rebase true in .git/config' '
> +test_expect_success 'submodule update - rebase in .git/config' '
> (cd super &&
> - git config submodule.submodule.rebase true
> + git config submodule.submodule.update rebase
> ) &&
> (cd super/submodule &&
> git reset --hard HEAD~1
> @@ -93,9 +93,9 @@ test_expect_success 'submodule update - rebase true in .git/config' '
> )
> '
>
> -test_expect_success 'submodule update - rebase false in .git/config but --rebase given' '
> +test_expect_success 'submodule update - checkout in .git/config but --rebase given' '
> (cd super &&
> - git config submodule.submodule.rebase false
> + git config submodule.submodule.update checkout
> ) &&
> (cd super/submodule &&
> git reset --hard HEAD~1
> @@ -110,9 +110,9 @@ test_expect_success 'submodule update - rebase false in .git/config but --rebase
> )
> '
>
> -test_expect_success 'submodule update - rebase false in .git/config' '
> +test_expect_success 'submodule update - checkout in .git/config' '
> (cd super &&
> - git config submodule.submodule.rebase false
> + git config submodule.submodule.update checkout
> ) &&
> (cd super/submodule &&
> git reset --hard HEAD^
> @@ -131,9 +131,9 @@ test_expect_success 'submodule init picks up rebase' '
> (cd super &&
> git config submodule.rebasing.url git://non-existing/git &&
> git config submodule.rebasing.path does-not-matter &&
> - git config submodule.rebasing.rebase true &&
> + git config submodule.rebasing.update rebase &&
> git submodule init rebasing &&
> - test true = $(git config --bool submodule.rebasing.rebase)
> + test "rebase" = $(git config submodule.rebasing.update)
> )
> '
>
> --
> 1.6.3.rc0.1.gf800
I noticed this patch still leaves the --rebase commandline flag. Shouldn't
that be changed to --update=rebase for consistency?
Cheers,
Peter
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] Rename submodule.<name>.rebase to submodule.<name>.update
2009-06-03 0:15 ` Peter Hutterer
@ 2009-06-03 2:33 ` Junio C Hamano
2009-06-03 6:46 ` Johan Herland
0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2009-06-03 2:33 UTC (permalink / raw)
To: Peter Hutterer
Cc: Johan Herland, git, Johannes.Schindelin, apenwarr,
markus.heidelberg
Peter Hutterer <peter.hutterer@who-t.net> writes:
> On Wed, Jun 03, 2009 at 12:59:11AM +0200, Johan Herland wrote:
> ...
>> diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
>> index acd16ac..cd8e861 100644
>> --- a/Documentation/git-submodule.txt
>> +++ b/Documentation/git-submodule.txt
>> @@ -116,7 +116,7 @@ update::
>> Update the registered submodules, i.e. clone missing submodules and
>> checkout the commit specified in the index of the containing repository.
>> This will make the submodules HEAD be detached unless '--rebase' is
>> - specified or the key `submodule.$name.rebase` is set to `true`.
>> + specified or the key `submodule.$name.update` is set to `rebase`.
>> +
>> If the submodule is not yet initialized, and you just want to use the
>> setting as stored in .gitmodules, you can automatically initialize the
> ...
> I noticed this patch still leaves the --rebase commandline flag. Shouldn't
> that be changed to --update=rebase for consistency?
If we were to add many more (I think --update=merge was mentioned, but do
we have any other plausibly useful modes of operations?) options, it would
make sense to support --update=rebase; my impression from the previous
discussion was that rebase would make sense for more people than other
modes would, so it also would make sense to keep --rebase as a shorthand,
rather than forcing everybody to say --update=rebase for the sake of
consistency.
You did not have to quote the whole patch to say what you wanted to say,
by the way.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] Rename submodule.<name>.rebase to submodule.<name>.update
2009-06-03 2:33 ` Junio C Hamano
@ 2009-06-03 6:46 ` Johan Herland
0 siblings, 0 replies; 11+ messages in thread
From: Johan Herland @ 2009-06-03 6:46 UTC (permalink / raw)
To: Junio C Hamano
Cc: Peter Hutterer, git, Johannes.Schindelin, apenwarr,
markus.heidelberg
On Wednesday 03 June 2009, Junio C Hamano wrote:
> Peter Hutterer <peter.hutterer@who-t.net> writes:
> > I noticed this patch still leaves the --rebase commandline flag.
> > Shouldn't that be changed to --update=rebase for consistency?
>
> If we were to add many more (I think --update=merge was mentioned, but do
> we have any other plausibly useful modes of operations?) options, it
> would make sense to support --update=rebase; my impression from the
> previous discussion was that rebase would make sense for more people than
> other modes would, so it also would make sense to keep --rebase as a
> shorthand, rather than forcing everybody to say --update=rebase for the
> sake of consistency.
I agree. Even if we had a hundred alternatives, the most common should be
available in shorthand form.
Also, I don't think it makes sense to introduce --update=foo until we have,
say, 3-4 different alternatives. As long as --rebase and --merge are the
only alternatives (no other alternatives have been suggested so far, AFAIK),
I don't think we need to introduce --update=foo.
Have fun! :)
...Johan
--
Johan Herland, <johan@herland.net>
www.herland.net
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] Rename submodule.<name>.rebase to submodule.<name>.update
2009-06-02 22:59 ` [PATCH 1/2] Rename submodule.<name>.rebase to submodule.<name>.update Johan Herland
2009-06-03 0:15 ` Peter Hutterer
@ 2009-06-03 4:15 ` Markus Heidelberg
2009-06-03 6:20 ` Johan Herland
1 sibling, 1 reply; 11+ messages in thread
From: Markus Heidelberg @ 2009-06-03 4:15 UTC (permalink / raw)
To: Johan Herland; +Cc: gitster, git, Johannes.Schindelin, apenwarr, peter.hutterer
Johan Herland, 03.06.2009:
> The addition of "submodule.<name>.rebase" demonstrates the usefulness of
> alternatives to the default behaviour of "git submodule update". However,
> by naming the config variable "submodule.<name>.rebase", and making it a
> boolean choice, we are artificially constraining future git versions that
> may want to add _more_ alternatives than just "rebase".
>
> Therefore, while "submodule.<name>.rebase" are not yet in a stable git
> release, future-proof it, by changing it from
>
> submodule.<name>.rebase = true/false
>
> to
>
> submodule.<name>.update = checkout/rebase
>
> where "checkout" specifies the default behaviour of "git submodule update"
> (checking out the new commit to a detached HEAD), and "rebase" specifies
> the --rebase behaviour (where the current local branch in the submodule is
> rebase onto the new commit). Thus .update == checkout is .rebase == false,
> and .update == rebase is equivalent to .rebase == false. Finally, leaving
^^^^^
.rebase == true
> diff --git a/git-submodule.sh b/git-submodule.sh
> @@ -400,9 +400,9 @@ cmd_update()
> die "Unable to find current revision in submodule path '$path'"
> fi
>
> - if test true = "$rebase"
> + if ! test -z "$update"
Isn't this simpler: if test -n "$update"
OTOH I think I have heard something about portability, but I'm not sure.
> @@ -420,16 +420,18 @@ cmd_update()
> die "Unable to fetch in submodule path '$path'"
> fi
>
> - if test true = "$rebase_module"
> - then
> - command="git-rebase"
> + case "$update_module" in
> + rebase)
> + command="git rebase"
I think it is common practice to use the dashed form in scripts and this
patch shouldn't change it anyway.
> action="rebase"
> msg="rebased onto"
> - else
> - command="git-checkout $force -q"
> + ;;
> + *)
> + command="git checkout $force -q"
ditto
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 1/2] Rename submodule.<name>.rebase to submodule.<name>.update
2009-06-03 4:15 ` Markus Heidelberg
@ 2009-06-03 6:20 ` Johan Herland
2009-06-03 6:27 ` [PATCH 1/2 v2] " Johan Herland
0 siblings, 1 reply; 11+ messages in thread
From: Johan Herland @ 2009-06-03 6:20 UTC (permalink / raw)
To: markus.heidelberg
Cc: gitster, git, Johannes.Schindelin, apenwarr, peter.hutterer
Hi,
Thanks for the feedback. Really appreciated!
On Wednesday 03 June 2009, Markus Heidelberg wrote:
> Johan Herland, 03.06.2009:
> > Therefore, while "submodule.<name>.rebase" are not yet in a stable git
> > release, future-proof it, by changing it from
> >
> > submodule.<name>.rebase = true/false
> >
> > to
> >
> > submodule.<name>.update = checkout/rebase
> >
> > where "checkout" specifies the default behaviour of "git submodule
> > update" (checking out the new commit to a detached HEAD), and "rebase"
> > specifies the --rebase behaviour (where the current local branch in the
> > submodule is rebase onto the new commit). Thus .update == checkout is
> > .rebase == false, and .update == rebase is equivalent to .rebase ==
> > false. Finally, leaving
> ^^^^^
> .rebase == true
Indeed. Thanks.
> > diff --git a/git-submodule.sh b/git-submodule.sh
> > @@ -400,9 +400,9 @@ cmd_update()
> > die "Unable to find current revision in submodule path '$path'"
> > fi
> >
> > - if test true = "$rebase"
> > + if ! test -z "$update"
>
> Isn't this simpler: if test -n "$update"
> OTOH I think I have heard something about portability, but I'm not sure.
Yes, "test -n" is simpler than "! test -z", but at an earlier occasion I was
told that "test -n" is not as portable as "test -z"...
> > @@ -420,16 +420,18 @@ cmd_update()
> > die "Unable to fetch in submodule path '$path'"
> > fi
> >
> > - if test true = "$rebase_module"
> > - then
> > - command="git-rebase"
> > + case "$update_module" in
> > + rebase)
> > + command="git rebase"
>
> I think it is common practice to use the dashed form in scripts and this
> patch shouldn't change it anyway.
I thought we were moving away from the dashed form altogether, both in
scripts and in examples. Junio, is there an "official" position?
> > action="rebase"
> > msg="rebased onto"
> > - else
> > - command="git-checkout $force -q"
> > + ;;
> > + *)
> > + command="git checkout $force -q"
>
> ditto
Thanks for your comments, I'll send an updated patch.
Have fun! :)
...Johan
--
Johan Herland, <johan@herland.net>
www.herland.net
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/2 v2] Rename submodule.<name>.rebase to submodule.<name>.update
2009-06-03 6:20 ` Johan Herland
@ 2009-06-03 6:27 ` Johan Herland
0 siblings, 0 replies; 11+ messages in thread
From: Johan Herland @ 2009-06-03 6:27 UTC (permalink / raw)
To: markus.heidelberg
Cc: =gitster, git, Johannes.Schindelin, apenwarr, peter.hutterer,
Johan Herland
The addition of "submodule.<name>.rebase" demonstrates the usefulness of
alternatives to the default behaviour of "git submodule update". However,
by naming the config variable "submodule.<name>.rebase", and making it a
boolean choice, we are artificially constraining future git versions that
may want to add _more_ alternatives than just "rebase".
Therefore, while "submodule.<name>.rebase" is not yet in a stable git
release, future-proof it, by changing it from
submodule.<name>.rebase = true/false
to
submodule.<name>.update = rebase/checkout
where "checkout" specifies the default behaviour of "git submodule update"
(checking out the new commit to a detached HEAD), and "rebase" specifies
the --rebase behaviour (where the current local branch in the submodule is
rebase onto the new commit). Thus .update == checkout is equivalent to
.rebase == false, and .update == rebase is equivalent to .rebase == true.
Finally, leaving .update unset is equivalent to leaving .rebase unset.
In future git versions, other alternatives to "git submodule update"
behaviour can be included by adding them to the list of allowable values
for the submodule.<name>.update variable.
Signed-off-by: Johan Herland <johan@herland.net>
---
Documentation/git-submodule.txt | 4 ++--
Documentation/gitmodules.txt | 10 ++++++++--
git-submodule.sh | 32 +++++++++++++++++---------------
t/t7406-submodule-update.sh | 16 ++++++++--------
4 files changed, 35 insertions(+), 27 deletions(-)
diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index acd16ac..cd8e861 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -116,7 +116,7 @@ update::
Update the registered submodules, i.e. clone missing submodules and
checkout the commit specified in the index of the containing repository.
This will make the submodules HEAD be detached unless '--rebase' is
- specified or the key `submodule.$name.rebase` is set to `true`.
+ specified or the key `submodule.$name.update` is set to `rebase`.
+
If the submodule is not yet initialized, and you just want to use the
setting as stored in .gitmodules, you can automatically initialize the
@@ -186,7 +186,7 @@ OPTIONS
superproject. If this option is given, the submodule's HEAD will not
be detached. If a a merge failure prevents this process, you will have
to resolve these failures with linkgit:git-rebase[1].
- If the key `submodule.$name.rebase` is set to `true`, this option is
+ If the key `submodule.$name.update` is set to `rebase`, this option is
implicit.
--reference <repository>::
diff --git a/Documentation/gitmodules.txt b/Documentation/gitmodules.txt
index 7c22c40..1b67f0a 100644
--- a/Documentation/gitmodules.txt
+++ b/Documentation/gitmodules.txt
@@ -30,8 +30,14 @@ submodule.<name>.path::
submodule.<name>.url::
Defines an url from where the submodule repository can be cloned.
-submodule.<name>.rebase::
- Defines that the submodule should be rebased by default.
+submodule.<name>.update::
+ Defines what to do when the submodule is updated by the superproject.
+ If 'checkout' (the default), the new commit specified in the
+ superproject will be checked out in the submodule on a detached HEAD.
+ If 'rebase', the current branch of the submodule will be rebased onto
+ the commit specified in the superproject.
+ This config option is overridden if 'git submodule update' is given
+ the '--rebase' option.
EXAMPLES
diff --git a/git-submodule.sh b/git-submodule.sh
index bbca183..19a3a84 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -18,7 +18,7 @@ quiet=
reference=
cached=
nofetch=
-rebase=
+update=
#
# print stuff on stdout unless -q was specified
@@ -311,10 +311,10 @@ cmd_init()
git config submodule."$name".url "$url" ||
die "Failed to register url for submodule path '$path'"
- test true != "$(git config -f .gitmodules --bool \
- submodule."$name".rebase)" ||
- git config submodule."$name".rebase true ||
- die "Failed to register submodule path '$path' as rebasing"
+ upd="$(git config -f .gitmodules submodule."$name".update)"
+ test -z "$upd" ||
+ git config submodule."$name".update "$upd" ||
+ die "Failed to register update mode for submodule path '$path'"
say "Submodule '$name' ($url) registered for path '$path'"
done
@@ -345,7 +345,7 @@ cmd_update()
;;
-r|--rebase)
shift
- rebase=true
+ update="rebase"
;;
--reference)
case "$2" in '') usage ;; esac
@@ -379,7 +379,7 @@ cmd_update()
do
name=$(module_name "$path") || exit
url=$(git config submodule."$name".url)
- rebase_module=$(git config --bool submodule."$name".rebase)
+ update_module=$(git config submodule."$name".update)
if test -z "$url"
then
# Only mention uninitialized submodules when its
@@ -400,9 +400,9 @@ cmd_update()
die "Unable to find current revision in submodule path '$path'"
fi
- if test true = "$rebase"
+ if ! test -z "$update"
then
- rebase_module=true
+ update_module=$update
fi
if test "$subsha1" != "$sha1"
@@ -420,16 +420,18 @@ cmd_update()
die "Unable to fetch in submodule path '$path'"
fi
- if test true = "$rebase_module"
- then
- command="git-rebase"
+ case "$update_module" in
+ rebase)
+ command="git rebase"
action="rebase"
msg="rebased onto"
- else
- command="git-checkout $force -q"
+ ;;
+ *)
+ command="git checkout $force -q"
action="checkout"
msg="checked out"
- fi
+ ;;
+ esac
(unset GIT_DIR; cd "$path" && $command "$sha1") ||
die "Unable to $action '$sha1' in submodule path '$path'"
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 3442c05..0773fe4 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -76,9 +76,9 @@ test_expect_success 'submodule update --rebase staying on master' '
)
'
-test_expect_success 'submodule update - rebase true in .git/config' '
+test_expect_success 'submodule update - rebase in .git/config' '
(cd super &&
- git config submodule.submodule.rebase true
+ git config submodule.submodule.update rebase
) &&
(cd super/submodule &&
git reset --hard HEAD~1
@@ -93,9 +93,9 @@ test_expect_success 'submodule update - rebase true in .git/config' '
)
'
-test_expect_success 'submodule update - rebase false in .git/config but --rebase given' '
+test_expect_success 'submodule update - checkout in .git/config but --rebase given' '
(cd super &&
- git config submodule.submodule.rebase false
+ git config submodule.submodule.update checkout
) &&
(cd super/submodule &&
git reset --hard HEAD~1
@@ -110,9 +110,9 @@ test_expect_success 'submodule update - rebase false in .git/config but --rebase
)
'
-test_expect_success 'submodule update - rebase false in .git/config' '
+test_expect_success 'submodule update - checkout in .git/config' '
(cd super &&
- git config submodule.submodule.rebase false
+ git config submodule.submodule.update checkout
) &&
(cd super/submodule &&
git reset --hard HEAD^
@@ -131,9 +131,9 @@ test_expect_success 'submodule init picks up rebase' '
(cd super &&
git config submodule.rebasing.url git://non-existing/git &&
git config submodule.rebasing.path does-not-matter &&
- git config submodule.rebasing.rebase true &&
+ git config submodule.rebasing.update rebase &&
git submodule init rebasing &&
- test true = $(git config --bool submodule.rebasing.rebase)
+ test "rebase" = $(git config submodule.rebasing.update)
)
'
--
1.6.3.rc0.1.gf800
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/2] git-submodule: add support for --merge.
2009-06-01 1:24 What's cooking in git.git (May 2009, #04; Sun, 31) Junio C Hamano
` (2 preceding siblings ...)
2009-06-02 22:59 ` [PATCH 1/2] Rename submodule.<name>.rebase to submodule.<name>.update Johan Herland
@ 2009-06-02 22:59 ` Johan Herland
3 siblings, 0 replies; 11+ messages in thread
From: Johan Herland @ 2009-06-02 22:59 UTC (permalink / raw)
To: gitster
Cc: git, Johannes.Schindelin, apenwarr, peter.hutterer,
markus.heidelberg, Johan Herland
'git submodule update --merge' merges the commit referenced by the
superproject into your local branch, instead of checking it out on
a detached HEAD.
As evidenced by the addition of "git submodule update --rebase", it
is useful to provide alternatives to the default 'checkout' behaviour
of "git submodule update". One such alternative is, when updating a
submodule to a new commit, to merge that commit into the current
local branch in that submodule. This is useful in workflows where
you want to update your submodule from its upstream, but you cannot
use --rebase, because you have downstream people working on top of
your submodule branch, and you don't want to disrupt their work.
Signed-off-by: Johan Herland <johan@herland.net>
---
Documentation/git-submodule.txt | 17 +++++++++--
Documentation/gitmodules.txt | 6 ++-
git-submodule.sh | 11 ++++++-
t/t7406-submodule-update.sh | 60 ++++++++++++++++++++++++++++++++++++++-
4 files changed, 87 insertions(+), 7 deletions(-)
diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index cd8e861..1cbb181 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -13,7 +13,7 @@ SYNOPSIS
[--reference <repository>] [--] <repository> <path>
'git submodule' [--quiet] status [--cached] [--] [<path>...]
'git submodule' [--quiet] init [--] [<path>...]
-'git submodule' [--quiet] update [--init] [-N|--no-fetch] [--rebase]
+'git submodule' [--quiet] update [--init] [-N|--no-fetch] [--rebase|--merge]
[--reference <repository>] [--] [<path>...]
'git submodule' [--quiet] summary [--summary-limit <n>] [commit] [--] [<path>...]
'git submodule' [--quiet] foreach <command>
@@ -115,8 +115,9 @@ init::
update::
Update the registered submodules, i.e. clone missing submodules and
checkout the commit specified in the index of the containing repository.
- This will make the submodules HEAD be detached unless '--rebase' is
- specified or the key `submodule.$name.update` is set to `rebase`.
+ This will make the submodules HEAD be detached unless '--rebase' or
+ '--merge' is specified or the key `submodule.$name.update` is set to
+ `rebase` or `merge`.
+
If the submodule is not yet initialized, and you just want to use the
setting as stored in .gitmodules, you can automatically initialize the
@@ -189,6 +190,16 @@ OPTIONS
If the key `submodule.$name.update` is set to `rebase`, this option is
implicit.
+--merge::
+ This option is only valid for the update command.
+ Merge the commit recorded in the superproject into the current branch
+ of the submodule. If this option is given, the submodule's HEAD will
+ not be detached. If a merge failure prevents this process, you will
+ have to resolve the resulting conflicts within the submodule with the
+ usual conflict resolution tools.
+ If the key `submodule.$name.update` is set to `merge`, this option is
+ implicit.
+
--reference <repository>::
This option is only valid for add and update commands. These
commands sometimes need to clone a remote repository. In this case,
diff --git a/Documentation/gitmodules.txt b/Documentation/gitmodules.txt
index 1b67f0a..5daf750 100644
--- a/Documentation/gitmodules.txt
+++ b/Documentation/gitmodules.txt
@@ -35,9 +35,11 @@ submodule.<name>.update::
If 'checkout' (the default), the new commit specified in the
superproject will be checked out in the submodule on a detached HEAD.
If 'rebase', the current branch of the submodule will be rebased onto
- the commit specified in the superproject.
+ the commit specified in the superproject. If 'merge', the commit
+ specified in the superproject will be merged into the current branch
+ in the submodule.
This config option is overridden if 'git submodule update' is given
- the '--rebase' option.
+ the '--merge' or '--rebase' options.
EXAMPLES
diff --git a/git-submodule.sh b/git-submodule.sh
index 19a3a84..2a1e73c 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -5,7 +5,7 @@
# Copyright (c) 2007 Lars Hjemli
USAGE="[--quiet] [--cached] \
-[add [-b branch] <repo> <path>]|[status|init|update [-i|--init] [-N|--no-fetch]|summary [-n|--summary-limit <n>] [<commit>]] \
+[add [-b branch] <repo> <path>]|[status|init|update [-i|--init] [-N|--no-fetch] [--rebase|--merge]|summary [-n|--summary-limit <n>] [<commit>]] \
[--] [<path>...]|[foreach <command>]|[sync [--] [<path>...]]"
OPTIONS_SPEC=
. git-sh-setup
@@ -347,6 +347,10 @@ cmd_update()
shift
update="rebase"
;;
+ -m|--merge)
+ shift
+ update="merge"
+ ;;
--reference)
case "$2" in '') usage ;; esac
reference="--reference=$2"
@@ -426,6 +430,11 @@ cmd_update()
action="rebase"
msg="rebased onto"
;;
+ merge)
+ command="git merge"
+ action="merge"
+ msg="merged in"
+ ;;
*)
command="git checkout $force -q"
action="checkout"
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 0773fe4..2d33d9e 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -6,7 +6,7 @@
test_description='Test updating submodules
This test verifies that "git submodule update" detaches the HEAD of the
-submodule and "git submodule update --rebase" does not detach the HEAD.
+submodule and "git submodule update --rebase/--merge" does not detach the HEAD.
'
. ./test-lib.sh
@@ -76,6 +76,20 @@ test_expect_success 'submodule update --rebase staying on master' '
)
'
+test_expect_success 'submodule update --merge staying on master' '
+ (cd super/submodule &&
+ git reset --hard HEAD~1
+ ) &&
+ (cd super &&
+ (cd submodule &&
+ compare_head
+ ) &&
+ git submodule update --merge submodule &&
+ cd submodule &&
+ compare_head
+ )
+'
+
test_expect_success 'submodule update - rebase in .git/config' '
(cd super &&
git config submodule.submodule.update rebase
@@ -110,6 +124,40 @@ test_expect_success 'submodule update - checkout in .git/config but --rebase giv
)
'
+test_expect_success 'submodule update - merge in .git/config' '
+ (cd super &&
+ git config submodule.submodule.update merge
+ ) &&
+ (cd super/submodule &&
+ git reset --hard HEAD~1
+ ) &&
+ (cd super &&
+ (cd submodule &&
+ compare_head
+ ) &&
+ git submodule update submodule &&
+ cd submodule &&
+ compare_head
+ )
+'
+
+test_expect_success 'submodule update - checkout in .git/config but --merge given' '
+ (cd super &&
+ git config submodule.submodule.update checkout
+ ) &&
+ (cd super/submodule &&
+ git reset --hard HEAD~1
+ ) &&
+ (cd super &&
+ (cd submodule &&
+ compare_head
+ ) &&
+ git submodule update --merge submodule &&
+ cd submodule &&
+ compare_head
+ )
+'
+
test_expect_success 'submodule update - checkout in .git/config' '
(cd super &&
git config submodule.submodule.update checkout
@@ -137,4 +185,14 @@ test_expect_success 'submodule init picks up rebase' '
)
'
+test_expect_success 'submodule init picks up merge' '
+ (cd super &&
+ git config submodule.merging.url git://non-existing/git &&
+ git config submodule.merging.path does-not-matter &&
+ git config submodule.merging.update merge &&
+ git submodule init merging &&
+ test "merge" = $(git config submodule.merging.update)
+ )
+'
+
test_done
--
1.6.3.rc0.1.gf800
^ permalink raw reply related [flat|nested] 11+ messages in thread