git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-submodule: Remove duplicate entries during merge with conflict

From
Jens Lehmann <jens.lehmann@web.de>
Date
Mar 21, 2011, 20:29 UTC
Message-ID
<4D87B51A.4060609@web.de>
In-Reply-To
<7vhbb1320t.fsf@alter.siamese.dyndns.org>
Am 17.03.2011 21:50, schrieb Junio C Hamano:
Show 5 quoted lines
> The idea is to notice the higher-stage entries, and emit only one record
> from module_list, but while doing so, mark the entry with "U" (not [0-3])
> in $stage field and null out the SHA-1 part, as the object name for the
> lowest stage does not give any useful information to the caller, and this
> way any caller that uses the object name would hopefully barf.
Excellent idea.
Show 10 quoted lines
> Fine points:
> 
>  - The command called by foreach may want to do whatever it wants to do by
>    noticing the merged status in the superproject itself, so I made no
>    change to the function;
> 
>  - Init is an unlikely thing to do, but as long as a submodule is there in
>    $path, there is no point skipping it. It might however want to take the
>    merged status of .gitmodules into account, but that is outside of the
>    scope of this topic;
Both make sense.
>  - Update should refrain from touching the submodule itself. It may want
>    to recurse into the submodule of the unmerged one, but people involved
>    in submodule work should think things through;

I don't think recursing would make any sense here. It might be unknown to what commit the sub-submodules should be updated to if their commits differ in the unmerged branches. So I'd vote for not recursing at all in this case (which is what your patch does).

>  - Status does not have anything to report for an unmerged submodule. It
>    may want to recurse into the submodule of the unmerged one, but people
>    involved in submodule work should think things through; and

I do think status does have something to report here. First its job is to list all submodules, so currently unmerged submodules should show up too, and then it tells the user something about the state of the submodule. So I would propose to print a line for the submodule starting with a special character that tells the user the submodule has a merge conflict. We could e.g. use a '*' here (additionally to '-' for uninitialized and '+' for those submodules where the HEAD differs from the commit recorded in the superproject).

>  - Sync should be Ok for the same reason as Init.
Yup.
<snip>
Show 7 quoted lines
> @@ -767,6 +789,11 @@ cmd_status()
>  	module_list "$@" |
>  	while read mode sha1 stage path
>  	do
> +		if test "$stage" = U
> +		then
> +			echo >&2 "Skipping unmerged submodule $path"

As said above I would like to mimic the output for other submodule states here. Maybe something like this (where $sha1 will expand to the null sha as we don't have anything better here):

+			say "*$sha1 $prefix$path"
Show 5 quoted lines
> +			continue
> +		fi
>  		name=$(module_name "$path") || exit
>  		url=$(git config submodule."$name".url)
>  		displaypath="$prefix$path"
Previous: Jens LehmannNext: Junio C Hamano
Message 6 of 14 in “git-submodule: Remove duplicate entries during merge with conflict”
  1. git-submodule: Remove duplicate entries during merge with conflictNicolas Morey-Chaisemartin, Mar 17, 2011
  2. Junio C HamanoMar 17, 2011
  3. Junio C HamanoMar 17, 2011
  4. Nicolas Morey-ChaisemartinMar 21, 2011
  5. Jens LehmannMar 21, 2011
  6. Jens LehmannMar 21, 2011
  7. Junio C HamanoMar 21, 2011
  8. Nicolas Morey-ChaisemartinMar 21, 2011
  9. Jens LehmannMar 21, 2011
  10. Nicolas Morey-ChaisemartinMar 22, 2011
  11. funeeldyJul 14, 2011
  12. Jens LehmannJul 15, 2011
  13. Marlene CoteJul 15, 2011
  14. Jens LehmannJul 15, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.