Re: [PATCH 2/6] git rm: Support for removing submodules

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Junio C Hamano
Date: Friday, September 12, 2008 - 2:49 pm

Petr Baudis <pasky@suse.cz> writes:


Sorry, I read this three times but "this" is unclear to me.  Different and
mutually incompatible interpretations I tried to understand it are:

 (1) When removing submodules, whether --cached or not, the index can
     match either HEAD or the work tree; this is different from removing
     regular blobs where the index must match with HEAD without --cached
     nor -f;

 (2) When removing submodules with --cached, the index can match either
     HEAD or the work tree and it is removed only from the index.  You
     cannot remove submodules without --cached;

 (3) When removing submodules, the index can match either HEAD or the work
     tree and it is removed only from the index, even if you did not give
     --cached;

It later becomes clear that you meant (3) in the second hunk, but the
first time reader of the resulting document (not this patch) won't be
reading from bottom to top.

This is a leftover issue from ealier documentation 25dc720 (Clarify and
fix English in "git-rm" documentation, 2008-04-16), but the description is
unclear what should happen while working towards the initial commit
(i.e. no HEAD yet).  I think check_local_mod() allows removal in such a
case.  Perhaps you can clarify the point while at it, please?


ALLOC_GROW()?


	/*
	 * Style?
         * for a multi-line comment.
         */


Here is one caller I questioned in my comments on [1/6].  It is clear this
caller wants to use "submodule.xyzzy" out of "submodule.xyzzy.path".  The
function returning "submodule.xyzzy.path" does not feel like a clean and
reusable interface to me.  I'd suggest either returning "submodule.xyzzy"
(that's too specialized only for this caller to my taste, though), or just
"xyzzy" and have the caller synthesize whatever string it wants to use
(yes, it loses microoptimization but do we really care about it in this
codepath?), if you have other callers that want different strings around
"xyzzy".


Perhaps hoist "int removed" up one scope level and reuse it?  I misread
that you are counting the number of gitlinks in the index, not the number
of gitlinks that is being removed, on my first read.  The variable is used
for the latter.

Other than that I did not see anything questionable in [2/6].


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/6] Submodule support for git mv and git rm, Petr Baudis, (Fri Sep 12, 2:08 pm)
[PATCH 2/6] git rm: Support for removing submodules, Petr Baudis, (Fri Sep 12, 2:09 pm)
[PATCH 3/6] git mv: Support moving submodules, Petr Baudis, (Fri Sep 12, 2:09 pm)
[PATCH 4/6] t7403: Submodule git mv, git rm testsuite, Petr Baudis, (Fri Sep 12, 2:09 pm)
[PATCH] git mv: Support moving submodules, Petr Baudis, (Fri Sep 12, 2:42 pm)
Re: [PATCH 2/6] git rm: Support for removing submodules, Junio C Hamano, (Fri Sep 12, 2:49 pm)
Re: [PATCH 2/6] git rm: Support for removing submodules, Junio C Hamano, (Fri Sep 12, 2:59 pm)
Re: [PATCH] git mv: Support moving submodules, Junio C Hamano, (Fri Sep 12, 3:19 pm)
Re: [PATCH 2/6] git rm: Support for removing submodules, Junio C Hamano, (Fri Sep 12, 3:42 pm)