<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/submodule.h, branch v2.4.9</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.4.9</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.4.9'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2013-08-06T21:11:00Z</updated>
<entry>
<title>rm: delete .gitmodules entry of submodules removed from the work tree</title>
<updated>2013-08-06T21:11:00Z</updated>
<author>
<name>Jens Lehmann</name>
<email>Jens.Lehmann@web.de</email>
</author>
<published>2013-08-06T19:15:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=95c16418f0375e2fc325f32c3d7578fba9cfd7ef'/>
<id>urn:sha1:95c16418f0375e2fc325f32c3d7578fba9cfd7ef</id>
<content type='text'>
Currently using "git rm" on a submodule removes the submodule's work tree
from that of the superproject and the gitlink from the index. But the
submodule's section in .gitmodules is left untouched, which is a leftover
of the now removed submodule and might irritate users (as opposed to the
setting in .git/config, this must stay as a reminder that the user showed
interest in this submodule so it will be repopulated later when an older
commit is checked out).

Let "git rm" help the user by not only removing the submodule from the
work tree but by also removing the "submodule.&lt;submodule name&gt;" section
from the .gitmodules file and stage both. This doesn't happen when the
"--cached" option is used, as it would modify the work tree. This also
silently does nothing when no .gitmodules file is found and only issues a
warning when it doesn't have a section for this submodule. This is because
the user might just use plain gitlinks without the .gitmodules file or has
already removed the section by hand before issuing the "git rm" command
(in which case the warning reminds him that rm would have done that for
him). Only when .gitmodules is found and contains merge conflicts the rm
command will fail and tell the user to resolve the conflict before trying
again.

Also extend the man page to inform the user about this new feature. While
at it promote the submodule sub-section to a chapter as it made not much
sense under "REMOVING FILES THAT HAVE DISAPPEARED FROM THE FILESYSTEM".

In t7610 three uses of "git rm submod" had to be replaced with "git rm
--cached submod" because that test expects .gitmodules and the work tree
to stay untouched. Also in t7400 the tests for the remaining settings in
the .gitmodules file had to be changed to assert that these settings are
missing.

Signed-off-by: Jens Lehmann &lt;Jens.Lehmann@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>mv: update the path entry in .gitmodules for moved submodules</title>
<updated>2013-08-06T21:10:35Z</updated>
<author>
<name>Jens Lehmann</name>
<email>Jens.Lehmann@web.de</email>
</author>
<published>2013-08-06T19:15:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0656781fadca17cc51fb1c30f265c251ebe12819'/>
<id>urn:sha1:0656781fadca17cc51fb1c30f265c251ebe12819</id>
<content type='text'>
Currently using "git mv" on a submodule moves the submodule's work tree in
that of the superproject. But the submodule's path setting in .gitmodules
is left untouched, which is now inconsistent with the work tree and makes
git commands that rely on the proper path -&gt; name mapping (like status and
diff) behave strangely.

Let "git mv" help here by not only moving the submodule's work tree but
also updating the "submodule.&lt;submodule name&gt;.path" setting from the
.gitmodules file and stage both. This doesn't happen when no .gitmodules
file is found and only issues a warning when it doesn't have a section for
this submodule. This is because the user might just use plain gitlinks
without the .gitmodules file or has already updated the path setting by
hand before issuing the "git mv" command (in which case the warning
reminds him that mv would have done that for him). Only when .gitmodules
is found and contains merge conflicts the mv command will fail and tell
the user to resolve the conflict before trying again.

Also extend the man page to inform the user about this new feature.

