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

Re: [PATCH] git-submodule add: Record branch name in .gitmodules

From
W. Trevor King <wking@tremily.us>
Date
Oct 23, 2012, 19:44 UTC
Message-ID
<20121023194436.GD28592@odin.tremily.us>
In-Reply-To
<5086ED06.5020406@gmail.com>
On Tue, Oct 23, 2012 at 12:16:22PM -0700, Nahor wrote:
> On 2012-10-22 09:34, W. Trevor King wrote:
> For instance, the module may later be updated to a commit in branch B 
> instead of branch A. Unless you remember to also update .gitmodule, you 
> have then inconsistent information.
But you're explicitly *using* the configured setting in
  git config --file $toplevel/.gitmodules submodule.$name.branch

That should be a reminder that the configuration is important, and you'll remember to change it. Plus, the text from git-pull should clearly display the branch you are pulling, which gives you a second change to notice if something is going wrong.

> A similar issue arises if branch A is deleted from the module later (for 
> instance because it has been merged in the master branch and is not 
> useful anymore). Then .gitmodule points to a non-existant branch.
> Same thing if a branch is renamed.

All of these are possible, and all would reqire manual intervention to pick out a new branch to follow. Plus, this patch is not even about the auto-pull application, it's about storing the initially cloned branch name. What you do with that name afterwards is up to you ;).

> I think a better place to store that kind of information is using 
> git-notes. That way, if the branch is renamed or deleted, you can easily 
> update the old notes to use the new name instead.
Interesting.  What would you attach the note too?
Trevor
-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
Previous: NahorNext: Nahor
Message 3 of 12 in “git-submodule add: Record branch name in .gitmodules”
  1. git-submodule add: Record branch name in .gitmodulesW. Trevor King, Oct 22, 2012
  2. NahorOct 23, 2012
  3. W. Trevor KingOct 23, 2012
  4. NahorOct 23, 2012
  5. Jens LehmannOct 23, 2012
  6. W. Trevor KingOct 23, 2012
  7. NahorOct 23, 2012
  8. Jens LehmannOct 24, 2012
  9. W. Trevor KingOct 22, 2012
  10. Phil HordOct 24, 2012
  11. W. Trevor KingOct 25, 2012
  12. Jeff KingOct 26, 2012

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.