git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* What's cooking in git.git (May 2009, #04; Sun, 31)
@ 2009-06-01  1:24 Junio C Hamano
  2009-06-01 16:05 ` Brandon Casey
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Junio C Hamano @ 2009-06-01  1:24 UTC (permalink / raw)
  To: git

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

* nw/maint-cvsexportcommit (Fri May 29 00:23:33 2009 +0100) 1 commit
 - git-cvsexportcommit can't commit files which have been removed
   from CVS

* tr/maint-doc-stash-pop (Thu May 28 11:40:15 2009 +0200) 1 commit
 - Documentation: teach stash/pop workflow instead of stash/apply

* da/pretty-tempname (Sun May 31 01:35:52 2009 -0700) 3 commits
 - diff: generate pretty filenames in prep_temp_blob()
 - compat: add a basename() compatibility function
 - compat: add a mkstemps() compatibility function

* ak/maint-for-each-ref-no-lookup (Wed May 27 15:23:12 2009 -0400) 1 commit
 - for-each-ref: Do not lookup objects when they will not be used

* cb/match_refs_internal_tail (Wed May 27 22:13:44 2009 +0200) 1 commit
 - match_refs: search ref list tail internally

I need to replace this with the new iteration...

* gb/am-foreign (Wed May 27 11:25:19 2009 +0200) 4 commits
 - git-am: refactor 'cleaning up and aborting'
 - git-am foreign patch support: StGIT support
 - git-am foreign patch support: autodetect some patch formats
 - git-am foreign patch support: introduce patch_format

----------------------------------------------------------------
[Graduated to "master"]

* sb/opt-filename (Sat May 23 11:53:13 2009 -0700) 2 commits
 + parse-opts: add OPT_FILENAME and transition builtins
 + parse-opts: prepare for OPT_FILENAME

* rs/maint-grep-word-regexp-fix (Sat May 23 13:45:26 2009 +0200) 1 commit
 + grep: fix word-regexp at the beginning of lines

* mm/apply-double-slash (Thu May 21 14:25:11 2009 +0200) 1 commit
 + apply: handle filenames with double slashes better

* bc/old-iconv (Fri May 22 18:47:06 2009 -0500) 10 commits
 + t8005: convert CP1251 character set to ISO8859-5
 + t8005: use more portable character encoding names
 + t5100: use ancient encoding syntax for backwards compatibility
 + t9301: use ISO8859-1 rather than ISO-8859-1
 + t3901: Use ISO8859-1 instead of ISO-8859-1 for backward
   compatibility
 + t3901: avoid negation on right hand side of '|'
 + builtin-mailinfo.c: use "ISO8859-1" instead of "latin1" as
   fallback encoding
 + builtin-mailinfo.c: compare character encodings case insensitively
 + Use 'UTF-8' rather than 'utf-8' everywhere for backward
   compatibility
 + t3900: use ancient iconv names for backward compatibility

* sb/show-branch-parse-options (Thu May 21 00:33:18 2009 -0700) 3 commits
 + show-branch: migrate to parse-options API
 + Merge branch 'mh/show-branch-color' into sb/show-branch-parse-
   options
 + parse-options: add PARSE_OPT_LITERAL_ARGHELP for complicated
   argh's

* sb/maint-1.6.2-opt-filename-fix (Sat May 23 11:53:11 2009 -0700) 2 commits
 + apply, fmt-merge-msg: use relative filenames
 + commit: -F overrides -t

* jc/solaris-0811 (Fri May 22 22:55:31 2009 -0700) 2 commits
 - OpenSolaris 200811 (SunOS 5.11) does not want OLD_ICONV
 - Teach Solaris that _XOPEN_SOURCE=600 really menas XPG6

* mw/send-email (Mon Apr 13 13:23:52 2009 -0500) 6 commits
 + send-email: Remove superfluous `my $editor = ...'
 + send-email: 'References:' should only reference what is sent
 + send-email: Handle "GIT:" rather than "GIT: " during --compose
 + Docs: send-email: --smtp-server-port can take symbolic ports
 + Docs: send-email: Refer to CONFIGURATION section for
   sendemail.multiedit
 + Docs: send-email: Put options back into alphabetical order

