Skip to contentSkip to conversation

cg-mv

DISCUSSION Zack Brown 4 participants 5 messages Jun 15, 2016

lore
Share & tools
lore

Zack Brown

author
#0 lore raw

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

Signature · 1 line
Zack Brown
#1 lore raw

Dear diary, on Fri, Oct 07, 2005 at 04:33:33PM CEST, I got a letter where Zack Brown <[email protected]> told me that...

Quoted 1 line

Hi,

Hello,

Quoted 11 lines

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?

Signature · 4 lines
				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.
author
#2 lore raw

Re: cg-mv]

Quoted 13 lines · Petr Baudis

Dear diary, on Fri, Oct 07, 2005 at 04:33:33PM CEST, I got a letter where Zack Brown <[email protected]> told me that...

Quoted 1 line

Hi,

Hello,

Quoted 7 lines

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:

Quoted 7 lines
Quoted 4 lines

#!/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.

Quoted 11 lines

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

Quoted 6 lines
Signature · 5 lines
-- 
				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.
Signature · 1 line
Zack Brown
#3 lore raw
In reply to Petr Baudis
Quoted 11 lines · Petr Baudis

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
Quoted 1 line

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

#4 lore raw
In reply to Petr Baudis
Quoted 10 lines · Petr Baudis

Dear diary, on Fri, Oct 07, 2005 at 04:33:33PM CEST, I got a letter where Zack Brown <[email protected]> told me that...

Quoted 7 lines

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.

Signature · 4 lines
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