* RFC: Folder Git @ 2011-04-25 8:32 Victor Engmark 2011-04-25 8:52 ` Jon Seymour 2011-04-25 10:39 ` Jakub Narebski 0 siblings, 2 replies; 6+ messages in thread From: Victor Engmark @ 2011-04-25 8:32 UTC (permalink / raw) To: git Most days I work on more than one repository, and on more than one machine. I've never needed the "--" argument separator so far. This combination makes it useful to have a way to run Git commands on several repositories at once. A one-time solution would of course be a for-loop which checks for a .git directory before running the given command, but this operation ended up being frequent enough that I wrote a script for it: fgit <https://github.com/l0b0/fgit/blob/master/fgit.sh>. Features include: * Runs the Git command given in all specified directories which have a .git subdirectory, and warns about any that lack this directory. * Should work with any path, containing spaces, newlines or other exotic characters. * Should work with any Git command that doesn't require the "--" separator between the options and arguments. * Prints the Git command before running it, for logging and repetition. * errexit and nounset are active for each line, with one exception: errexit is disabled for the running of the command, to allow it to continue to other repositories. Issues: * Don't know if anyone else has used it. Probably not, so there's bound to be issues (especially since it's been changed quite a bit the last couple days for this RFC). Is there a place for such a tool in Git porcelain or elsewhere in the Git project, or should it be kept completely separate? -- Victor Engmark ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RFC: Folder Git 2011-04-25 8:32 RFC: Folder Git Victor Engmark @ 2011-04-25 8:52 ` Jon Seymour 2011-04-26 6:47 ` Victor Engmark 2011-04-25 10:39 ` Jakub Narebski 1 sibling, 1 reply; 6+ messages in thread From: Jon Seymour @ 2011-04-25 8:52 UTC (permalink / raw) To: Victor Engmark; +Cc: git On Mon, Apr 25, 2011 at 6:32 PM, Victor Engmark <victor.engmark@gmail.com> wrote: continue to other repositories. > > Issues: > * Don't know if anyone else has used it. Probably not, so there's > bound to be issues (especially since it's been changed quite a bit the > last couple days for this RFC). > Victor, Certainly seems like a common need. I had a similar solution which I used for a while. In the end, however, I found that creating a super-module in the top directory that contains the other git directories as git submodules allowed me to use a standard feature of git to achieve the same effect. So: git submodule foreach git gc --aggressive I know this won't suit every use case, but it does work in an environment where the set of repos you are operating on have a degree of coherence and it makes sense to set up a submodule for them. In this particular case this is the only reason why I use submodules - I don't use them for configuration management, for example, simply as a handy way to exploit git submodule foreach. Have you considered using git submodules in this way? jon. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RFC: Folder Git 2011-04-25 8:52 ` Jon Seymour @ 2011-04-26 6:47 ` Victor Engmark 2011-04-26 7:03 ` Jon Seymour 0 siblings, 1 reply; 6+ messages in thread From: Victor Engmark @ 2011-04-26 6:47 UTC (permalink / raw) To: Jon Seymour; +Cc: git On Mon, Apr 25, 2011 at 10:52 AM, Jon Seymour <jon.seymour@gmail.com> wrote: > On Mon, Apr 25, 2011 at 6:32 PM, Victor Engmark > <victor.engmark@gmail.com> wrote: > continue to other repositories. >> >> Issues: >> * Don't know if anyone else has used it. Probably not, so there's >> bound to be issues (especially since it's been changed quite a bit the >> last couple days for this RFC). >> > > Victor, > > Certainly seems like a common need. I had a similar solution which I > used for a while. > > In the end, however, I found that creating a super-module in the top > directory that contains > the other git directories as git submodules allowed me to use a > standard feature of git to achieve the same effect. > > So: > > git submodule foreach git gc --aggressive > > I know this won't suit every use case, but it does work in an > environment where the set of repos you are operating on have a degree > of coherence and it makes sense to set up a submodule for them. In > this particular case this is the only reason why I use submodules - I > don't use them for configuration management, for example, simply as a > handy way to exploit git submodule foreach. > > Have you considered using git submodules in this way? I didn't know you could use them this way, and it's a nicely "Gitonic" way of doing it. I don't think this would fit my case, since the repos are not much related and it's a more verbose solution which takes longer to set up than copying a single script. A compromise could be to set up a Git alias `sgit="git submodule foreach git"`, if that'll work as expected. -- Victor Engmark ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RFC: Folder Git 2011-04-26 6:47 ` Victor Engmark @ 2011-04-26 7:03 ` Jon Seymour 0 siblings, 0 replies; 6+ messages in thread From: Jon Seymour @ 2011-04-26 7:03 UTC (permalink / raw) To: Victor Engmark; +Cc: git A concept I played with at one point was to have the idea of a working set, which is a list repos. You could then apply to the whole working set any command after changing to the root directory of each repo, much like git submodules does, but without any suggestion of any other relationship between the repos. The details working set were stored in the global git configuration. In principle, you could have multiple working sets and switch which one was active at a given time. So, you'd do something like: git working-set foreach {cmd} {args...} git working-set activate working-set-name git working-set add repo-url git working-set remove repo-url and so on... jon. On Tue, Apr 26, 2011 at 4:47 PM, Victor Engmark <victor.engmark@gmail.com> wrote: > On Mon, Apr 25, 2011 at 10:52 AM, Jon Seymour <jon.seymour@gmail.com> wrote: >> On Mon, Apr 25, 2011 at 6:32 PM, Victor Engmark >> <victor.engmark@gmail.com> wrote: >> continue to other repositories. >>> >>> Issues: >>> * Don't know if anyone else has used it. Probably not, so there's >>> bound to be issues (especially since it's been changed quite a bit the >>> last couple days for this RFC). >>> >> >> Victor, >> >> Certainly seems like a common need. I had a similar solution which I >> used for a while. >> >> In the end, however, I found that creating a super-module in the top >> directory that contains >> the other git directories as git submodules allowed me to use a >> standard feature of git to achieve the same effect. >> >> So: >> >> git submodule foreach git gc --aggressive >> >> I know this won't suit every use case, but it does work in an >> environment where the set of repos you are operating on have a degree >> of coherence and it makes sense to set up a submodule for them. In >> this particular case this is the only reason why I use submodules - I >> don't use them for configuration management, for example, simply as a >> handy way to exploit git submodule foreach. >> >> Have you considered using git submodules in this way? > > I didn't know you could use them this way, and it's a nicely "Gitonic" > way of doing it. I don't think this would fit my case, since the repos > are not much related and it's a more verbose solution which takes > longer to set up than copying a single script. A compromise could be > to set up a Git alias `sgit="git submodule foreach git"`, if that'll > work as expected. > > -- > Victor Engmark > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RFC: Folder Git 2011-04-25 8:32 RFC: Folder Git Victor Engmark 2011-04-25 8:52 ` Jon Seymour @ 2011-04-25 10:39 ` Jakub Narebski 2011-04-26 6:59 ` Victor Engmark 1 sibling, 1 reply; 6+ messages in thread From: Jakub Narebski @ 2011-04-25 10:39 UTC (permalink / raw) To: Victor Engmark; +Cc: git Victor Engmark <victor.engmark@gmail.com> writes: [...] > I wrote a script for it: fgit > <https://github.com/l0b0/fgit/blob/master/fgit.sh>. Features include: > * Runs the Git command given in all specified directories which have a > .git subdirectory, and warns about any that lack this directory. > * Should work with any path, containing spaces, newlines or other > exotic characters. > * Should work with any Git command that doesn't require the "--" > separator between the options and arguments. > * Prints the Git command before running it, for logging and repetition. > * errexit and nounset are active for each line, with one exception: > errexit is disabled for the running of the command, to allow it to > continue to other repositories. Do you think this tool is mature and stable enough to add it to https://git.wiki.kernel.org/index.php/InterfacesFrontendsAndTools page on Git Wiki? -- Jakub Narebski Poland ShadeHawk on #git ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RFC: Folder Git 2011-04-25 10:39 ` Jakub Narebski @ 2011-04-26 6:59 ` Victor Engmark 0 siblings, 0 replies; 6+ messages in thread From: Victor Engmark @ 2011-04-26 6:59 UTC (permalink / raw) To: Jakub Narebski; +Cc: git On Mon, Apr 25, 2011 at 12:39 PM, Jakub Narebski <jnareb@gmail.com> wrote: > Victor Engmark <victor.engmark@gmail.com> writes: > > [...] >> I wrote a script for it: fgit >> <https://github.com/l0b0/fgit/blob/master/fgit.sh>. Features include: >> * Runs the Git command given in all specified directories which have a >> .git subdirectory, and warns about any that lack this directory. >> * Should work with any path, containing spaces, newlines or other >> exotic characters. >> * Should work with any Git command that doesn't require the "--" >> separator between the options and arguments. >> * Prints the Git command before running it, for logging and repetition. >> * errexit and nounset are active for each line, with one exception: >> errexit is disabled for the running of the command, to allow it to >> continue to other repositories. > > Do you think this tool is mature and stable enough to add it to > > https://git.wiki.kernel.org/index.php/InterfacesFrontendsAndTools > > page on Git Wiki? It's already there, so I guess someone thought it was :) I'll try to fix the description as soon as the web page works with Firefox (I could only load the contents with wget). -- Victor Engmark ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-04-26 7:03 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-04-25 8:32 RFC: Folder Git Victor Engmark 2011-04-25 8:52 ` Jon Seymour 2011-04-26 6:47 ` Victor Engmark 2011-04-26 7:03 ` Jon Seymour 2011-04-25 10:39 ` Jakub Narebski 2011-04-26 6:59 ` Victor Engmark
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).