* jc/mktree (Thu May 14 15:49:10 2009 -0700) 9 commits
 + mktree: validate entry type in input
 + mktree --batch: build more than one tree object
 + mktree --missing: updated usage message and man page
 + mktree --missing: allow missing objects
 + t1010: add mktree test
 + mktree: do not barf on a submodule commit
 + builtin-mktree.c: use a helper function to handle one line of
   input
 + mktree: use parse-options
 + build-in git-mktree

* jc/maint-add-p-coalesce-fix (Sat May 16 10:48:23 2009 -0700) 2 commits
 + Revert "git-add--interactive: remove hunk coalescing"
 + Splitting a hunk that adds a line at the top fails in "add -p"

* sb/format-patch-parseopt (Sat May 16 02:24:46 2009 -0700) 1 commit
 + format-patch: migrate to parse-options API

* cc/bisect (Sun May 17 17:36:46 2009 +0200) 3 commits (early part)
 + bisect: check ancestors without forking a "git rev-list" process
 + commit: add function to unparse a commit and its parents
 + bisect: rework some rev related functions to make them more
   reusable

----------------------------------------------------------------
[Stalled and may need help and prodding to go forward]

* jh/notes (Sat May 16 13:44:17 2009 +0200) 5 commits
 - Teach "-m <msg>" and "-F <file>" to "git notes edit"
 - Add an expensive test for git-notes
 - Speed up git notes lookup
 - Add a script to edit/inspect notes
 - Introduce commit notes

Dscho asked about the performance implications of this; I do not think I
saw any progress on that yet...

* 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...

* lt/read-directory (Fri May 15 12:01:29 2009 -0700) 3 commits
 - Add initial support for pathname conversion to UTF-8
 - read_directory(): infrastructure for pathname character set
   conversion
 - Add 'fill_directory()' helper function for directory traversal

Before adding the real "conversion", this needs a few real fixups, I
think.  For example there is one hardcoded array that is used without
bounds check.

* ar/maint-1.6.2-merge-recursive-d-f (Mon May 11 21:25:36 2009 +0200) 2 commits
 - Fix for a merge where a branch has an F->D transition
 - Add a reminder test case for a merge with F/D transition

Although the reported breakage is covered with the patch, Alex feels the
solution unsatisfactory. Cleaning up D/F conflict handling in merge-recursive
may be long overdue but seems to be a hard problem.

* ps/blame (Thu Mar 12 21:30:03 2009 +1100) 1 commit
 - blame.c: start libifying the blame infrastructure

A few minor point remains in this initial one.  I hate to do these minor
fix-ups myself, but I may end up doing so...

* jc/log-tz (Tue Mar 3 00:45:37 2009 -0800) 1 commit
 - Allow --date=local --date=other-format to work as expected

The one I posted had a few corner-case bugs that was caught with the test
suite; this one has them fixed.  People did not like the UI so it is kept
out of 'next'

* jc/merge-convert (Mon Jan 26 16:45:01 2009 -0800) 1 commit
 - git-merge-file: allow converting the results for the work tree

This is a feature waiting for a user.

We did not give scripted Porcelains a way to say "this temporary file I am
using for merging is for this path, so use the core.autocrlf and attributes
rules for that final path".  Instead, merge-file simply wrote out the
data in the canonical repository representation.

rerere has the same issue, but it is a lot worse.  It reads the three
files (preimage, postimage and thisimage) from the work tree in the work
tree representation, merges them without converting them to the canonical
representation first but inserts the conflict markers with the canonical
representation and writes the resulting mess out.  It needs to be fixed to
read with convert_to_git(), merge them while they are still in the
canonical representation and possibly add conflict markers, and then write
the results out after convert_to_working_tree().  It also needs to write
in binary mode as well.

* db/foreign-scm (Tue Mar 24 23:04:12 2009 -0400) 3 commits
 - Add option for using a foreign VCS
 - Document details of transport function APIs
 - Allow late reporting of fetched hashes

* hv/cvsps-tests (Sun Apr 5 01:40:50 2009 -0700) 8 commits
 - t/t9600: remove exit after test_done
 - cvsimport: extend testcase about patchset order to contain
   branches
 - cvsimport: add test illustrating a bug in cvsps
 - Add a test of "git cvsimport"'s handling of tags and branches
 - Add some tests of git-cvsimport's handling of vendor branches
 - Test contents of entire cvsimported "master" tree contents
 - Use CVS's -f option if available (ignore user's ~/.cvsrc file)
 - Start a library for cvsimport-related tests