Signed-off-by: Jens Lehmann &lt;Jens.Lehmann@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>submodule.c: add .gitmodules staging helper functions</title>
<updated>2013-07-30T21:39:56Z</updated>
<author>
<name>Jens Lehmann</name>
<email>Jens.Lehmann@web.de</email>
</author>
<published>2013-07-30T19:50:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5fee995244e13fd59500425d49038b00499396f8'/>
<id>urn:sha1:5fee995244e13fd59500425d49038b00499396f8</id>
<content type='text'>
Add the new is_staging_gitmodules_ok() and stage_updated_gitmodules()
functions to submodule.c. The first makes it possible for call sites to
see if the .gitmodules file did contain any unstaged modifications they
would accidentally stage in addition to those they intend to stage
themselves. The second function stages all modifications to the
.gitmodules file, both will be used by subsequent patches for the mv
and rm commands.

Signed-off-by: Jens Lehmann &lt;Jens.Lehmann@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>mv: move submodules using a gitfile</title>
<updated>2013-07-30T20:52:53Z</updated>
<author>
<name>Jens Lehmann</name>
<email>Jens.Lehmann@web.de</email>
</author>
<published>2013-07-30T19:50:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a88c915de9886fe17005a5daff4900ced0ea76ad'/>
<id>urn:sha1:a88c915de9886fe17005a5daff4900ced0ea76ad</id>
<content type='text'>
When moving a submodule which uses a gitfile to point to the git directory
stored in .git/modules/&lt;name&gt; of the superproject two changes must be made
to make the submodule work: the .git file and the core.worktree setting
must be adjusted to point from work tree to git directory and back.

Achieve that by remembering which submodule uses a gitfile by storing the
result of read_gitfile() of each submodule. If that is not NULL the new
function connect_work_tree_and_git_dir() is called after renaming the
submodule's work tree which updates the two settings to the new values.

Extend the man page to inform the user about that feature (and while at it
change the description to not talk about a script anymore, as mv is a
builtin for quite some time now).

Signed-off-by: Jens Lehmann &lt;Jens.Lehmann@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>submodule: print graph output next to submodule log</title>
<updated>2013-04-05T18:28:10Z</updated>
<author>
<name>John Keeping</name>
<email>john@keeping.me.uk</email>
</author>
<published>2013-04-05T16:12:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0f33a0677d6d93b3f6d8fb7d1df62f30eb7b73a9'/>
<id>urn:sha1:0f33a0677d6d93b3f6d8fb7d1df62f30eb7b73a9</id>
<content type='text'>
When running "git log -p --submodule=log", the submodule log is not
indented by the graph output, although all other lines are.  Fix this by
prepending the current line prefix to each line of the submodule log.

Signed-off-by: John Keeping &lt;john@keeping.me.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>submodule: display summary header in bold</title>
<updated>2012-11-19T03:18:13Z</updated>
<author>
<name>Ramkumar Ramachandra</name>
<email>artagnon@gmail.com</email>
</author>
<published>2012-11-13T15:42:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4e215131d2543a28a065c5161438c315316f9961'/>
<id>urn:sha1:4e215131d2543a28a065c5161438c315316f9961</id>
<content type='text'>
Currently, 'git diff --submodule' displays output with a bold diff
header for non-submodules.  So this part is in bold:

    diff --git a/file1 b/file1
    index 30b2f6c..2638038 100644
    --- a/file1
    +++ b/file1

For submodules, the header looks like this:

    Submodule submodule1 012b072..248d0fd:

Unfortunately, it's easy to miss in the output because it's not bold.
Change this.

Signed-off-by: Ramkumar Ramachandra &lt;artagnon@gmail.com&gt;
Acked-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jl/submodule-rm'</title>
<updated>2012-10-29T08:12:07Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2012-10-29T08:12:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d21240fafafdea4fb4cab27c0e9b58ebad7d6172'/>
<id>urn:sha1:d21240fafafdea4fb4cab27c0e9b58ebad7d6172</id>
<content type='text'>
"git rm submodule" cannot blindly remove a submodule directory as
its working tree may have local changes, and worse yet, it may even
have its repository embedded in it.  Teach it some special cases
where it is safe to remove a submodule, specifically, when there is
no local changes in the submodule working tree, and its repository
is not embedded in its working tree but is elsewhere and uses the
gitfile mechanism to point at it.

