feat(cli): allow an alternate Git repository path to be specified#1468
feat(cli): allow an alternate Git repository path to be specified#1468
Conversation
A flag was added that shares the same semantics as the Git's flag Resolves #1467O
sudoforge
left a comment
There was a problem hiding this comment.
this is already a supported workflow using git's -C flag:
➜ cd $(mktemp -d)
➜ git init .
Initialized empty Git repository in /tmp/tmp.5DzuMyMWOO/.git/
➜ git bug user new -e 'no-reply@sudoforge.com' -n 'sudoforge' --non-interactive
Building cache...
9d2b85433bc7775128e778a1c122c1efc23a748dd035c30dcea673f5d6833e20
➜ cd $(mktemp -d)
➜ pwd
/tmp/tmp.gOrmIEBMtc
➜ git -C /tmp/tmp.5DzuMyMWOO bug user
9d2b854 sudoforge
is there any particular reason you want to add support for this to git-bug?
This requires to use the git integration, which I don't think is the right choice for the future (even if it's cute). That said, I'm not quite fan of the ergonomics of Additionally, from a UX perspective we should consider how we will in the future instruct the |
i mean, okay, if this move is made, but moving away from shipping as git-bug isn't something that's happening in the (near) future, doesn't have a complete design, should be aligned with a repository rename, and isn't the way users are expected to be using git-bug today. since this wouldn't really cause an issue, i guess i'd accept it today even though the need for it is rather non-existent.
this isn't the right place for design discussions, but generally, i see the server (a long-lived daemon running in the background) maintaining a list of repositories it should track/interact with. the user would add repositories to the server either imperatively (through a command, or api endpoint via a client application) or dynamically, by running any git-bug command in a repository that isn't already tracked. |
|
A bit of confusion here and there regarding this entire proposal and pull request. Git's The correct ways to specify the path to the Git repository (the Real use caseyadm is a nifty POSIX Shell tool for managing "dotfiles". It's a Git wrapper designed to simplify tracking certain paths in your Unix home directory, like
$ yadm status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit (use -u to show untracked files)
$ yadm bug bug
Error: .git not foundWorse, if someone calls This Pull RequestThe implementation of Suggestions
I might be available to implement this soon if everything makes sense. Footnotes
|
|
👋 revisiting this.
I don't think there is any confusion about how it works -- neither of the respondents claimed that it did anything other than what it does. That said, I would disagree that it is "mostly used with deeply nested source trees", as my own primary use case for it is automation that runs against many independent repositories, from outside of the context of any one of them - and you cannot possibly hope to know how the bulk of other
this is true - but this PR doesn't address more to the point, I don't think calling |
This is exactly what I was doing until I realized that:
So now I'm using That being said, I'm happy to update this PR once we've reached a consensus. As an alternate view-point, I never run
Great point! So what I think I've heard so far is:
|
|
@sudoforge Can you re-review this when you get a chance? |
|
|
||
| By default, git-bug manages bugs and users in the Git repository containing | ||
| the current working directory. This behavior can be changed using the --git-dir | ||
| flag described below, or by setting the GIT-DIR environment variable, which |
There was a problem hiding this comment.
| flag described below, or by setting the GIT-DIR environment variable, which | |
| flag described below, or by setting the GIT_DIR environment variable, which |
| In In | ||
| Out Out | ||
| Err Out | ||
| GitDir string |
There was a problem hiding this comment.
As we discussed, let's remove this from Env. There is better ways and there is no good reason to have this here.
| } | ||
|
|
||
| env := execenv.NewEnv() | ||
| cmd.PersistentFlags().StringVar(&env.GitDir, "git-dir", "", `run as if git-bug was started in <path>`) |
There was a problem hiding this comment.
should we mention the env variable in the comment?
A flag was added that shares the same semantics as Git's
-CflagResolves #1467