[Novalug] quoting git alias

James Ewing Cottrell III jecottrell3@comcast.net
Wed Mar 23 01:37:36 EDT 2016


That's Too Complicated for an Alias. Make it a Script.

First off, half your Quoting Issues go away. In particular, your 
"Internal Quotes" actually Go Away, so that
$1, the sed expression, and 'No Directory $1' are actually OUTSIDE the 
quotes.

I would expect to see "directory: not found" as an error message from 
the shell, if the command even parses.

Second, the command is Ugly and Unreadable.

Third, why make an alias after all? Just make a function in the first 
place! Which is essentially a...

...script!

JIM

P.S. WTF does the ! in =!f() do?!?

On 3/21/2016 1:10 AM, shawn wilson via Novalug wrote:
> ok, so it seems that every time i ask a question here, it's about
> quoting something (the last one was anyway). OTOH, it worked then,
> so...
>
> This is a git alias and something's failing in the second
> filter-branch command. Any help would be appreciated (as I have no
> idea what's going wrong with those 5 lines and am getting tired of
> searching through my history for this stuff):
>
>    reapdir = "!f() { \
>      if [ -d "$1" ] ; then \
>        git filter-branch --prune-empty --subdirectory-filter "$1" -- --all && \
>        git gc --aggressive && \
>        git prune && \
>        git filter-branch -f --prune-empty --index-filter '\
>          git ls-files -s \
>            | sed \"s-\\t-&$1-\" \
>            | GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index
> --index-info && \
>              mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE'; \
>      else \
>        echo "No directory $1"; \
>      fi; }; \
>    f"
> **********************************************************************
> The Novalug mailing list is hosted by firemountain.net.
>
> To unsubscribe or change delivery options:
> http://www.firemountain.net/mailman/listinfo/novalug
>




More information about the Novalug mailing list