garden-rs / garden Goto Github PK
View Code? Open in Web Editor NEWGarden grows and cultivates collections of Git trees ~ Official mirror of https://gitlab.com/garden-rs/garden
Home Page: https://garden-rs.gitlab.io
License: MIT License
Garden grows and cultivates collections of Git trees ~ Official mirror of https://gitlab.com/garden-rs/garden
Home Page: https://garden-rs.gitlab.io
License: MIT License
Hello!
Would you be open to adding (or reviewing a PR for) the ability to install Garden as a Nix package?
If so, I'd be interested in contributing this or assisting with it.
It's possible and useful to make garden installable via Nix by adding a single (flake.nix) file to the root of this repo.
[1] https://nix-tutorial.gitlabpages.inria.fr/nix-tutorial/first-package.html
I have a use case that I haven't been able to figure out how to implement. I'd like to have a global command unpushed
that goes through all my trees and prints out branch names for branches that aren't pushed upstream. I can list unpushed branches fine, but right now every tree gets a heading even if it doesn't have any unpushed branches. I'd like to be able to hide the headings for trees that don't have any unpushed branches. So for example:
# dev/advent-of-code
830b34d (incomplete-2021-19) Incomplete 2021-19
# dev/bitcurry-provisioning
# dev/cookiecutter-rust-bin
...
dev/advent-of-code
has an unpushed branch so its heading should be listed, but dev/bitcurry-provisioning
doesn't have any unpushed branches so I'd like to prevent having the heading printed.
If there's not a way to do this, no big deal, but I figured I'd ask! This is a really great tool by the way!
Garden scans git repos [1] under management and removes them [2] to maintain sync with config and git-remote-prune, optionally prompting to first reconcile and ultimately to confirm.
In this way garden adheres the state of the managed repos on disk, to the state of the config+repo.
[1]
Apply to git-repos that were previously created by garden under a watched/managed directory, such as GARDEN_ROOT.
This may recommend that Garden annotate git repos with metadata to durably signal that it's providing lifecycle mgmt.
[2]
The repo is presently absent/removed from GARDEN_CONFIG or references a branch that's removed with a git remote prune
.
I'm wondering if there is any possibility to mirror a garden locally, similar to the travel function in ohmyrepos?
When using includes
in the garden configuration file, I noticed that if two files are included and each contains the same command then when that command is run, it is run twice instead of once. This can be replicated by including the same config twice from different path locations. My expectation of the behavior was 'override' rather than 'duplicate'. I was hoping to use this feature for personal overrides on a department-provided configuration.
I'm growing my garden file with some backup commands to backup and restore from borg. As a test I'm trying to to restore from a borg backup, but trees that are not grown, are skipped for commands.
example:
variables:
source: "${HOME}"
storage: "${HOME}/projects/garden/storage"
borg: "${HOME}/projects/garden/borg"
borgname: borg
borgsecret: secret
garden:
root: "${HOME}"
templates:
storage:
url: "${source}/${TREE_NAME}"
remotes:
storage: "${storage}/${TREE_NAME}.git"
commands:
setup: |
mkdir -p ${storage}
git init --bare ${storage}/${TREE_NAME}.git
push-storage: "git push storage \"$@\""
push-var: "git push ${storage} \"$@\""
borg-setup: |
mkdir -p ${borg}/${TREE_NAME}
BORG_PASSPHRASE=${borgsecret} borg init --append-only --encryption=repokey ${borg}/${TREE_NAME}
borg-backup: |
cd ${TREE_PATH}
BORG_PASSPHRASE=${borgsecret} borg create ${borg}/${TREE_NAME}::{now} .
borg-restore: |
mkdir -p ${TREE_PATH}
cd ${TREE_PATH}
snapshot=$(BORG_PASSPHRASE=${borgsecret} borg list ${borg}/${TREE_NAME} --last 1 --short)
BORG_PASSPHRASE=${borgsecret} borg extract ${borg}/${TREE_NAME}::$snapshot
borg-check: |
BORG_PASSPHRASE=${borgsecret} borg check ${borg}/${TREE_NAME}
trees:
projects/garden/repo1:
templates:
- storage
If I do garden borg-restore projects/garden/repo1
it is skipped with # projects/garden/repo1 (skipped)
. Is there a way to override this skipping?
Hi,
FYI, I've packaged garden
for pkgsrc/NetBSD and merged the package into the main branch, http://mail-index.netbsd.org/pkgsrc-changes/2023/01/22/msg267560.html
This means users will be able to install garden
from the official repositories using the native package manager, i.e. pkgin install garden
If users still prefer to build it from source, they can easily do that by
cd /usr/pkgsrc/devel/garden
make install
Regards
the remotes branch aren't fetched when you perform a garden grow. you can't checkout a branch from the origin.
NixOS builds in sandboxed environments using nixbld
users and /homeless-shelter
as a $HOME
. Those build users do not have .gitconfig
setup, so git operations fail with error: could not lock config file /homeless-shelter/.gitconfig: No such file or directory
. Complete output below after issuing nix build
Running tests/integration_test.rs (target/release/deps/integration_test-74d13108bef44e11)
running 43 tests
test cmd_dot_default_no_args ... ok
test cmd_exec_grafted_group ... ok
test cmd_exec_garden_with_grafted_trees ... ok
test cmd_dot_default_double_dash_args ... ok
test cmd_exec_group_with_grafted_trees ... ok
test cmd_dot_default_double_dash ... ok
test cmd_dot_default_no_args_echo ... ok
test eval_config_dir_with_chdir_and_root ... ok
test cmd_no_errexit ... ok
test cmd_dash_dash_arguments_custom ... ok
test eval_exec_pwd_with_root_and_chdir ... ok
test eval_graft_variable_at_tree_scope ... ok
test eval_grafted_variable_at_global_scope ... ok
test eval_grafted_variable_with_namespace ... ok
test cmd_dash_dash_arguments ... ok
test eval_root_with_root ... ok
test cmd_shell_variables ... ok
test eval_root_with_root_and_chdir ... ok
test cmd_breadth_first_and_depth_first ... ok
test cmd_no_errexit_for_command_lists ... ok
test eval_grafted_builtin_variables ... ok
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
test cmd_prune_depth ... FAILED
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
test git_branches ... FAILED
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
test eval_garden_config_dir ... FAILED
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
test eval_override_variables ... FAILED
test git_worktree_details ... FAILED
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
test grow_bare_repo_with_config ... FAILED
test cmd_pre_and_post_commands ... ok
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
test grow_branches_for_clone ... FAILED
test grow_bare_repo ... FAILED
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
test grow_branch_default ... FAILED
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
test grow_clone ... FAILED
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
test grow_clone_shallow ... FAILED
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
test grow_clone_single_branch ... FAILED
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
test grow_default_remote_name ... FAILED
test grow_default_remote_url ... FAILED
test cmd_pre_and_post_nested_commands ... ok
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
test grow_gitconfig ... FAILED
test grow_gitconfig_append_value ... FAILED
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
test grow_symlinks ... FAILED
test grow_remotes ... FAILED
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'nixbld@localhost.(none)')
test grow_worktree_and_parent ... FAILED
test cmd_keep_going_and_no_errexit ... ok
failures:
---- cmd_prune_depth stdout ----
thread 'cmd_prune_depth' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- git_branches stdout ----
thread 'git_branches' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- eval_garden_config_dir stdout ----
thread 'eval_garden_config_dir' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- eval_override_variables stdout ----
thread 'eval_override_variables' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- git_worktree_details stdout ----
thread 'git_worktree_details' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- grow_bare_repo_with_config stdout ----
thread 'grow_bare_repo_with_config' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- grow_branches_for_clone stdout ----
thread 'grow_branches_for_clone' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- grow_bare_repo stdout ----
thread 'grow_bare_repo' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- grow_branch_default stdout ----
thread 'grow_branch_default' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- grow_clone stdout ----
thread 'grow_clone' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- grow_clone_shallow stdout ----
thread 'grow_clone_shallow' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- grow_clone_single_branch stdout ----
thread 'grow_clone_single_branch' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- grow_default_remote_name stdout ----
thread 'grow_default_remote_name' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- grow_default_remote_url stdout ----
thread 'grow_default_remote_url' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- grow_gitconfig stdout ----
thread 'grow_gitconfig' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- grow_gitconfig_append_value stdout ----
thread 'grow_gitconfig_append_value' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- grow_symlinks stdout ----
thread 'grow_symlinks' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- grow_remotes stdout ----
thread 'grow_remotes' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
---- grow_worktree_and_parent stdout ----
thread 'grow_worktree_and_parent' panicked at tests/common/mod.rs:171:5:
assertion `left == right` failed
left: 128
right: 0
failures:
cmd_prune_depth
eval_garden_config_dir
eval_override_variables
git_branches
git_worktree_details
grow_bare_repo
grow_bare_repo_with_config
grow_branch_default
grow_branches_for_clone
grow_clone
grow_clone_shallow
grow_clone_single_branch
grow_default_remote_name
grow_default_remote_url
grow_gitconfig
grow_gitconfig_append_value
grow_remotes
grow_symlinks
grow_worktree_and_parent
test result: FAILED. 24 passed; 19 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.09s
error: test failed, to rerun pass `--test integration_test`
Possible approaches I can think of:
GIT_CONFIG
and GIT_CONFIG_NOSYSTEM
so git commands make use of it. Believe env GIT_CONFIG
is deprecated these days though./home/test
, such as https://github.com/davvid/garden/blob/main/tests/eval_test.rs#L201, so I'd set it up globally as const HOME: &'static str = "/home/test";
and use that as a reference./homeless-shelter
(although that home does not actually exist) so using that would certainly fix all assertions and does not assume a home under a /home
pathI'd like to have a way to show available commands for a given query without looking through the yaml file. If there is one now, I am not aware.
Errors are returned using tab completion for cmd
when no --commands
option was provided to garden completion zsh
. Other command completions appear to work. Command completion for cmd
also appears to work without error after completions are generated with the --commands
option. Reproduction steps:
$ uname -mrs
Darwin 21.6.0 x86_64
$ zsh --version
zsh 5.8.1 (x86_64-apple-darwin21.0)
$ garden --version
garden 0.5.0-beta
$ garden completion zsh > $DIR_IN_FPATH/_garden # no --commands option given
$ garden cmd <tab>
_arguments:comparguments:325: doubled rest argument definition: *::arguments -- Arguments to forward to custom commands:
_arguments:comparguments:325: doubled rest argument definition: *::arguments -- Arguments to forward to custom commands:
_arguments:comparguments:325: doubled rest argument definition: *::arguments -- Arguments to forward to custom commands:
$ garden help <tab>
cmd -- Run custom commands over gardens
completion -- Generate shell completions
eval -- Evaluate garden expressions
exec -- Run commands inside garden environments
grow -- Grow garden worktrees into existence
help -- Print this message or the help of the given subcommand(s)
init -- Initialize a "garden.yaml" garden configuration file
inspect -- Query tree status
list -- List available gardens, groups, trees and commands
plant -- Add pre-existing worktrees to a garden configuration file
prune -- Remove unreferenced Git repositories
shell -- Open a shell in a garden environment
Hiya :)
Would you be open to enabling support for configuring and using Garden from Home-Manager [1], which is a declarative user-config manager within the Nix ecosystem?
I'd be interesting in contributing or supporting this with your guidance.
Home-Manager provides a wide array of configuration options [2] but nothing at all to manage git repos - in this way, it seems Garden and Home-Manager are extremely complementary to each other.
For my purposes, I'd like to use Home-Manager to install Garden, Push/Sync my Garden config file, and perhaps even (optionally) apply that garden config on login.
Happy to discuss more and thanks so much for the project!
[1] https://nix-community.github.io/home-manager/index.html
[2] https://nix-community.github.io/home-manager/options.html
I feel it's convenient to have branch name along with tree name, but maybe it's expensive to call for each branch.
Hello and thank you for garden
!
I wonder if garden
has support for https://git-scm.com/docs/git-worktree or could be extended to support them?
It's useful for me to checkout many worktrees which can get tricky when switching among different workspaces.
I'm still learning about Garden but I appreciate the sanity it brings this challenge and look forward to understanding and using it more over time.
Scenario:
Let's say you have 5 tree in a group thats part of a garden. The name of the command you want to run is call" "Build". So you make a global command. Perfect!
When you go to run that command over the garden you first need to install something. Then after all the trees a built you want to uninstall something.
Is that possible?
$ garden Build
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.