<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git-sonar, branch master</title>
<subtitle>A heads up display for git</subtitle>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/x/git-sonar/'/>
<entry>
<title>Fix a bug which surfaced in commits_ahead/behind_remote</title>
<updated>2026-03-31T01:56:09+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2026-03-08T22:52:47+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/x/git-sonar/commit/?id=4f88708af94e82e7f8da427d7f3c6a876acbd71a'/>
<id>4f88708af94e82e7f8da427d7f3c6a876acbd71a</id>
<content type='text'>
If a remote branch is set, but doesn't exist (in the 'missingups'
condition), these functions would output blank ("") causing an error
when used in comparisons in color_local_commits().  It's arguable
whether the POSIX reworks caused this bug or simply revealed it, since
the previous code used bash's [[ ]] test syntax which seemed to tolerate
this case.

Restructure control flow so that any "error" in these functions yields a
result of "0".

The ahead/behind_master functions did not have this problem (the
git-rev-list command failure is already handled), but rewrite them to
match the style of the local functions.

Additionally, the git-rev-list commands are updated to use the more
straight-forward A..B syntax, dropping the use of --left-only or
--right-only.  This is more obvious code, and older git clients may
return incorrect results using the previous syntax.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If a remote branch is set, but doesn't exist (in the 'missingups'
condition), these functions would output blank ("") causing an error
when used in comparisons in color_local_commits().  It's arguable
whether the POSIX reworks caused this bug or simply revealed it, since
the previous code used bash's [[ ]] test syntax which seemed to tolerate
this case.

Restructure control flow so that any "error" in these functions yields a
result of "0".

The ahead/behind_master functions did not have this problem (the
git-rev-list command failure is already handled), but rewrite them to
match the style of the local functions.

Additionally, the git-rev-list commands are updated to use the more
straight-forward A..B syntax, dropping the use of --left-only or
--right-only.  This is more obvious code, and older git clients may
return incorrect results using the previous syntax.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Match remote/local commits display order of arrows and numbers</title>
<updated>2026-03-31T01:56:09+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2026-03-08T23:05:15+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/x/git-sonar/commit/?id=23b39889be1b58f17c945b54b6d180778a0f86ed'/>
<id>23b39889be1b58f17c945b54b6d180778a0f86ed</id>
<content type='text'>
When showing the number of commits two branches are ahead or behind each
other, always show the amount behind on the left side of the arrows and
the amount ahead on the right.

This style is taken from the %{remote} commits element, which used to
show commit counts this way to better illustrate that master and the
current branch are being compared.  Update the %{local} commits element
to match this style.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When showing the number of commits two branches are ahead or behind each
other, always show the amount behind on the left side of the arrows and
the amount ahead on the right.

This style is taken from the %{remote} commits element, which used to
show commit counts this way to better illustrate that master and the
current branch are being compared.  Update the %{local} commits element
to match this style.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'bashisms'</title>
<updated>2026-03-16T08:40:36+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2026-03-16T08:40:36+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/x/git-sonar/commit/?id=4613d4359f5eadf866bf1582276fae81fc3d680f'/>
<id>4613d4359f5eadf866bf1582276fae81fc3d680f</id>
<content type='text'>
The main git-sonar script is updated to run more portably, targeting
narrowly POSIX-compliant shells, and has been tested to be working
correctly on bash and dash.

Other platform-specific concerns have been addressed as well by updating
some aspetcts of the scripts operation.  The biggest change in this
regard is made to interactions with the timestamp file used to control
git-sonar's autofetch feature.

* bashisms:
  Switch to POSIX shebang line
  Convert hex character literals to octal
  Remove bash string indexing
  Remove echo flags
  Remove use of "local" keyword
  Remove [[ ]] tests
  Remove shell regex evaluation
  Refactor autofetch logic
  Refactor rc config file management
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The main git-sonar script is updated to run more portably, targeting
narrowly POSIX-compliant shells, and has been tested to be working
correctly on bash and dash.

Other platform-specific concerns have been addressed as well by updating
some aspetcts of the scripts operation.  The biggest change in this
regard is made to interactions with the timestamp file used to control
git-sonar's autofetch feature.

* bashisms:
  Switch to POSIX shebang line
  Convert hex character literals to octal
  Remove bash string indexing
  Remove echo flags
  Remove use of "local" keyword
  Remove [[ ]] tests
  Remove shell regex evaluation
  Refactor autofetch logic
  Refactor rc config file management
