What I miss from Cogito...

10 messages, 7 authors, 2016-06-15 · open the first message on its own page

What I miss from Cogito...

From: "H. Peter Anvin" <hpa@zytor.com>
Date: 2016-06-15 22:44:25

This much later, there are a few minor things I still miss from Cogito. 
  I believe fixing either would be quite trivial, so I thought I'd post 
a note.

1. The ability to clone into the current directory

    cg-clone had a -c option, which allowed cloning into the current
    directory.  This is particularly useful, since I keep my common
    dot files in a git repository, so all I need to do to set up a new
    machine is to clone that git repository over my empty home directory.

    Native git doesn't have any equivalent, other than:

    git clone -n .... tmp
    mv tmp/.git .
    rm -rf tmp
    git checkout HEAD


2. cg-restore

    Cogito separated "reset" and "restore".  This is a syntactic sugar
    issue, but having to type "git reset --hard -- path" makes me
    nervous, especially since hitting Enter at the wrong time could have
    serious and irrevocable consequences.

    I also note that this particular use of "git reset" is actually
    undocumented, but it seems to work.


Those are pretty much the only Cogito command I have found myself either 
missing or using since I made a mental note to track this stuff, a few 
months ago.

	-hpa

Re: What I miss from Cogito...

From: Theodore Tso <tytso@MIT.EDU>
Date: 2016-06-15 22:44:25

On Sun, Mar 23, 2008 at 10:15:48AM -0700, H. Peter Anvin wrote:
2. cg-restore

   Cogito separated "reset" and "restore".  This is a syntactic sugar
   issue, but having to type "git reset --hard -- path" makes me
   nervous, especially since hitting Enter at the wrong time could have
   serious and irrevocable consequences.

   I also note that this particular use of "git reset" is actually
   undocumented, but it seems to work.
I didn't think "git reset --hard -- <pathame>" was valid, since it's
not documented in the man page.

I have the following in my path as "git-revert-file" (which is easier
to type and less dangerous than typing "git reset --hard -- <path>"):

#!/bin/sh
#
prefix=$(git rev-parse --show-prefix)

for i in $*
do
        git show HEAD:$prefix$i > $i
done


							- Ted

Re: What I miss from Cogito...

From: "H. Peter Anvin" <hpa@zytor.com>
Date: 2016-06-15 22:44:25

Theodore Tso wrote:
On Sun, Mar 23, 2008 at 10:15:48AM -0700, H. Peter Anvin wrote:
quoted
2. cg-restore

   Cogito separated "reset" and "restore".  This is a syntactic sugar
   issue, but having to type "git reset --hard -- path" makes me
   nervous, especially since hitting Enter at the wrong time could have
   serious and irrevocable consequences.

   I also note that this particular use of "git reset" is actually
   undocumented, but it seems to work.
I didn't think "git reset --hard -- <pathame>" was valid, since it's
not documented in the man page.

I have the following in my path as "git-revert-file" (which is easier
to type and less dangerous than typing "git reset --hard -- <path>"):

#!/bin/sh
#
prefix=$(git rev-parse --show-prefix)

for i in $*
do
        git show HEAD:$prefix$i > $i
done
FWIW, cg-restore is a 131-line shell script, so one can assume it's not 
just doing it for fun.

	-hpa

Re: What I miss from Cogito...

From: Luciano Rocha <hidden>
Date: 2016-06-15 22:44:25

On Sun, Mar 23, 2008 at 01:38:41PM -0400, Theodore Tso wrote:
On Sun, Mar 23, 2008 at 10:15:48AM -0700, H. Peter Anvin wrote:
quoted
2. cg-restore

   Cogito separated "reset" and "restore".  This is a syntactic sugar
   issue, but having to type "git reset --hard -- path" makes me
   nervous, especially since hitting Enter at the wrong time could have
   serious and irrevocable consequences.

   I also note that this particular use of "git reset" is actually
   undocumented, but it seems to work.
I didn't think "git reset --hard -- <pathame>" was valid, since it's
not documented in the man page.

I have the following in my path as "git-revert-file" (which is easier
to type and less dangerous than typing "git reset --hard -- <path>"):

#!/bin/sh
#
prefix=$(git rev-parse --show-prefix)

for i in $*
do
        git show HEAD:$prefix$i > $i
done
I use git checkout path ...

Isn't that the same thing?

-- 
Luciano Rocha [off-list ref]
Eurotux Informática, S.A. <http://www.eurotux.com/>

Re: What I miss from Cogito...

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:44:25

Hi,

On Sun, 23 Mar 2008, H. Peter Anvin wrote:
1. The ability to clone into the current directory

   cg-clone had a -c option, which allowed cloning into the current
   directory.  This is particularly useful, since I keep my common
   dot files in a git repository, so all I need to do to set up a new
   machine is to clone that git repository over my empty home directory.

   Native git doesn't have any equivalent, other than:

   git clone -n .... tmp
   mv tmp/.git .
   rm -rf tmp
   git checkout HEAD
Well, it has:

	$ git init
	$ git remote add -f origin <url>
	$ git checkout -b master origin/master

If you really want to track /etc with Git, you can do that easily, and you 
can easily take the flak for a not-so-popular workflow.

Ciao,
Dscho

Re: What I miss from Cogito...

From: Mike Hommey <hidden>
Date: 2016-06-15 22:44:25

