Re: [PATCH] status&commit: Teach them to show submodule commit summary

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

 



Hello,

A couple of portability nits:

* Ping Yin wrote on Mon, Nov 12, 2007 at 03:21:17PM CET:
[...]
> +
> +	# TODO: quote module names containing space or tab
> +	test -n "$modules" && echo -e "# Submodules modifiled: "$modules"\n#"

Typo: s/modifiled/modified/

Then, "echo -e" is not portable (and not used elsewhere in git), but you
can just use this instead:
  test ... && { echo "# ..."; echo "#"; }

Also, it so happens you leave $modules outside quotes which will drop
multiple adjacent white spaces.  Did you mean to use
  echo "# Submodules modified: \"$modules\""
?

> +	OLDIFS=$IFS
> +	IFS=$'\n\r'	# '\r' for mac os

$' is not portable (and not POSIX either).  For example pdksh, OpenBSD
/bin/sh (which are both similar) will add "$" to the list of sepators
here, compare this: 

  $ foo=$'\n'; echo ".$foo."
  .$
  .

And at least some ash/dash versions will not interpret this as a newline
at all:
  .$\n.

You can instead just use a literal newline:
  IFS='
  '

(minus the indentation).  And add a literal carriage return if need be
(is that really needed on Mac OS?), though you may want to enclose that
in another pair of quotes to avoid it being "optimized" away by some
editor.

Cheers,
Ralf
-
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]

  Powered by Linux