----------------------------------------------------------------
[Actively cooking]

* da/araxis-mergetool (Sun May 24 00:24:41 2009 +0000) 1 commit
 + mergetool--lib: add support for araxis merge

* jc/cache-tree (Fri May 22 23:14:25 2009 -0700) 5 commits
 + Avoid "diff-index --cached" optimization under --find-copies-
   harder
 + Optimize "diff-index --cached" using cache-tree
 + t4007: modernize the style
 + cache-tree.c::cache_tree_find(): simplify internal API
 + write-tree --ignore-cache-tree

* cb/maint-1.6.0-xdl-merge-fix (Mon May 25 01:21:14 2009 +0100) 2 commits
 - Change xdl_merge to generate output even for null merges
 - t6023: merge-file fails to output anything for a degenerate merge

Soon in 'next';

* jc/diff-whitespace-only-status (Sat May 23 01:15:35 2009 -0700) 2 commits
 - diff: Rename QUIET internal option to QUICK
 - diff: change semantics of "ignore whitespace" options

* cc/bisect (Thu May 28 23:21:16 2009 +0200) 2 commits
 - bisect: display first bad commit without forking a new process
 - bisect: drop unparse_commit() and use clear_commit_marks()

Soon in 'next';

* rc/http-push (Sat May 30 01:59:50 2009 +0800) 21 commits
 - http*: add helper methods for fetching objects (loose)
 - http*: add helper methods for fetching packs
 - http: use new http API in fetch_index()
 - http*: add http_get_info_packs
 - Use the new http API in fetch_symref()
 - Use the new http API in update_remote_info_refs()
 - Use the new http API in http_fetch_ref()
 - Use the new http API in get_refs_via_curl()
 - Two new functions for the http API
 - http: create function end_url_with_slash
 - http*: move common variables and macros to http.[ch]
 - Some cleanup in get_refs_via_curl()
 - Don't expect verify_pack() callers to set pack_size
 - http-push: do not SEGV after fetching a bad pack idx file
 - http*: copy string returned by sha1_to_hex
 - http-walker: verify remote packs
 - http-push, http-walker: style fixes
 - http-push: fix missing "#ifdef USE_CURL_MULTI" around
   "is_running_queue"
 - http-push: send out fetch requests on queue
 - t5540-http-push: test fetching of packed objects
 - t5540-http-push: test fetching of loose objects

Updated (but not yet with the "slot->local = NULL" patch)

* cc/replace (Wed May 27 07:14:09 2009 +0200) 14 commits
 - t6050: check pushing something based on a replaced commit
 - Documentation: add documentation for "git replace"
 - Add git-replace to .gitignore
 - builtin-replace: use "usage_msg_opt" to give better error messages
 - parse-options: add new function "usage_msg_opt"
 - builtin-replace: teach "git replace" to actually replace
 - Add new "git replace" command
 - environment: add global variable to disable replacement
 - mktag: call "check_sha1_signature" with the replacement sha1
 - replace_object: add a test case
 - object: call "check_sha1_signature" with the replacement sha1
 - sha1_file: add a "read_sha1_file_repl" function
 - replace_object: add mechanism to replace objects found in
   "refs/replace/"
 - refs: add a "for_each_replace_ref" function

Rebased to master.

----------------------------------------------------------------
[On Hold]

* jc/deny-delete-current-1.7.0 (Mon Feb 9 00:19:46 2009 -0800) 1 commit
 - receive-pack: default receive.denyDeleteCurrent to refuse

* jc/refuse-push-to-current-1.7.0 (Wed Feb 11 02:28:03 2009 -0800) 1 commit
 - Refuse updating the current branch in a non-bare repository via
   push

These are for 1.7.0, but the messages when they trigger together may need
to be rethought.

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

* 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

* [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

* 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-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

* 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

end of thread, other threads:[~2009-06-03  6:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [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  6:46       ` Johan Herland
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
2009-06-02 22:59 ` [PATCH 2/2] git-submodule: add support for --merge Johan Herland

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).