twosigma / git-meta

Repository for the git-meta project -- build your own monorepo using Git submodules
http://twosigma.github.io/git-meta
BSD 3-Clause "New" or "Revised" License
216 stars 50 forks source link

implement git meta add verbose flag #874

Closed geeli123 closed 1 year ago

geeli123 commented 1 year ago

Implement git meta add -v ...

Example:

georgeli@lhs:~/dev/test$ $HOME/dev/gitmeta/ext/public/twosigma/gitmeta2/bin/git-meta status
On branch master.
Changes not staged for commit:
  (use "git meta add <file>..." to update what will be committed)
  (commit or discard the untracked or modified content in submodules)

        modified:     ext/public/twosigma/gitmeta2/node/lib/patch-tree.js
        deleted:      ts/sdlc/trygit/georgeli
        modified:     ts/sdlc/trygit/gobisa

Untracked files:
  (use "git meta add <file>..." to include in what will be committed)

        ext/public/twosigma/gitmeta2/node/newfile

georgeli@lhs:~/dev/test$ $HOME/dev/gitmeta/ext/public/twosigma/gitmeta2/bin/git-meta add --help
usage: git-meta add [-h] [-u] [-v] [--meta] [paths [paths ...]]

This command updates the (logical) mono-repo index using the current content
found in the working tree, to prepare the content staged for the next commit.
If a path is specified, this command will stage all modified content in the
meta-repo and submodules rooted in that path. Note that the index of a
mono-repo is a logical construct derived from the state of the indices of its
meta-repo and open submodules. Thus, content that is staged in a submodule is
added to the index for that submodule; the index of the meta-repo is not
affected. Note also that from the perspective of the mono-repo, the status of
a submodule in the index is irrelevant: 'git meta commit' always stages
changes to submodules with new commits in their working directories.

Positional arguments:
  paths          the paths to add

Optional arguments:
  -h, --help     Show this help message and exit.
  -u, --update   Update tracked files.
  -v, --verbose  Log all files are updated / added to / removed from index
  --meta         Include changes to the meta-repo; disabled by default to
                 improve performance and avoid accidental changes to the
                 meta-repo.
georgeli@lhs:~/dev/test$ $HOME/dev/gitmeta/ext/public/twosigma/gitmeta2/bin/git-meta add . -v

ext/public/twosigma/gitmeta2: add 'node/lib/patch-tree.js'
ext/public/twosigma/gitmeta2: add 'node/newfile'
ts/sdlc/trygit: remove 'georgeli'
ts/sdlc/trygit: add 'gobisa'
georgeli@lhs:~/dev/test$ gitm status

On branch master.
Changes to be committed:
  (use "git meta reset HEAD <file>..." to unstage)

        modified:     ext/public/twosigma/gitmeta2/node/lib/patch-tree.js
        new file:     ext/public/twosigma/gitmeta2/node/newfile
        deleted:      ts/sdlc/trygit/georgeli
        modified:     ts/sdlc/trygit/gobisa
tsiq-shu commented 1 year ago

@geeli123 can you rebase when you have a chance? And then if the check passes, we'll get this merged and pulled in