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

Re: git branch --edit-description a custom file

From
Denton Liu <liu.denton@gmail.com>
Date
Oct 30, 2019, 22:43 UTC
Message-ID
<20191030224328.GB44961@generichostname>
In-Reply-To
<20191030202835.GB29013@sigill.intra.peff.net>
Hi Peff,
On Wed, Oct 30, 2019 at 04:28:35PM -0400, Jeff King wrote:
Show 11 quoted lines
> On Wed, Oct 30, 2019 at 11:39:50AM -0700, Denton Liu wrote:
> 
> > It seems like everyone working on git.git has their own patch management
> > system. Currently, I keep all of my branch-specific configurations
> > (including CC lists) and patches in a worktree within the repo so that I
> > can keep my configs synced around on different computers.
> > 
> > One thing that's missing about this setup is that I would like to
> > version my branch descriptions as well since I use those to generate
> > cover letters. Unfortunately, `git branch --edit-description` only
> > operates on .git/config.

Dscho brought up in the GGG thread[1] that perhaps we want to treat branch descriptions like notes and have them all under something like `refs/notes/branches`. This would certainly solve my problem of having versioned descriptions and it would probably do it in a much more general way than having a versioned included config.

Anyone see any potential problems with this approach?
Show 15 quoted lines
> > 
> > As a workaround, I rewrote `git branch --edit-description` as a
> > shell-script that can operate on any config file but I feel like a more
> > general solution should be warranted.
> > 
> > Would changing the option to `git branch --edit-description[=<config>]`
> > make sense, where the `<config>` is optional but if it's specified,
> > it'll operate on that file instead of the .git/config.
> 
> That makes sense to me (though I don't use branch descriptions myself).
> I actually wish a lot of auto-written config (like branch.*.merge) was
> written to a file besides .git/config, and then just included. It would
> make it easier to keep your actual config file cleaner (I usually take
> the opposite route and version-control my own config in a separate file
> that I include from .git/config).

Yeah, I've also wanted the same... I've thought about just symlinking .git/config away but I think that causes other problems that I don't want to deal with.

Show 11 quoted lines
> 
> > Alternately, would it make sense to support a $GIT_CONFIG environment
> > variable globally? That is, when $GIT_CONFIG is specified, git will
> > read/write from $GIT_CONFIG instead of .git/config? It'd be a little
> > heavy-handed for me to make the change just for this one use-case but
> > perhaps people may find other uses for it?
> 
> We used to have such a thing, and it opened a lot of weird corner cases.
> Just thinking about the case you mentioned: would people be confused if
> "GIT_CONFIG=foo git branch --edit-description" doesn't respect
> core.editor specified in .git/config?

I found the original thread that removed the functionality[2]. I'm probably not going to go with this approach since the notes approach seems more promising but going back to your question, I think that would make sense since by specifying GIT_CONFIG, a user is explicitly overriding .git/config so they should also be aware of the consequences.

Thanks for your thoughts,
Denton

[1]: https://github.com/gitgitgadget/git/issues/438 [2]: https://public-inbox.org/git/alpine.LNX.1.00.0806300328380.19665@iabervon.org/

> 
> -Peff
Previous: Jeff KingNext: Jeff King
Message 3 of 21 in “git branch --edit-description a custom file”
  1. Denton LiuOct 30, 2019
  2. Jeff KingOct 30, 2019
  3. Denton LiuOct 30, 2019
  4. Jeff KingOct 31, 2019
  5. Johannes SchindelinOct 31, 2019
  6. Phillip WoodOct 31, 2019
  7. Johannes SchindelinOct 31, 2019
  8. Philip OakleyOct 31, 2019
  9. Jeff KingOct 31, 2019
  10. Philip OakleyNov 3, 2019
  11. Jeff KingNov 4, 2019
  12. Junio C HamanoNov 4, 2019
  13. Denton LiuOct 31, 2019
  14. Phillip WoodOct 31, 2019
  15. Jeff KingOct 31, 2019
  16. Phillip WoodNov 1, 2019
  17. Jeff KingNov 1, 2019
  18. Phillip WoodNov 1, 2019
  19. Junio C HamanoNov 2, 2019
  20. Denton LiuOct 31, 2019
  21. Jeff KingOct 31, 2019

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.