git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Git submodule update and the --merge flag when submodule is yet to be checked out
@ 2011-03-18 18:25 Carl Fürstenberg
  2011-03-18 21:01 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Carl Fürstenberg @ 2011-03-18 18:25 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 856 bytes --]

Sorry for re-posting the question but I though I should explain the
issue better and to fix the subject line.
sub
When you are cloning repository containing submodules, and you are
using the --merge flag to "git submodule update" the first time, then
the submodule instance in question will assume you want to delete all
files present in the module.

Please look at attachment for a testcase and how the result might look like.
Unless this is not the intended behavior, then I would suggest
changing --merge (and possible --rebase) to not assume a non-existent
repository
to be a empty one.

The man pages says "Merge the commit recorded in the superproject into
the current branch of the submodule", but we have no current branch of
the
submodule.

I would be happy for any reply, and sorry again for the repost.

/Carl Fürstenberg

[-- Attachment #2: submodule_merge_test.sh --]
[-- Type: application/x-sh, Size: 443 bytes --]

[-- Attachment #3: test_output --]
[-- Type: application/octet-stream, Size: 1763 bytes --]

+ mkdir -p test/base test/subproj
+ cd test/subproj
+ git init
Initialized empty Git repository in /home/azatoth/tmp/submerge/test/subproj/.git/
+ echo a
+ git add file
+ git commit -m 'Added file'
[master (root-commit) 9d8576e] Added file
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 file
+ cd test/base
+ git init
Initialized empty Git repository in /home/azatoth/tmp/submerge/test/base/.git/
+ git submodule add file:///home/azatoth/tmp/submerge/test/base/../subproj sub
Cloning into sub...
+ git commit -m 'Added subproj'
[master (root-commit) acab4bd] Added subproj
 2 files changed, 4 insertions(+), 0 deletions(-)
 create mode 100644 .gitmodules
 create mode 160000 sub
+ cd test
+ git clone base cloned
Cloning into cloned...
done.
+ cd cloned
+ git submodule status
-9d8576eda18dd0a2736821d9f60bd34915fdd61c sub
+ git submodule update --init --merge
Submodule 'sub' (file:///home/azatoth/tmp/submerge/test/base/../subproj) registered for path 'sub'
Cloning into sub...
Already up-to-date.
Submodule path 'sub': merged in '9d8576eda18dd0a2736821d9f60bd34915fdd61c'
+ git submodule status
 9d8576eda18dd0a2736821d9f60bd34915fdd61c sub (heads/master)
+ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#	modified:   sub (modified content)
#
no changes added to commit (use "git add" and/or "git commit -a")
+ cd sub
+ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	deleted:    file
#
+ rm -rf test/base test/subproj test/cloned
+ rmdir test

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

end of thread, other threads:[~2011-03-18 21:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-18 18:25 Git submodule update and the --merge flag when submodule is yet to be checked out Carl Fürstenberg
2011-03-18 21:01 ` Junio C Hamano
2011-03-18 21:06   ` Carl Fürstenberg
2011-03-18 21:24   ` Spencer E. Olson
2011-03-18 21:35     ` Junio C Hamano

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 NNTP newsgroup(s).