</pre>
</div>
</content>
</entry>
<entry>
<title>Switch to POSIX shebang line</title>
<updated>2026-03-16T08:36:28+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2026-03-01T04:45:59+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/x/git-sonar/commit/?id=bce1fbf7cc3e43437e1b77f70cdcb08976137951'/>
<id>bce1fbf7cc3e43437e1b77f70cdcb08976137951</id>
<content type='text'>
Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Convert hex character literals to octal</title>
<updated>2026-03-16T08:36:28+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2026-03-14T02:50:01+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/x/git-sonar/commit/?id=16c03453c1b45ac1817d10442689aa77e3d18a49'/>
<id>16c03453c1b45ac1817d10442689aa77e3d18a49</id>
<content type='text'>
The use of "\xHH" characters with echo and printf is an extension to the
POSIX spec and not supported by all shells.  Replace these with octal
character literals like "\000" with 3 digits per byte.

Link: https://unix.stackexchange.com/questions/627036
Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The use of "\xHH" characters with echo and printf is an extension to the
POSIX spec and not supported by all shells.  Replace these with octal
character literals like "\000" with 3 digits per byte.

Link: https://unix.stackexchange.com/questions/627036
Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove bash string indexing</title>
<updated>2026-03-16T08:36:28+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2026-03-08T21:06:44+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/x/git-sonar/commit/?id=f4636c75050f3ac3208d953c4d88c29d58309bdc'/>
<id>f4636c75050f3ac3208d953c4d88c29d58309bdc</id>
<content type='text'>
This syntax is undefined in POSIX shell.  Instead, use what should be a
more robust solution, and literally strip the $separator from the
beginning of the string, rather than just hard coding a length.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This syntax is undefined in POSIX shell.  Instead, use what should be a
more robust solution, and literally strip the $separator from the
beginning of the string, rather than just hard coding a length.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove echo flags</title>
<updated>2026-03-16T08:36:28+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2026-03-08T20:21:47+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/x/git-sonar/commit/?id=85aaf4533896a1398482559692e34e02366e89a0'/>
<id>85aaf4533896a1398482559692e34e02366e89a0</id>
<content type='text'>
echo options are undefined in POSIX shell.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
echo options are undefined in POSIX shell.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove use of "local" keyword</title>
<updated>2026-03-16T08:36:28+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2026-03-08T19:55:16+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/x/git-sonar/commit/?id=8960c6297eece7494da8d94076ecda87b02a9402'/>
<id>8960c6297eece7494da8d94076ecda87b02a9402</id>
<content type='text'>
The "local" keyword for scoping variables is undefined in POSIX shell.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The "local" keyword for scoping variables is undefined in POSIX shell.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove [[ ]] tests</title>
<updated>2026-03-16T08:36:28+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2026-03-08T18:45:31+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/x/git-sonar/commit/?id=62c225c40ffebcd3c35f3a9917f1a4dff4b81137'/>
<id>62c225c40ffebcd3c35f3a9917f1a4dff4b81137</id>
<content type='text'>
Tests using the `[[ ]]` syntax are not supported in POSIX-compliant
shell.  Remove the rest of these cases which more directly translate to
standard tests.  Some small cleanups are made along the way.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Tests using the `[[ ]]` syntax are not supported in POSIX-compliant
shell.  Remove the rest of these cases which more directly translate to
standard tests.  Some small cleanups are made along the way.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove shell regex evaluation</title>
<updated>2026-03-16T08:36:28+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2026-03-07T23:50:52+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/x/git-sonar/commit/?id=08ad67de221f737457cb8efc9bf02707d2aca549'/>
<id>08ad67de221f737457cb8efc9bf02707d2aca549</id>
<content type='text'>
Tests performed with `[[ ]]` are not supported in POSIX-compliant shell.
However, regex evaluation with the `=~` operator is a specific bashism
which has no direct counterpart in POSIX, so I wanted to handle these
cases in their own patch.

We can simply use grep to evaluate these tests instead.  The same regex
syntax is supported.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Tests performed with `[[ ]]` are not supported in POSIX-compliant shell.
However, regex evaluation with the `=~` operator is a specific bashism
which has no direct counterpart in POSIX, so I wanted to handle these
cases in their own patch.

We can simply use grep to evaluate these tests instead.  The same regex
syntax is supported.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
</feed>
