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

Re: [PATCH 01/12] Generate unique ID for submodules created using "git submodule add"

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Mar 27, 2010, 09:44 UTC
Message-ID
<20100327094427.GA30216@progeny.tock>
In-Reply-To
<1269617140-7827-2-git-send-email-peter@pcc.me.uk>
Peter Collingbourne wrote:
Show 6 quoted lines
> This patch causes "git submodule add" to generate a unique ID for
> the submodule which is used as its name.  The ID is generated by
> computing the SHA1 hash of the pid, date and initial path.
> 
> The purpose of this patch is to avoid name conflicts which may
> arise due to the ability to rename submodules.

I assume this is related to Pasky’s patch “git submodule add: Fix naming clash handling” [1]

	This patch fixes git submodule add behaviour when we add submodule
	living at a same path as logical name of existing submodule. This
	can happen e.g. in case the user git mv's the previous submodule away
	and then git submodule add's another under the same name.
	
	A test-case is obviously included.
	
	This is not completely satisfactory since .git/config cross-commit
	conflicts can still occur. A question is whether this is worth
	handling, maybe it would be worth adding some kind of randomization
	of the autogenerated submodule name, e.g. appending $$ or a timestamp.

The suggestion of _appending_ some nonsense to a submodule name sounds much more palatable to me than _replacing_ the submodule name with nonsense. YMMV, of course.

Regards, Jonathan

[1] submitted twice: once as part of the series you pointed to and again in the re-roll at http://thread.gmane.org/gmane.comp.version-control.git/95763/focus=95769

Previous: Peter CollingbourneNext: Peter Collingbourne
Message 3 of 18 in “Improve handling of moving and removing submodules”
  1. 00/12 Improve handling of moving and removing submodulesPeter Collingbourne, Mar 26, 2010
  2. 01/12 Generate unique ID for submodules created using "git submodule add"Peter Collingbourne, Mar 26, 2010
  3. Jonathan NiederMar 27, 2010
  4. Peter CollingbourneApr 3, 2010
  5. 1/2 Prefix submodule names with the path basenamePeter Collingbourne, Apr 3, 2010
  6. 2/2 Truncate the SHA1 part of the submodule name to 7 charactersPeter Collingbourne, Apr 3, 2010
  7. 02/12 Implement "git mv" for submodulesPeter Collingbourne, Mar 26, 2010
  8. 03/12 git rm: display a warning for every unremovable filePeter Collingbourne, Mar 26, 2010
  9. Jonathan NiederMar 27, 2010
  10. 04/12 Generalise the unlink_or_warn functionPeter Collingbourne, Mar 26, 2010
  11. 05/12 Implement the rmdir_or_warn functionPeter Collingbourne, Mar 26, 2010
  12. 06/12 Introduce remove_or_warn functionPeter Collingbourne, Mar 26, 2010
  13. 07/12 Remove a redundant errno test in a usage of remove_pathPeter Collingbourne, Mar 26, 2010
  14. 08/12 git rm: collect file modesPeter Collingbourne, Mar 26, 2010
  15. 09/12 Add a mode parameter to the remove_path functionPeter Collingbourne, Mar 26, 2010
  16. 10/12 git rm: do not abort due to an initialised submodulePeter Collingbourne, Mar 26, 2010
  17. 11/12 git submodule: infrastructure for reading .gitmodules files in arbitrary locationsPeter Collingbourne, Mar 26, 2010
  18. 12/12 git rm: remove submodule entries from .gitmodulesPeter Collingbourne, Mar 26, 2010

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.