git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* cg-mv
@ 2005-10-07 14:33 Zack Brown
  2005-10-12 10:07 ` cg-mv Petr Baudis
  0 siblings, 1 reply; 5+ messages in thread
From: Zack Brown @ 2005-10-07 14:33 UTC (permalink / raw)
  To: Git Mailing List

Hi,

IIRC, file renaming is something we only care about at read time, we don't
actually need to track it while making the change, because git allows us to
track data from file to file without having to tell it that the data is moving.

So, just to keep certain people happy, why not have the cg-mv command defined to
something like this:

#!/bin/bash
cp $1 $2
cg-rm $1
cg-add $2


Be well,
Zack

-- 
Zack Brown

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cg-mv
  2005-10-07 14:33 cg-mv Zack Brown
@ 2005-10-12 10:07 ` Petr Baudis
  2005-10-12 13:14   ` cg-mv Josef Weidendorfer
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Petr Baudis @ 2005-10-12 10:07 UTC (permalink / raw)
  To: Zack Brown; +Cc: Git Mailing List

Dear diary, on Fri, Oct 07, 2005 at 04:33:33PM CEST, I got a letter
where Zack Brown <zbrown@tumblerings.org> told me that...
> Hi,

Hello,

> IIRC, file renaming is something we only care about at read time, we don't
> actually need to track it while making the change, because git allows us to
> track data from file to file without having to tell it that the data is moving.
> 
> So, just to keep certain people happy, why not have the cg-mv command defined to
> something like this:
> 
> #!/bin/bash
> cp $1 $2
> cg-rm $1
> cg-add $2

so it should keep the file under the original name as well, but
untraced? That's weird. What about

	#!/usr/bin/env bash

	if [ -e $2 ]; then
		! got_parameter -f && die "dest exists"
		[ -e $1 ] || die "no source nor destination"
	fi
	( [ -e $1 ] && mv $1 $2 ) && cg-add $2 && cg-rm $1

plus quoting and stuff?

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cg-mv
  2005-10-12 10:07 ` cg-mv Petr Baudis
@ 2005-10-12 13:14   ` Josef Weidendorfer
  2005-10-12 14:28   ` cg-mv] Zack Brown
  2005-10-12 22:32   ` cg-mv Horst von Brand
  2 siblings, 0 replies; 5+ messages in thread
From: Josef Weidendorfer @ 2005-10-12 13:14 UTC (permalink / raw)
  To: git

On Wednesday 12 October 2005 12:07, Petr Baudis wrote:
> so it should keep the file under the original name as well, but
> untraced? That's weird. What about
>
> 	#!/usr/bin/env bash
>
> 	if [ -e $2 ]; then
> 		! got_parameter -f && die "dest exists"
> 		[ -e $1 ] || die "no source nor destination"
> 	fi
> 	( [ -e $1 ] && mv $1 $2 ) && cg-add $2 && cg-rm $1
>
> plus quoting and stuff?

Wishlist...
Please make it similar to mv:
* Rename directories, too
* If last argument is an existing directory
  move given files/directories into that directory

Josef

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cg-mv]
  2005-10-12 10:07 ` cg-mv Petr Baudis
  2005-10-12 13:14   ` cg-mv Josef Weidendorfer
@ 2005-10-12 14:28   ` Zack Brown
  2005-10-12 22:32   ` cg-mv Horst von Brand
  2 siblings, 0 replies; 5+ messages in thread
From: Zack Brown @ 2005-10-12 14:28 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Git Mailing List

On Wed, Oct 12, 2005 at 12:07:57PM +0200, Petr Baudis wrote:
> Dear diary, on Fri, Oct 07, 2005 at 04:33:33PM CEST, I got a letter
> where Zack Brown <zbrown@tumblerings.org> told me that...
> > Hi,
> 
> Hello,
> 
> > IIRC, file renaming is something we only care about at read time, we don't
> > actually need to track it while making the change, because git allows us to
> > track data from file to file without having to tell it that the data is moving.
> > 
> > So, just to keep certain people happy, why not have the cg-mv command defined to
> > something like this:
> > 
> > #!/bin/bash
> > cp $1 $2
> > cg-rm $1
> > cg-add $2
> 
> so it should keep the file under the original name as well, but
> untraced? That's weird.

Yes, I mistyped. cp is wrong.

> What about
> 
> 	#!/usr/bin/env bash
> 
> 	if [ -e $2 ]; then
> 		! got_parameter -f && die "dest exists"
> 		[ -e $1 ] || die "no source nor destination"
> 	fi
> 	( [ -e $1 ] && mv $1 $2 ) && cg-add $2 && cg-rm $1
> 
> plus quoting and stuff?

Yes, that's nicer. Maybe the last line should be:

( [ -e $1 ] && mv $1 $2 ) && cg-add $2 && cg-rm $1 || die "unable to rename file"

But you've already done "-e $1" earlier, right? So maybe you don't need it at
the end. Just have:

mv $1 $2 && cg-add $2 && cg-rm $1 || die "unable to rename file"

No?

Be well,
Zack

> 
> -- 
> 				Petr "Pasky" Baudis
> Stuff: http://pasky.or.cz/
> VI has two modes: the one in which it beeps and the one in which
> it doesn't.

-- 
Zack Brown

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cg-mv
  2005-10-12 10:07 ` cg-mv Petr Baudis
  2005-10-12 13:14   ` cg-mv Josef Weidendorfer
  2005-10-12 14:28   ` cg-mv] Zack Brown
@ 2005-10-12 22:32   ` Horst von Brand
  2 siblings, 0 replies; 5+ messages in thread
From: Horst von Brand @ 2005-10-12 22:32 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Zack Brown, Git Mailing List

Petr Baudis <pasky@suse.cz> wrote:
> Dear diary, on Fri, Oct 07, 2005 at 04:33:33PM CEST, I got a letter
> where Zack Brown <zbrown@tumblerings.org> told me that...

> > IIRC, file renaming is something we only care about at read time, we
> > don't actually need to track it while making the change, because git
> > allows us to track data from file to file without having to tell it
> > that the data is moving.

> > So, just to keep certain people happy, why not have the cg-mv command
> > defined to something like this:

What about git-rename(1)? For completeness, just wrap it into cg-mv.
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-10-13 13:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-07 14:33 cg-mv Zack Brown
2005-10-12 10:07 ` cg-mv Petr Baudis
2005-10-12 13:14   ` cg-mv Josef Weidendorfer
2005-10-12 14:28   ` cg-mv] Zack Brown
2005-10-12 22:32   ` cg-mv Horst von Brand

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).