Re: git 'new' alias

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

>   $ git config alias.one
>   !f() { r=$1; shift; echo $r@{1}..$r@{0} "$@"; }; f

(which, I've just discovered, should be written as

[alias]
        one = "!f() { r=$1; shift; echo $r@{1}..$r@{0} "$@"; }; f"

otherwise "git config" messes up with the ; in the line)

> which I think was the original intent (modulo me replacing "git log"
> with "echo" for debugging, of course).

The original intent was mis-specified ;-).

I think I originally made the alias to do

git new               # give me new stuff on current branch
git new origin/master # same, for origin/master

and tried to enrich it to allow

git new master --oneline

without thinking about what

git new --oneline

should do (and obviously, without really testing it, I guess I had one
version of the alias allowing each senario, and none allowing all of
them).

I now have this, which is really ugly in a config file, but does the
DWIMery I want:

	new = "!f () { if echo \"$1\" | grep -q -e '^-' -e '^$'; then r=; else r=$1; shift; fi; git log $r@{1}..$r@{0} \"$@\"; } && f"

(this one has even been vaguely tested ;-) )

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]