Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: version.h and ChangeLog



On 2013-04-09 at 18:47 +0200, Simon Ruderich wrote:
> Appending something like "-local-<ref>" is difficult because
> what's considered local depends on how Git is used. We could
> check "origin"/master but what if I call the remote branch
> "upstream"?

At some point, the onus of work shifts to the person who is violating
convention.  I mean, I might have used stty to remap intr to ^R.  Most
tools are entitled to assume that intr is ^C without bothering to check.
Still, robust tooling might support the unusual.

My normal approach here is to use a variable which can be overriden from
the environment:

  : ${ZSH_GIT_ORIGIN_REMOTENAME:=origin}

Then if someone really wants to work with a different name, for another
tooling environment, they can `export ZSH_GIT_ORIGIN_REMOTENAME=upstream`

A more git-like approach is be to stash the config in a zsh section of
the git config, so that it can be set on a per-repo basis or "globally"
if needed for an environment.  This might be more to taste, avoiding
25-character environment variable names?

% git config zsh.master origin
% git config --get-regexp zsh\..+
zsh.master origin
% git config --get zsh.master
origin
% tail -2 .git/config
[zsh]
	master = origin
%

Since this config is not sync'd from any remote, it's entirely available
for local overrides.

-Phil

Attachment: pgpARjH1RBE0f.pgp
Description: PGP signature



Messages sorted by: Reverse Date, Date, Thread, Author