git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git alias quoting help

From
SWshawn wilson <ag4ve.us@gmail.com>
Date
Mar 31, 2016, 14:27 UTC
Message-ID
<CAH_OBie1Bc==wPByestESHz-K8ezC7f5A1D=t1SsP9=Sd-y-eg@mail.gmail.com>
In-Reply-To
<CAH_OBievBBjzLwPZf3-qLn-SQyJG0UHhbdkvyZFfC8b-TsTUJQ@mail.gmail.com>

BTW, just trying to get filter-branch to interpret the bash script string correctly now and it still isn't working:

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 \
" HEAD
 I'm guessing bash is grabbing my actual bash shell is grabbing the
GIT_INDEX_FILE declaration for itself. If this is the case, I'm not
sure how to stop it - tried var\=\$var.new and that passes the '\='
which totally messes things up.

Rewrite ef54b77e59c7f4e18f00168ba88a8d2fee795802 (1/76)mv: cannot stat `/<repo path>/.git-rewrite/t/../index.new': No such file or directory index filter failed: git ls-files -s | sed "s-\t\"*-&cookbooks/adjoin/-" | GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info && mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE

On Wed, Mar 30, 2016 at 12:13 AM, shawn wilson <ag4ve.us@gmail.com> wrote:
Show 24 quoted lines
> I've also tried to make this a plain bash script (w/o the function or
> if statements and am failing at the same place). The issue seems to be
> with the quoting in the filter-branch | ls-files bit. Also, the end
> goal here is to be able to move a directory from one repo and keep the
> history. While this works if I do it at the command line, it's just
> too many steps (is tedious). Also, if there's a way to do the same
> thing with multiple directories in one shot, (or make this work with
> something like: cookbooks/{a,b,c} # as a parameter) that'd be perfect.
>
>   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"
Previous: shawn wilsonNext: shawn wilson
Message 2 of 6 in “git alias quoting help”
  1. shawn wilsonMar 30, 2016
  2. shawn wilsonMar 31, 2016
  3. shawn wilsonApr 1, 2016
  4. shawn wilsonApr 1, 2016
  5. Christian CouderApr 1, 2016
  6. shawn wilsonApr 1, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.