On 03/07/09 Bart Trojanowski said:

> * Michael P. Soulier <[email protected]> [090703 19:50]:
> > How would you make a git alias out of this?
> > 
> > # Simulate hg's addremove command.
> > git_addremove()
> > {
> >     git add -A || return
> >     removed_files=$(git ls-files --deleted -z)
> >     if [ -n "$removed_files" ]; then
> >         echo "$removed_files" | xargs -0 git rm
> >     fi
> > }
> 
> I have not tried this, but it should work...
> 
> !git add -A && removed_files=$(git ls-files --deleted -z) && echo 
> "$removed_files" | xargs -0 git rm
> 
> My shell is zsh, and the pattern of X=$(foo) && bar does work there.

msoul...@anton:~/temp/rst$ git init
Initialized empty Git repository in /home/msoulier/temp/rst/.git/
msoul...@anton:~/temp/rst$ git addremove
fatal: pathspec '
' did not match any files

That complaint is why I have an if check in my function. 

Can I embed one here? I haven't figured out how to get a semicolon into a git
alias. 

Mike
-- 
Michael P. Soulier <[email protected]>
"Any intelligent fool can make things bigger and more complex... It takes a
touch of genius - and a lot of courage to move in the opposite direction."
--Albert Einstein

Attachment: pgpnRQl6xJBWE.pgp
Description: PGP signature

_______________________________________________
Linux mailing list
[email protected]
http://oclug.on.ca/mailman/listinfo/linux

Reply via email to