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

Re: [RFC v3 3/4] submodule: Teach 'add' about a configurable local-branch

From
Francesco Pretto <ceztko@gmail.com>
Date
Jan 15, 2014, 00:18 UTC
Message-ID
<CALas-iiLQHVpH9-KbWHVJzYSho3cV-ELmG4+R_8XGT7Pb+=gWQ@mail.gmail.com>
In-Reply-To
<75e8c98df73273c2c8174e726e3fc961fbebd6a7.1389247320.git.wking@tremily.us>

I've matured this opinion about "local-branch" some days ago, but I couldn't join the discussion because I was extremely busy. Hope it's is still current (and correct).

2014/1/9 W. Trevor King <wking@tremily.us>
Show 21 quoted lines
>
> @@ -339,7 +339,19 @@ module_clone()
>         echo "gitdir: $rel/$a" >"$sm_path/.git"
>
>         rel=$(echo $a | sed -e 's|[^/][^/]*|..|g')
> -       (clear_local_git_env; cd "$sm_path" && GIT_WORK_TREE=. git config core.worktree "$rel/$b")
> +       superproject_branch=$(get_current_branch)
> +       default_local_branch=$(get_submodule_config "$sm_name" local-branch)
> +       (
> +               clear_local_git_env
> +               cd "$sm_path" &&
> +               GIT_WORK_TREE=. git config core.worktree "$rel/$b" &&
> +               local_branch=$(get_local_branch "${superproject_branch}" "${default_local_branch}") &&
> +               # ash fails to wordsplit ${branch:+-b "$branch"...}
> +               case "$branch" in
> +               '') git checkout -f -q -B "$local_branch" ;;
> +               ?*) git checkout -f -q -B "$local_branch" "origin/$branch" ;;
> +               esac
> +       ) || die "$(eval_gettext "Unable to checkout submodule '\$sm_path'")"
>  }
>
also
2014/1/8 W. Trevor King <wking@tremily.us>:
Show 25 quoted lines
>  To elaborate the idea I sketched out here [2], say
> you want:
>
>   Superproject branch  Submodule branch  Upstream branch
>   ===================  ================  ===============
>   master               master            master
>   super-feature        master            master
>   my-feature           my-feature        master
>   other-feature        other-feature     other-feature
>
> That's only going to work with per-superproject-branch configs for
> both the local and remote branches.  Using the same name for both
> local and remote branches does not work.
>
> Let me motivate each of the combinations in the above table:
>
> * master, master, master: The stable trunk.
> * super-feature, master, master: A superproject feature that works
>   with the stock submodule.
> * my-feature, my-feature, master: A superproject feature that needs an
>   improved submodule, but wants to integrate upstream master changes
>   during development.
> * other-feature, other-feature, other-feature: A superproject feature
>   that needs an improved submodule, and wants to integrate
>   other-feature changes that are also being developed upstream

The "local-branch" feature means to my brain the following: I, maintainer, decide for you, developer, what name should be the branch you are checking out. While, in general, it makes sense for a developer to switch to a differently named "feature branch" that can pull the original remote branch if he's actively developing (on any repository, not only a submodule), this leads me to the following questions: would it be good to introduce such enforcement? Do we allow something similar on regular repositories? In short I believe this workflow may reflect a personal attitude. In that case I'm unsure if git should ease it so specifically.

Previous: W. Trevor KingNext: W. Trevor King
Message 19 of 40 in “git-submodule.sh: Support 'checkout' as a valid update command”
  1. 1/2 git-submodule.sh: Support 'checkout' as a valid update commandFrancesco Pretto, Jan 5, 2014
  2. 2/2 Introduce git submodule attached updateFrancesco Pretto, Jan 5, 2014
  3. Francesco PrettoJan 5, 2014
  4. Heiko VoigtJan 5, 2014
  5. Francesco PrettoJan 5, 2014
  6. Heiko VoigtJan 6, 2014
  7. Francesco PrettoJan 6, 2014
  8. David EngsterJan 6, 2014
  9. W. Trevor KingJan 7, 2014
  10. W. Trevor KingJan 7, 2014
  11. Preferred local submodule branches (was: Introduce git submodule attached update)W. Trevor King, Jan 7, 2014
  12. W. Trevor KingJan 7, 2014
  13. W. Trevor KingJan 8, 2014
  14. W. Trevor KingJan 8, 2014
  15. 0/4 Preferred local submodule branchesW. Trevor King, Jan 9, 2014
  16. 1/4 submodule: Add helpers for configurable local branchesW. Trevor King, Jan 9, 2014
  17. 2/4 submodule: Teach 'update' to preserve local branchesW. Trevor King, Jan 9, 2014
  18. 3/4 submodule: Teach 'add' about a configurable local-branchW. Trevor King, Jan 9, 2014
  19. Francesco PrettoJan 15, 2014
  20. W. Trevor KingJan 15, 2014
  21. 4/4 submodule: Add a new 'checkout' commandW. Trevor King, Jan 9, 2014
  22. Tight submodule bindings (was: Preferred local submodule branches)W. Trevor King, Jan 12, 2014
  23. Jens LehmannJan 13, 2014
  24. W. Trevor KingJan 13, 2014
  25. Junio C HamanoJan 13, 2014
  26. W. Trevor KingJan 14, 2014
  27. Heiko VoigtJan 7, 2014
  28. W. Trevor KingJan 7, 2014
  29. Junio C HamanoJan 7, 2014
  30. Francesco PrettoJan 7, 2014
  31. Junio C HamanoJan 7, 2014
  32. Francesco PrettoJan 7, 2014
  33. Francesco PrettoJan 5, 2014
  34. Heiko VoigtJan 6, 2014
  35. W. Trevor KingJan 6, 2014
  36. Heiko VoigtJan 5, 2014
  37. W. Trevor KingJan 5, 2014
  38. Junio C HamanoJan 6, 2014
  39. Junio C HamanoJan 6, 2014
  40. Francesco PrettoJan 6, 2014

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.