Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:01

Bryan Larsen [off-list ref] writes:
For the record, "${XARGS} -0r" may be uglier than "xargs -0r", but
replacing it with several lines of shell magic is a loss.
OK, OK, the one I suggested for xargs was _U_G_L_Y_.

The one Linus suggested looks to me the cleanest.  That is, to
give an extra parameter upfront to the command run by xargs.  My
favorite trick is like this:

  git-fsck-cache --cache --unreachable "$@" |
  sed -ne '/unreachable /{
      s/unreachable [^ ][^ ]* //
      s|\(..\)|\1/|p
  }' | {
          cd "$GIT_OBJECT_DIRECTORY" || exit
-         xargs -r $dryrun rm -f
+         xargs $dryrun rm -f ""
  }

Dry-run would say: 

    rm -f  00/012345...
    rm -f  01/234567...

without visual distraction of having printable phoney names, or
just (with an invisible trailing space):

    rm -f  

During a real run, "rm -f" would not complain "cannot remove `':
Is a directory", either.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help