* jl/submodule-rm:
  submodule: teach rm to remove submodules unless they contain a git directory
</content>
</entry>
<entry>
<title>submodule: teach rm to remove submodules unless they contain a git directory</title>
<updated>2012-09-29T18:33:31Z</updated>
<author>
<name>Jens Lehmann</name>
<email>Jens.Lehmann@web.de</email>
</author>
<published>2012-09-26T18:21:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=293ab15eea341ffe8705bac99136f2e3a286db5f'/>
<id>urn:sha1:293ab15eea341ffe8705bac99136f2e3a286db5f</id>
<content type='text'>
Currently using "git rm" on a submodule - populated or not - fails with
this error:

	fatal: git rm: '&lt;submodule path&gt;': Is a directory

This made sense in the past as there was no way to remove a submodule
without possibly removing unpushed parts of the submodule's history
contained in its .git directory too, so erroring out here protected the
user from possible loss of data.

But submodules cloned with a recent git version do not contain the .git
directory anymore, they use a gitfile to point to their git directory
which is safely stored inside the superproject's .git directory. The work
tree of these submodules can safely be removed without losing history, so
let's teach git to do so.

Using rm on an unpopulated submodule now removes the empty directory from
the work tree and the gitlink from the index. If the submodule's directory
is missing from the work tree, it will still be removed from the index.

Using rm on a populated submodule using a gitfile will apply the usual
checks for work tree modification adapted to submodules (unless forced).
For a submodule that means that the HEAD is the same as recorded in the
index, no tracked files are modified and no untracked files that aren't
ignored are present in the submodules work tree (ignored files are deemed
expendable and won't stop a submodule's work tree from being removed).
That logic has to be applied in all nested submodules too.

Using rm on a submodule which has its .git directory inside the work trees
top level directory will just error out like it did before to protect the
repository, even when forced. In the future git could either provide a
message informing the user to convert the submodule to use a gitfile or
even attempt to do the conversion itself, but that is not part of this
change.

Signed-off-by: Jens Lehmann &lt;Jens.Lehmann@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>submodule: use argv_array instead of hand-building arrays</title>
<updated>2012-09-03T04:13:50Z</updated>
<author>
<name>Jens Lehmann</name>
<email>Jens.Lehmann@web.de</email>
</author>
<published>2012-09-01T15:27:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=50d89ad6542c8acafefa6d42f8b42dfa9b8fafe1'/>
<id>urn:sha1:50d89ad6542c8acafefa6d42f8b42dfa9b8fafe1</id>
<content type='text'>
fetch_populated_submodules() allocates the full argv array it uses to
recurse into the submodules from the number of given options plus the six
argv values it is going to add. It then initializes it with those values
which won't change during the iteration and copies the given options into
it. Inside the loop the two argv values different for each submodule get
replaced with those currently valid.

However, this technique is brittle and error-prone (as the comment to
explain the magic number 6 indicates), so let's replace it with an
argv_array. Instead of replacing the argv values, push them to the
argv_array just before the run_command() call (including the option
separating them) and pop them from the argv_array right after that.

Signed-off-by: Jens Lehmann &lt;Jens.Lehmann@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'hv/submodule-recurse-push'</title>
<updated>2012-04-24T21:40:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-04-24T21:40:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=419f2ecf7894726773f7ea5620741ce8ec60e553'/>
<id>urn:sha1:419f2ecf7894726773f7ea5620741ce8ec60e553</id>
<content type='text'>
"git push --recurse-submodules" learns to optionally look into the
histories of submodules bound to the superproject and push them out.

By Heiko Voigt
* hv/submodule-recurse-push:
  push: teach --recurse-submodules the on-demand option
  Refactor submodule push check to use string list instead of integer
  Teach revision walking machinery to walk multiple times sequencially
</content>
</entry>
</feed>