On Sun, Mar 23, 2008 at 06:21:02PM +0000, Luciano Rocha wrote:
On Sun, Mar 23, 2008 at 01:38:41PM -0400, Theodore Tso wrote:
quoted
On Sun, Mar 23, 2008 at 10:15:48AM -0700, H. Peter Anvin wrote:
quoted
2. cg-restore

   Cogito separated "reset" and "restore".  This is a syntactic sugar
   issue, but having to type "git reset --hard -- path" makes me
   nervous, especially since hitting Enter at the wrong time could have
   serious and irrevocable consequences.

   I also note that this particular use of "git reset" is actually
   undocumented, but it seems to work.
I didn't think "git reset --hard -- <pathame>" was valid, since it's
not documented in the man page.

I have the following in my path as "git-revert-file" (which is easier
to type and less dangerous than typing "git reset --hard -- <path>"):

#!/bin/sh
#
prefix=$(git rev-parse --show-prefix)

for i in $*
do
        git show HEAD:$prefix$i > $i
done
I use git checkout path ...

Isn't that the same thing?
Yes, it does the same. Note there is unfortunately no shorthand for
git show $arbitrary_commit:$path > $path

Mike

Re: What I miss from Cogito...

From: Mike Hommey <hidden>
Date: 2016-06-15 22:44:25

On Sun, Mar 23, 2008 at 08:00:17PM +0100, Mike Hommey wrote:
On Sun, Mar 23, 2008 at 06:21:02PM +0000, Luciano Rocha wrote:
quoted
On Sun, Mar 23, 2008 at 01:38:41PM -0400, Theodore Tso wrote:
quoted
On Sun, Mar 23, 2008 at 10:15:48AM -0700, H. Peter Anvin wrote:
quoted
2. cg-restore

   Cogito separated "reset" and "restore".  This is a syntactic sugar
   issue, but having to type "git reset --hard -- path" makes me
   nervous, especially since hitting Enter at the wrong time could have
   serious and irrevocable consequences.

   I also note that this particular use of "git reset" is actually
   undocumented, but it seems to work.
I didn't think "git reset --hard -- <pathame>" was valid, since it's
not documented in the man page.

I have the following in my path as "git-revert-file" (which is easier
to type and less dangerous than typing "git reset --hard -- <path>"):

#!/bin/sh
#
prefix=$(git rev-parse --show-prefix)

for i in $*
do
        git show HEAD:$prefix$i > $i
done
I use git checkout path ...

Isn't that the same thing?
Yes, it does the same. Note there is unfortunately no shorthand for
git show $arbitrary_commit:$path > $path
Actually, git checkout $arbitrary_commit -- $path works (and puts the
contents in the index). Somehow, I thought it didn't work...

Mike

Re: What I miss from Cogito...

From: Daniel Barkalow <hidden>
Date: 2016-06-15 22:44:25

On Sun, 23 Mar 2008, H. Peter Anvin wrote:
This much later, there are a few minor things I still miss from Cogito.  I
believe fixing either would be quite trivial, so I thought I'd post a note.

1. The ability to clone into the current directory

   cg-clone had a -c option, which allowed cloning into the current
   directory.  This is particularly useful, since I keep my common
   dot files in a git repository, so all I need to do to set up a new
   machine is to clone that git repository over my empty home directory.

   Native git doesn't have any equivalent, other than:

   git clone -n .... tmp
   mv tmp/.git .
   rm -rf tmp
   git checkout HEAD
Maybe "git --work-tree=. clone <remote>"? It currently complains about the 
directory existing, but we could have a flag to override that. And this 
ends up with a sort of neat arrangement where your home directory is "Not 
a git repository", but if you go into the subdirectory that has the repo 
files, you can do all the usual stuff. This helps to avoid the case where 
you forget to do "git init" in a new project and accidentally check things 
into your dotfiles.

	-Daniel
*This .sig left intentionally blank*

Re: What I miss from Cogito...

From: "H. Peter Anvin" <hpa@zytor.com>
Date: 2016-06-15 22:44:25

Daniel Barkalow wrote:
Maybe "git --work-tree=. clone <remote>"? It currently complains about the 
directory existing, but we could have a flag to override that. And this 
ends up with a sort of neat arrangement where your home directory is "Not 
a git repository", but if you go into the subdirectory that has the repo 
files, you can do all the usual stuff. This helps to avoid the case where 
you forget to do "git init" in a new project and accidentally check things 
into your dotfiles.

	-Daniel
That sounds cumbersome.

	-hpa

Re: What I miss from Cogito...

From: Petr Baudis <hidden>
Date: 2016-06-15 22:44:26

On Sun, Mar 23, 2008 at 10:46:52AM -0700, H. Peter Anvin wrote:
Theodore Tso wrote:
quoted
#!/bin/sh
#
prefix=$(git rev-parse --show-prefix)
for i in $*
do
        git show HEAD:$prefix$i > $i
done
FWIW, cg-restore is a 131-line shell script, so one can assume it's not 
just doing it for fun.
Actually, such an assumption is not safe, simply since it was written
long before the :-syntax and many other nice features were invented; if
one wants to do things in Git sanely these days, it's not even safe to
look at Cogito's source code for inspiration anymore as it had to work
only with really hardcore primitives.

(And 38 lines is documentation.  ;-)

-- 
				Petr "Pasky" Baudis
Whatever you can do, or dream you can, begin it.
Boldness has genius, power, and magic in it.	-- J. W. von Goethe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help